Search code examples
clinuxcontikicflags

Skipping incompatible error


I downloaded nettle 3.0 cryptography library and i compiled it on ubuntu. I ran an example and it s working fine on ubuntu. I added the compiled static library file (libnettle.a) to the my project makefile in contiki ,by simply adding:

LDFLAGS+= -L/usr/local/lib/ -lnettle

When i try to compile the node code , i get this

/usr/local/msp430/bin/../lib/gcc/msp430/4.7.0/../../.*./../msp430/bin/ld:skipping incompatible /usr/l*ocal/lib//libnettle.a when searching for -lnettle
/usr/local/msp430/bin/../lib/gcc/msp430/4.7.0/../../.*./../msp430/bin/ld: cannot find -lnettle*
collect2: error: ld returned 1 exit status
rm obj_sky/contiki-sky-main.o test_nettle.co
Process returned error code 2

make: *** [test_nettle.sky] Error 1

Should i add -m32 flag or what ?

If yes what flag ? CFLAG ?

and by the way , the nettle library is 32bits , i ve checked.

Thank you

Ok. So i rebuild the library using the following commands:

./configure --target=msp430 --prefix=/usr/local/Mymsp430
make
make install

Changed the LDFLAG to

LDFLAGS+= -L/usr/local/Mymsp430/lib/ -lnettle

But i still have the same error.


Solution

  • You have to build the library with the same toolchain as the one you're using to build your application.

    You can't link x86 code into code compiled for the MSP430, which is a totally different architecture.