Dynamically linked binaries do not work

Martin Emrich emme at emmes-world.de
Thu May 7 18:26:22 UTC 2009


Hi!

I am trying to cross-compile a linux system with uClibc. First some
version numbers: Linux 2.6.29.2, binutils 2.19.1, GCC 4.3.2, uClibc
0.9.30.1.

I wrote a set of scripts to first build the toolchain, and then the
target system (loosely based on Cross-Linux-From-Scratch, crosstool,
buildroot and lots of googling).

When I build using GNU libc (2.9), the target system works fine,
including busybox, X.Org and some other packages.

If I build using uClibc, the system does not boot (kernel panic, "failed
to execute /init"). By chance I noticed that when I build busybox
statically, the system boots, but any dynamically linked binaries do not
work.

the build system is x86_64, the target is i386.

This is what the host's ldd and uClibc's ldd.host say about the binaries:

--------------------------------------------
$ file readelf readelf.host ldd ldd.host ldconfig ldconfig.host

readelf:       ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), not stripped
readelf.host:  ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
ldd:           ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), not stripped
ldd.host:      ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
ldconfig:      ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
statically linked, not stripped
ldconfig.host: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped

$ ldd readelf readelf.host ldd ldd.host ldconfig ldconfig.host

readelf:
	linux-gate.so.1 =>  (0xf7f35000)
	libc.so.0 => not found
readelf.host:
	linux-vdso.so.1 =>  (0x00007fff93bff000)
	libc.so.6 => /lib/libc.so.6 (0x00007fee8b61f000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fee8b991000)
ldd:
	linux-gate.so.1 =>  (0xf7f47000)
	libc.so.0 => not found
ldd.host:
	linux-vdso.so.1 =>  (0x00007fffba3fe000)
	libc.so.6 => /lib/libc.so.6 (0x00007f8ab1e2d000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f8ab219f000)
ldconfig:
	not a dynamic executable
ldconfig.host:
	linux-vdso.so.1 =>  (0x00007fff34dff000)
	libc.so.6 => /lib/libc.so.6 (0x00007ff02c6fc000)
	/lib64/ld-linux-x86-64.so.2 (0x00007ff02ca6e000)

$ ./ldd.host readelf readelf.host ldd ldd.host ldconfig ldconfig.host
readelf:
readelf: not an ELF file.
readelf.host:
checking sub-depends for '/lib32/libc.so.6'
/lib32/libc.so.6: not an ELF file.
	libc.so.6 => /lib32/libc.so.6 (0x00000000)
	/lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00000000)
ldd:
ldd: not an ELF file.
ldd.host:
checking sub-depends for '/lib32/libc.so.6'
/lib32/libc.so.6: not an ELF file.
	libc.so.6 => /lib32/libc.so.6 (0x00000000)
	/lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00000000)
ldconfig:
ldconfig: not an ELF file.
ldconfig.host:
checking sub-depends for '/lib32/libc.so.6'
/lib32/libc.so.6: not an ELF file.
	libc.so.6 => /lib32/libc.so.6 (0x00000000)
	/lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00000000)
--------------------------------------------

I wonder why ldd.host does not recognize the target binaries.

On the target system, when I try to run a dynamically linked binary
(e.g. strace), I just get "-/bin/sh: strace: not found."

What could I do next to find the cause? If more log files or config
files are necessary, just ask...

Thanks

Martin


More information about the uClibc mailing list