[uClibc] uClibc-0.9.24: ldd/ldconfig build errors

Carl Miller chaz at energoncube.net
Wed Dec 24 21:26:02 UTC 2003


> > I think this can be fixed by a custom spec file for gcc. We'll see.
> 
> Not even that. See below.

Anything that can be solved by giving the right command-line options to
gcc can be solved by a custom specs file.  It's just the matter of finding
the right set of command-line options to specify either on the command
line or in the specs file.

> > [charlieb at localhost utils]$ gcc --verbose -Wall -Wstrict-prototypes 
> > -Wno-trigraphs -fno-strict-aliasing  -mpreferred-stack-boundary=2 
> > -falign-jumps=0 -falign-loops=0 -Os     -fno-builtin -nostdinc -D_LIBC 
> > -I../include -I. -I/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include  
> > -DNDEBUG -fPIC -D__LDSO_LDD_SUPPORT -Wl,-s  -DUCLIBC_RUNTIME_PREFIX=  
> > -DUCLIBC_LDSO=ld-uClibc.so.0  ldd.c -o ldd  -L../lib
> 
> Appenindg
> 
>  -nostdlib ../lib/crt0.o -lc
> 
> gives both a clean link and a working (but confused) executable.

In addition to those options, try adding:

    -Wl,--dynamic-linker,{PATH-TO-YOUR-INSTALLED}ld-uClibc.so.0
    -Wl,-rpath,`pwd`/../lib,-rpath-link,`pwd`/../lib

There's probably a better way to come up with the absolute path to your
installed uClibc library directory.  Feel free to substitute that.  And
note that ld-uClibc.so.0 above must also be given with a full pathname.

> [charlieb at localhost utils]$ gcc -Wall -Wstrict-prototypes -Wno-trigraphs 
> -fno-strict-aliasing  -mpreferred-stack-boundary=2 -falign-jumps=0 
> -falign-loops=0 -Os     -fno-builtin -nostdinc -D_LIBC -I../include -I. 
> -I/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include  -DNDEBUG -fPIC 
> -D__LDSO_LDD_SUPPORT -Wl,-s  -DUCLIBC_RUNTIME_PREFIX=  
> -DUCLIBC_LDSO=ld-uClibc.so.0  ldd.c -o ldd  -L../lib -nostdlib 
> ../lib/crt0.o -lc
> [charlieb at localhost utils]$
> [charlieb at localhost utils]$ ./ldd
> ./ldd: error while loading shared libraries: libc.so.0: cannot open shared 
> object file: No such file or directory
> [charlieb at localhost utils]$ LD_LIBRARY_PATH=../lib ./ldd
> ldd: missing file arguments
> Try `ldd --help' for more information.
> [charlieb at localhost utils]$ LD_LIBRARY_PATH=../lib ./ldd ldd
>         libtermcap.so.2 => /lib/libtermcap.so.2 (0x00ebf000)
>         libdl.so.2 => /lib/libdl.so.2 (0x00b23000)
>         libc.so.6 => /lib/tls/libc.so.6 (0x003b3000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x0079d000)
> [charlieb at localhost utils]$

Your ldd was compiled to use the system-native ld.so and the system-native
dynamic library search path.  Both should be changed to the uClibc versions.
I think the options I gave above should do that.

In general, when debugging stuff like this, it's helpful to try running all
your compiles with "gcc -v".  That will show you in gory detail exactly how
each component of the compiler is being invoked.  In particular, you'll see
all of the options provided by the specs file, which, in this case, would
have included specifying the system-native ld.so and dynamic library search
path.


                             ------Carl



More information about the uClibc mailing list