This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Behaviour of toolchain "cannot find /lib/libc.so.0"


Hello,

I've run into the exact same problem building a patched buildroot
2010.02 using crosstool-ng 1.8.0.  It blows up in net-snmp 5.5 with that
very same error.  This happened for both my uclibc build for arm and
powerpc, (but not a problem building the same buildroot for
x86/glibc/nptl build - which is a different ball game).

But it builds all three OK using crosstool-ng 1.7.2

The only real difference I see so far is binutil 2.20.1 versus binutil
2.20 (apart from any crosstool patch differences that may be there).

I am going to try again with crosstool 1.8.0 but with binutil 2.20
selected instead of 2.20.1

Regards,

Darcy

-----Original Message-----
From: crossgcc-owner@sourceware.org
[mailto:crossgcc-owner@sourceware.org] On Behalf Of Thomas Petazzoni
Sent: Friday, August 13, 2010 6:20 AM
To: crossgcc@sourceware.org
Subject: Behaviour of toolchain "cannot find /lib/libc.so.0"

Hello,

I have a question regarding the behaviour of a cross-compiling
toolchain. For example, using a Crosstool-NG toolchain :

1. A hello-world like program compiles

../toolchains/ctng-arm-unknown-linux-uclibcgnueabi/bin/arm-unknown-linux
-uclibcgnueabi-gcc -o toto toto.c

   so far, so good.

2. Now, let's copy the toolchain sysroot

cp -a
../toolchains/ctng-arm-unknown-linux-uclibcgnueabi/arm-unknown-linux-ucl
ibcgnueabi/sys-root/ ctng

3. And compile the program by telling the compiler where the sysroot is

../toolchains/ctng-arm-unknown-linux-uclibcgnueabi/bin/arm-unknown-linux
-uclibcgnueabi-gcc --sysroot=/home/test/tmp/ctng/ -o toto toto.c

   Good, still works.

4. Now, let's specify the full path to /usr/lib/libc.so in the new
   sysroot (yeah, doesn't make sense, but please keep reading)

../toolchains/ctng-arm-unknown-linux-uclibcgnueabi/bin/arm-unknown-linux
-uclibcgnueabi-gcc --sysroot=/home/test/tmp/ctng/ -o toto toto.c
/home/test/tmp/ctng/usr/lib/libc.so 
/home/test/toolchains/ctng-arm-unknown-linux-uclibcgnueabi/lib/gcc/arm-u
nknown-linux-uclibcgnueabi/4.4.3/../../../../arm-unknown-linux-uclibcgnu
eabi/bin/ld: cannot find /lib/libc.so.0
collect2: ld returned 1 exit status

Ah, ah, it fails. This is because usr/lib/libc.so is a linker script
that references /lib/libc.so.0. However, as this usr/lib/ directory is
inside the toolchain sysroot, I thought "ld" was supposed to interpret
paths in linker script relative to the sysroot. But this doesn't happen
here.

Of course, passing this path to the C library libc.so may sounds
strange and inapropriate, but it's exactly what my configure script is
doing:

configure:6447: checking for GNU gettext in libintl
configure:6474:
/home/test/toolchains/ctng-arm-unknown-linux-uclibcgnueabi/bin/arm-unkno
wn-linux-uclibcgnueabi-gcc --sysroot=/home/test/outputs/test-57/staging
-o conftest -pipe -Os  -mabi=aapcs-linux -msoft-float
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-I/home/test/outputs/test-57/staging/usr/include
-L/home/test/outputs/test-57/staging/lib
-L/home/test/outputs/test-57/staging/usr/lib conftest.c
/home/test/outputs/test-57/staging/usr/lib/libintl.so
/home/test/outputs/test-57/staging/usr/lib/libc.so -Wl,-rpath
-Wl,/home/test/outputs/test-57/staging/usr/lib >&5
/home/test/toolchains/ctng-arm-unknown-linux-uclibcgnueabi/lib/gcc/arm-u
nknown-linux-uclibcgnueabi/4.4.3/../../../../arm-unknown-linux-uclibcgnu
eabi/bin/ld: cannot find /lib/libc.so.0
collect2: ld returned 1 exit status

I have tested the same thing with a CodeSourcery toolchain, and it
fails similarly. So it doesn't seem to be a problem of Crosstool-NG
toolchains specifically.

Any clue ?

Thanks,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

--
For unsubscribe information see http://sourceware.org/lists.html#faq


--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]