LDFLAGS and cross compiling issue only with some libraries (ex directfb, libjpeg)

1.2k Views Asked by At

I am running into a problem with Eclipse when I try to set some libraries in LDFLAGS. I have the following configuration:

  • Eclipse
  • Yocto project with autotools
  • ublibceabi cross-compiler
  • programming in C

When I build a simple Hello World program, I can see from the output console the commands:

arm-poky-linux-uclibceabi-gcc  -march=armv7-a -marm -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/opt/tiny-linux-uclibc/1.5.1/sysroots/cortexa9hf-vfp-neon-poky-linux-uclibceabi -DHAVE_CONFIG_H -I. -I..   --sysroot=/opt/tiny-linux-uclibc/1.5.1/sysroots/cortexa9hf-vfp-neon-poky-linux-uclibceabi  -g -O0  --sysroot=/opt/tiny-linux-uclibc/1.5.1/sysroots/cortexa9hf-vfp-neon-poky-linux-uclibceabi -MT hello-hello.o -MD -MP -MF .deps/hello-hello.Tpo -c -o hello-hello.o `test -f 'hello.c' || echo './'`hello.c
mv -f .deps/hello-hello.Tpo .deps/hello-hello.Po
../arm-poky-linux-uclibceabi-libtool --tag=CC   --mode=link arm-poky-linux-uclibceabi-gcc  -march=armv7-a -marm -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/opt/tiny-linux-uclibc/1.5.1/sysroots/cortexa9hf-vfp-neon-poky-linux-uclibceabi  -g -O0  --sysroot=/opt/tiny-linux-uclibc/1.5.1/sysroots/cortexa9hf-vfp-neon-poky-linux-uclibceabi  --sysroot=/opt/tiny-linux-uclibc/1.5.1/sysroots/cortexa9hf-vfp-neon-poky-linux-uclibceabi -o hello hello-hello.o  
arm-poky-linux-uclibceabi-libtool: link: arm-poky-linux-uclibceabi-gcc -march=armv7-a -marm -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/opt/tiny-linux-uclibc/1.5.1/sysroots/cortexa9hf-vfp-neon-poky-linux-uclibceabi -g -O0 --sysroot=/opt/tiny-linux-uclibc/1.5.1/sysroots/cortexa9hf-vfp-neon-poky-linux-uclibceabi --sysroot=/opt/tiny-linux-uclibc/1.5.1/sysroots/cortexa9hf-vfp-neon-poky-linux-uclibceabi -o hello hello-hello.o

Now, if I have to use some libraries, such as libjpeg, I know I have to edit the LDFLAGS environment variable. So, in Project > Properties > Autotools > configure, I edited LDFLAGS adding

-L/path/to/lib -ljpeg

Now when building the project I face this issue:

checking for style of include used by make... GNU
checking for arm-poky-linux-uclibceabi-gcc... arm-poky-linux-uclibceabi-gcc  -march=armv7-a -marm -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/opt/tiny-linux-uclibc/1.5.1/sysroots/cortexa9hf-vfp-neon-poky-linux-uclibceabi
checking whether the C compiler works... no
configure: error: in `/home/user/workspace/hello':
configure: error: in `/home/user/workspace/hello':
configure: error: C compiler cannot create executables
configure: error: C compiler cannot create executables
See `config.log' for more details

If I try with another standard library, such as -lm, it works fine. So, I cannot figure how Eclipse does not like some of my libs...

0

There are 0 best solutions below