Yocto library link error(real-ld): cannot find /lib/libc.so.6

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Yocto library link error(real-ld): cannot find /lib/libc.so.6

Jump to solution
15,394 Views
shaot
Contributor II

Hi, 

I try to compile a C program using pcap with Eclipse and Yocto ADT.

After building, I got errors as bottom (config.log).

  • There are several errors.
  1. arm-fslc-linux-gnueabi-gcc: error: unrecognized command line option '-V'
  2. arm-fslc-linux-gnueabi-gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
  3. /opt/fslc-framebuffer/2.2.1/sysroots/x86_64-fslcsdk-linux/usr/libexec/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/6.2.0/real-ld: cannot find /lib/libc.so.6
    /opt/fslc-framebuffer/2.2.1/sysroots/x86_64-fslcsdk-linux/usr/libexec/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/6.2.0/real-ld: cannot find /usr/lib/libc_nonshared.a
    /opt/fslc-framebuffer/2.2.1/sysroots/x86_64-fslcsdk-linux/usr/libexec/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/6.2.0/real-ld: cannot find /lib/ld-linux-armhf.so.3
    collect2: error: ld returned 1 exit status

I think the error 1 and 2 can be ignored (If there are solutions, please teach me).

However the error 3 says it cannot link library and C compiler cannot create executables.

How can I solve this error?

My environment:

Eclipse settings:

  • Properties>Autotools>Configure settings>configure>Command:
    CFLAGS=" -g -O0  -I/home/user/var-fslc-yocto/build_fb/tmp/sysroots/imx6ul-var-dart/usr/include --sysroot=/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi" CXXFLAGS=" -g -O0  --sysroot=/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi" LDFLAGS=" -L/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi -L/home/user/var-fslc-yocto/build_fb/tmp/sysroots/imx6ul-var-dart -L/home/user/var-fslc-yocto/build_fb/tmp/sysroots/imx6ul-var-dart/usr/lib  --sysroot=/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi" CPPFLAGS=" --sysroot=/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi" configure --with-libtool-sysroot=/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi 
  • All options:
     --host=arm-fslc-linux-gnueabi --build=x86_64-linux --target=arm-fslc-linux-gnueabi  

What I checked

  • under sysroots (=/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi ), there are lib/libc.so.6, usr/lib/libc_nonshared.a, lib/ld-linux-armhf.so.3. However config.log says cannot find them.
  • https://community.nxp.com/thread/322870  this link treat the same problem, but I cannot understan what I should do (I think I may set the same settings as this link.).

config.log

configure:3187: arm-fslc-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi -V >&5
arm-fslc-linux-gnueabi-gcc: error: unrecognized command line option '-V'
arm-fslc-linux-gnueabi-gcc: fatal error: no input files
compilation terminated.
configure:3198: $? = 1
configure:3187: arm-fslc-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi -qversion >&5
arm-fslc-linux-gnueabi-gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
arm-fslc-linux-gnueabi-gcc: fatal error: no input files
compilation terminated.
configure:3198: $? = 1
configure:3218: checking whether the C compiler works
configure:3240: arm-fslc-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi -g -O0 -I/home/user/var-fslc-yocto/build_fb/tmp/sysroots/imx6ul-var-dart/usr/include --sysroot=/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi --sysroot=/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi -L/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi -L/home/user/var-fslc-yocto/build_fb/tmp/sysroots/imx6ul-var-dart -L/home/user/var-fslc-yocto/build_fb/tmp/sysroots/imx6ul-var-dart/usr/lib --sysroot=/opt/fslc-framebuffer/2.2.1/sysroots/armv7at2hf-neon-fslc-linux-gnueabi conftest.c >&5
/opt/fslc-framebuffer/2.2.1/sysroots/x86_64-fslcsdk-linux/usr/libexec/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/6.2.0/real-ld: cannot find /lib/libc.so.6
/opt/fslc-framebuffer/2.2.1/sysroots/x86_64-fslcsdk-linux/usr/libexec/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/6.2.0/real-ld: cannot find /usr/lib/libc_nonshared.a
/opt/fslc-framebuffer/2.2.1/sysroots/x86_64-fslcsdk-linux/usr/libexec/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/6.2.0/real-ld: cannot find /lib/ld-linux-armhf.so.3
collect2: error: ld returned 1 exit status
configure:3244: $? = 1
configure:3282: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "packetcapture"
| #define PACKAGE_TARNAME "packetcapture"
| #define PACKAGE_VERSION "0.1.0"
| #define PACKAGE_STRING "packetcapture 0.1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "packetcapture"
| #define VERSION "0.1.0"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3287: error: in `/home/user/workspace/packetcapture':
configure:3289: error: C compiler cannot create executables
See `config.log' for more details

Labels (4)
0 Kudos
1 Solution
10,635 Views
gusarambula
NXP TechSupport
NXP TechSupport

Hello Hirotoshi Sato,

Are you still experiencing this error? I’m no familiar with the Variscite toolchain and BSP but it looks like the problem is that the path to the libraries is not correct. Perhaps it’s looking for the libraries on the path of the host and not the sysroot of the BSP.

Have you set the flags as shown on the following Yocto document?

https://www.yoctoproject.org/docs/1.6/adt-manual/adt-manual.html#makefile-based-projects

I hope this helps!

Regards,

View solution in original post

0 Kudos
2 Replies
10,636 Views
gusarambula
NXP TechSupport
NXP TechSupport

Hello Hirotoshi Sato,

Are you still experiencing this error? I’m no familiar with the Variscite toolchain and BSP but it looks like the problem is that the path to the libraries is not correct. Perhaps it’s looking for the libraries on the path of the host and not the sysroot of the BSP.

Have you set the flags as shown on the following Yocto document?

https://www.yoctoproject.org/docs/1.6/adt-manual/adt-manual.html#makefile-based-projects

I hope this helps!

Regards,

0 Kudos
10,635 Views
shaot
Contributor II

I am sorry late notice... 

As you mentioned, I had to modify library path.

Thank you!

0 Kudos