Dynamically linked binaries do not work

Kyle Sallee kyle.sallee at gmail.com
Sun May 10 17:26:05 UTC 2009


I posted my reply at the top,
please let me know if this is discouraged on the uclibc mailing list.

Did you manage to have it compile and link without using a gcc cross compiler
or gcc native to *-linux-uclibc?
There is this possible relevant text in the gcc manual page:

       -mglibc
           Use the GNU C library instead of uClibc.  This is the
default except on
           *-*-linux-*uclibc* targets.

       -muclibc
           Use uClibc instead of the GNU C library.  This is the default on
           *-*-linux-*uclibc* targets.


Normally, gcc would go with the target default.
But if you wanted to force it to specify
/lib/ld-uClibc.so.0 instead of /lib/ld-linux.so.2
then that -muclibc gcc parameter added to LDFLAGS
might make it so.
However, I am uncertain if busybox uses LDFLAGS

My guess is that the gcc used to compile busybox
was not the gcc that is part of the cross compile tool chain
nor a gcc that is native *-linux-uclibc.
However, I am really new at using uclibc
so my guess is probably wrong.

Is busybox also dynamically linked with /lib/libc.so.6 ?
$ objdump -x busybox | grep NEEDED

that provides a quick easy way to what the ELF expects to
dynamically link with when run.


On Sun, May 10, 2009 at 4:24 AM, Martin Emrich <emme at emmes-world.de> wrote:
> Hi!
>
> Mike Frysinger schrieb:
>> On Thursday 07 May 2009 14:26:22 Martin Emrich wrote:
>>> 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.
>>
>> indicates you didnt install all the relevant uClibc files correctly in the
>> /lib/ directory, or you didnt compile uClibc correctly
>
> Yes, I investigated further, and I found out that the dynamically linked
> binaries reference /lib/ld-linux.so.2, while uClibc installs
> /lib/ld-uClibc.so.0. If I symlink ld-uClibc.so.0 to ld-linux.so.2, the
> dynamically linked binaries work fine.
> Is this symlink supposed to be made, or did I do something wrong while
> building the target system?
>
>> ldd should never be used on ELFs which are not native.  use `scanelf -n` or
>> `readelf -d`.
>
> Ok, I thought the *.host tools were intended to "simulate" the
> corresponding target binaries while on the build system.
>
> Ciao
>
> Martin


More information about the uClibc mailing list