[uClibc] can't build "hello world" with new cross-tools

Charles Palmer charles.palmer at acutetechnology.com
Tue May 24 21:00:44 UTC 2005


Neil Ludd suggested I was linking programs with the wrong libraries:

>
> You see in your ldd output there was libc.so.6 and libc.so.0
> the .so.6 is glibc while the so.0 is uClibc.
>

It might be more complicated:


My "old" mipsel and uClibc tools compile a trivial hello world program, as 
do my "new" mipsel tools, built by downloading the buildroot package and 
configuring it for my processor (AMD Au1200 - mips32, little-endian). The 
old executable runs on my target; my new executable doesn't.

The ldd.host program, produced by buildroot, gives these two different 
results. hello is compiled with the old tools and hello-br with the new 
tools. The commands were:
<path to old mipsel tools>/mipsel-linux-gcc hello.c -o hello
and
<path to new mipsel tools>/mipsel-linux-gcc hello.c -o hello-br

[acutetech at localhost myprograms]$ 
~/buildroot/toolchain_build_mipsel/uClibc/utils/ldd.host hello
        libc.so.0 => not found (0x00000000)
        /lib/ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x00000000)
[acutetech at localhost myprograms]$ 
~/buildroot/toolchain_build_mipsel/uClibc/utils/ldd.host hello-br
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00000000)
        libc.so.0 => not found (0x00000000)
        libc.so.6 => /lib/libc.so.6 (0x00000000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000)

When I run the "new" executable on an old root filesystem (and "new" /lib) I 
get a"Segmentation fault" message. I also get this message if I link it 
with -static (no libraries required?).

When I run the "new" executable on a pre-built root filesystem (downloaded 
from buildroot website) I get a "can't resolve symbol 'main'" message, and 
ldd gives this (note - different than ldd.host running on the host):

can't open cache '/etc/ld.so.cache'
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2aaee000)
        libc.so.0 => /lib/libc.so.0 (0x2ab3a000)
        ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)

The statically-linked executable gives "Segmentation fault".

In both cases the kernel is built with the "old" mipsel toolchain.


What is going on? Why do the new tools seem to link against two libc 
libraries, and use a different ld- loader, when viewed from the host, and 
different results when viewed from the target? Is the problem with the 
linking, or elsewhere? How do I make them work as they should? Is it a 
problem when the new tools were built, or in my environment when I use them? 
If the latter, then why are the old tools working? Arrrrgggghhhh!





More information about the uClibc mailing list