Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling for Cortex-A9 #11

Closed
pietrotedeschi opened this issue May 22, 2020 · 5 comments
Closed

Compiling for Cortex-A9 #11

pietrotedeschi opened this issue May 22, 2020 · 5 comments

Comments

@pietrotedeschi
Copy link

Hello, when I try to compile for Cortex-A9 with the following toolchain arm-linux-gnueabihf-gcc as:
arm-linux-gnueabihf-gcc -mcpu=cortex-a9 -static -O2 testecc.c core.a -o testecc
I have an error like this:

/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: core.a: error adding symbols: file format not recognized
collect2: error: ld returned 1 exit status

Any suggestion to solve this issue?

@pietrotedeschi pietrotedeschi changed the title Compiling for Cortex-a9 Compiling for Cortex-A9 May 22, 2020
@mcarrickscott
Copy link
Contributor

mcarrickscott commented May 22, 2020 via email

@pietrotedeschi
Copy link
Author

pietrotedeschi commented May 22, 2020

Hello Pietro, We don't have your configuration, so we cannot reproduce this problem here. It appears from the error message that you are cross-compiling, and maybe you built the library core.a in one environment and then ported it to another environment(?) It seems that the cross-compiled library is not of the correct format for the runtime environment. Mike

On Fri, May 22, 2020 at 6:30 AM Pietro Tedeschi @.***> wrote: Hello, when I try to compile for Cortex-A9 with the following toolchain arm-linux-gnueabihf-gcc as: arm-linux-gnueabihf-gcc -mcpu=cortex-a9 -static -O2 testecc.c core.a -o testecc I have an error like this: /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: core.a: error adding symbols: file format not recognized collect2: error: ld returned 1 exit status Any suggestion to solve this issue? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#11>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAU3ZDSZQ2F63U3ACBS36C3RSYEYJANCNFSM4NHPZLNA .

Exactly Mike. I generated my core.a on my laptop with a GNU/Linux distro since I cannot install the gcc on this very constrained environment (where there is also a minimal distro Linux installed) to generate the core.a library on it. I was thinking to create a VM with the same architecture and generate the core.a on it, but it is very time consuming for a test. Do you have any other suggestion to solve this issue?

@mcarrickscott
Copy link
Contributor

mcarrickscott commented May 22, 2020 via email

@pietrotedeschi
Copy link
Author

pietrotedeschi commented May 22, 2020

Hello Pietro, Without access to your configuration, we cannot really help. You might try cross-compiling a really simple "hello world" program, or create a really simple library with one function that prints "hello world", and see can you get that to work. Mike On Fri, May 22, 2020 at 10:18 AM Pietro Tedeschi notifications@github.com wrote:

Hello Pietro, We don't have your configuration, so we cannot reproduce this problem here. It appears from the error message that you are cross-compiling, and maybe you built the library core.a in one environment and then ported it to another environment(?) It seems that the cross-compiled library is not of the correct format for the runtime environment. Mike … <#m_2159987148689211825_> On Fri, May 22, 2020 at 6:30 AM Pietro Tedeschi @.***> wrote: Hello, when I try to compile for Cortex-A9 with the following toolchain arm-linux-gnueabihf-gcc as: arm-linux-gnueabihf-gcc -mcpu=cortex-a9 -static -O2 testecc.c core.a -o testecc I have an error like this: /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: core.a: error adding symbols: file format not recognized collect2: error: ld returned 1 exit status Any suggestion to solve this issue? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#11 <#11>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAU3ZDSZQ2F63U3ACBS36C3RSYEYJANCNFSM4NHPZLNA . Exactly Mike. I generated my core.a on my laptop with a a GNU/Linux distro since I cannot install the gcc on this very constrained environment (where there is also a minimal distro Linux installed) to generate the core.a library on it. I was thinking to create a VM with the same architecture and generate the core.a on it, but it is very time consuming for a test. Do you have any other suggestion to solve this issue? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#11 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAU3ZDWWAOC2QHUDQC57OXDRSY7NLANCNFSM4NHPZLNA .

Ok Mike, I created a simple helloword as following:

#include <stdio.h>
int main()
{

printf("Hello World");
return 0;
}

I compiled it with

arm-linux-gnueabihf-gcc -mcpu=cortex-a9 -static -O2 main.c core.a -o main

and I did not receive any errors during the compiling.

Update:
I tried now a simple example compiling with the same tool-chain, and unfortunately I received the aforementioned error:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "randapi.h"

#include "ecdh_SECP160R1.h"
#define field_size_EFS EFS_SECP160R1
#define field_size_EGS EGS_SECP160R1
#define AESKEY AESKEY_SECP160R1

int main()
{
    int i,fd1;
    unsigned long ran;

    time((time_t *)&ran);
    char raw[100];
    octet RAW = {0, sizeof(raw), raw};

    csprng RNG;                // Crypto Strong RNG
    CREATE_CSPRNG(&RNG, &RAW);  // initialise strong RNG
    
    RAW.len = 100;              // fake random seed source
    RAW.val[0] = ran;
    RAW.val[1] = ran >> 8;
    RAW.val[2] = ran >> 16;
    RAW.val[3] = ran >> 24;
    for (i = 4; i < 100; i++) RAW.val[i] = i;

    printf("\nStarting --- protocol \n");
}

@mcarrickscott
Copy link
Contributor

mcarrickscott commented May 22, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants