[Scratchbox-users] Libc dependency problems setting up foreign toolchain

Jim Heck jsurf at heckheck.com
Thu Nov 30 21:34:14 EET 2006


I'm trying to get going with scratchbox using foreign toolchains, but 
I'm not having much success.  I've managed to build a toolchain using 
crosstool 0.42 of the following flavor 
/gcc-3.4.5-glibc-2.3.6/powerpc-603-linux-gnu.  I originally built this 
toolchain under a stock install of Ubuntu 6.10 (same machine scratchbox 
1.0.6 is installed on) to the location suggested by the crosstool 
documentation 
/opt/crosstool/gcc-3.4.5-glibc-2.3.6/powerpc-603-linux-gnu.  To install 
in scratchbox, I tar'd up the entire directory and then untar'd it at 
/scratchbox/compilers.

After installing the sb-toolchain-extras darcs tree in my sbox user home 
directory, I then attempted to run 
~/sb-toolchain-extras/confhelper/create_toolchain_conf.py with the 
following results:

-------------------------------------
[sbox-host1: /scratchbox/compilers/powerpc-603-linux-gnu] > 
~/sb-toolchain-extras/confhelper/create_toolchain_conf.py
COMPILER_NAME = powerpc-603-linux-gnu
COMPILER_PACKAGE = <you have to fill in this one>
ARCH = powerpc
SUB_ARCH = $(ARCH)
VENDOR = 603-
TOOLCHAIN_PREFIX_END = gnu-
TARGET_END = -gnu

./powerpc-603-linux-gnu/bin/ld: /scratchbox/host_shared/lib/libc.so.6: 
version `GLIBC_2.4' not found (required by ./powerpc-603-linux-gnu/bin/ld)
./bin/powerpc-603-linux-gnu-ld: /scratchbox/host_shared/lib/libc.so.6: 
version `GLIBC_2.4' not found (required by ./bin/powerpc-603-linux-gnu-ld)
./distributed/bin/powerpc-603-linux-gnu-ld: 
/scratchbox/host_shared/lib/libc.so.6: version `GLIBC_2.4' not found 
(required by ./distributed/bin/powerpc-603-linux-gnu-ld)
HEADERS_DIR = $(COMPILER_DIR)/powerpc-603-linux-gnu/include
LINUX_HEADERS_SUBDIRS = linux asm
LINUX_HEADERS_VER = 2.6.12

LIBC_VER = 2.3.6
#
# ERROR: I don't have arch and therefore cannot find bin and lib dirs.
CHECKSUM_FILE   = ../../$(CONFIG:.conf=.checksums)
[sbox-host1: /scratchbox/compilers/powerpc-603-linux-gnu] >
-----------------------------------

On digging a little more, I think all my problems stem from two issues.

First, when invoked directly, the compiler cannot find my libc library, 
since in the scratchbox environement, the library search path does not 
include it.  This is shown with ldd.

------------------------------------
[sbox-host1: /scratchbox/compilers/powerpc-603-linux-gnu] > ldd 
./powerpc-603-linux-gnu/bin/gcc
        libc.so.6 => not found (0x00000000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000)
[sbox-host1: /scratchbox/compilers/powerpc-603-linux-gnu] > export 
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/scratchbox/compilers/powerpc-603-linux-gnu/powerpc-603-linux-gnu/lib"
[sbox-host1: /scratchbox/compilers/powerpc-603-linux-gnu] > echo 
$LD_LIBRARY_PATH 
/lib:/usr/lib:/usr/local/lib:/usr/X11R6/lib:/scratchbox/compilers/powerpc-603-linux-gnu/powerpc-603-linux-gnu/lib
[sbox-host1: /scratchbox/compilers/powerpc-603-linux-gnu] > ldd 
./powerpc-603-linux-gnu/bin/gcc         libc.so.6 => 
/scratchbox/compilers/powerpc-603-linux-gnu/powerpc-603-linux-gnu/lib/libc.so.6 
(0x00000000)
        /lib/ld.so.1 => /lib/ld.so.1 (0x00000000)
[sbox-host1: /scratchbox/compilers/powerpc-603-linux-gnu] >

------------------------------------

I can fix this by setting up LD_LIBRARY_PATH, but my underlying question 
is how are the environment variables supposed to be managed within 
scratchbox to support a foreign toolchain?  Is there a list of what and 
how the environment should be setup to support a compiler that has been 
placed in the /scratchbox/compilers directory?

My second problem is that my gcc compiler is dependent on GLIBC_2.4, 
which is probably due to having been built in the Ubuntu environment 
which has libc6 version '2.4-1ubunt' installed.  This is not exported by 
the libc.so.6 that I have in my compiler tree (since I built against 2.3.6).

I know this is more of a crosstool question, but does anyone know how to 
configure crosstool to build a gcc3.4 compiler that is independent of 
the host environment (e.g. no dependency on the libc for the host on 
which the compiler was built)?

Thanks in advance for any help people can provide,

-Jim Heck








More information about the Scratchbox-users mailing list