[uClibc]Possible subtle problem with dynamic linked applications

Gianci gianci at freemail.it
Tue Dec 18 09:10:28 UTC 2001


Hello all,

I had some trouble for a while because all my uClibc-compiled
applications suddenly and unexpectedly started to segfault on
my workstation, but not on the target system.

After some investigation I finally found the reason. I created a static
link /lib/libc.so.0 to the standard shared C library (it was needed by
another application). 

It is this link that causes all uClibc dynamic linked applications to
crash on a Linux system with both uClibc and the standard glibc library.

If you strace a uClibc application in a clean system you will get
something like this:
 
embedded at linux:/tmp > strace -e trace=open ./hello
open("//usr/lib/libc.so.0", O_RDONLY)   = -1 ENOENT (No such file or directory)
open("//lib/libc.so.0", O_RDONLY)       = -1 ENOENT (No such file or directory)
open("/usr/i386-linux-uclibc/lib/libc.so.0", O_RDONLY) = 3
Hello
embedded at linux:/tmp > 

If /lib/libc.so.0 or /usr/lib/libc.so.0 is a link to /lib/libc.so.6 this
is what you will get:

embedded at linux:/tmp > strace -e trace=open ./hello
open("//usr/lib/libc.so.0", O_RDONLY)   = 3
open("//usr/lib/ld-linux.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
open("//lib/ld-linux.so.2", O_RDONLY)   = 3
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++
embedded at linux:/tmp > 

Regards,
Gianci




More information about the uClibc mailing list