Trouble compiling uClibc with NPTL support on Ubuntu 12.04

Scott Moore scott.moore at sri.com
Thu Jul 26 18:41:49 UTC 2012


Hi all,
I'm trying to compile uClibc 0.9.33.2 with NPTL support, but I keep 
encountering build failures (possibly related to ldso). I have 
successfully built uClibc in with no thread support or with 
linuxthreads.old. I appreciate any help you can offer. Please let me 
know if there are additional details I can provide.
Thanks,
Scott

Some specs:

$ uname -a
Linux ubuntu 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 
2012 x86_64 x86_64 x86_64 GNU/Linux

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.5.3/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 
4.5.3-12ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs 
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr 
--program-suffix=-4.5 --enable-shared --enable-linker-build-id 
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext 
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin 
--enable-gold --enable-ld=default --with-plugin-ld=ld.gold 
--enable-objc-gc --disable-werror --with-arch-32=i686 
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu 
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.5.3 (Ubuntu/Linaro 4.5.3-12ubuntu2)

$ ld -v
GNU ld (GNU Binutils for Ubuntu) 2.22




Here are all of the errors or warnings that appear during compilation, 
followed by the command that fails and something that seem like it might 
help:

$ make
    .
    .
    .
   CC ldso/ldso/ldso.oS
ldso/ldso/ldso.c: In function '_dl_get_ready_to_run':
ldso/ldso/ldso.c:750:22: warning: cast from pointer to integer of 
different size
ldso/ldso/ldso.c:750:16: warning: unused variable 'tmp'
    .
    .
    .
make[1]: `lib/ld64-uClibc.so' is up to date.
   CC ldso/libdl/libdl.oS
ldso/libdl/libdl.c: In function 'do_dlsym':
ldso/libdl/libdl.c:738:59: warning: cast from pointer to integer of 
different size
    .
    .
    .
   CC libc/stdio/popen.os
libc/stdio/popen.c:136:2: warning: #warning is pclose correct wrt the 
new mutex semantics?
    .
    .
    .
   CC libc/stdio/_stdio.os
libc/stdio/_stdio.c: In function '_stdio_term':
libc/stdio/_stdio.c:199:2: warning: #warning check
    .
    .
    .
   CC libc/stdio/_vfprintf_internal.os
In file included from libc/stdio/_vfprintf_internal.c:9:0:
libc/stdio/_vfprintf.c: In function '_vfprintf_internal':
libc/stdio/_vfprintf.c:1448:15: warning: 'argptr$' may be used 
uninitialized in this function
    .
    .
    .
   CC libc/stdio/fflush_unlocked.os
In file included from libc/stdio/fflush_unlocked.c:9:0:
libc/stdio/fflush.c: In function 'fflush_unlocked':
libc/stdio/fflush.c:100:2: warning: #warning fix for nonatomic
libc/stdio/fflush.c:101:2: warning: #warning unnecessary check if no threads
    .
    .
    .
   CC libpthread/nptl/forward.oS
libpthread/nptl/forward.c: In function '__pthread_unwind':
libpthread/nptl/forward.c:158:1: warning: 'noreturn' function does return
    .
    .
    .
   CC libpthread/nptl/sysdeps/pthread/pt-longjmp.oS
libpthread/nptl/sysdeps/pthread/pt-longjmp.c: In function 'longjmp':
libpthread/nptl/sysdeps/pthread/pt-longjmp.c:27:3: warning: implicit 
declaration of function '__libc_longjmp'
libpthread/nptl/sysdeps/pthread/pt-longjmp.c:28:1: warning: 'noreturn' 
function does return
    .
    .
    .
   CC libpthread/nptl/pt-cleanup.oS
libpthread/nptl/pt-cleanup.c:27:1: warning: redeclaration of 
'__pthread_cleanup_upto' with different visibility (old visibility 
preserved)
libpthread/nptl/pthreadP.h:357:1: note: previous declaration of 
'__pthread_cleanup_upto' was here
    .
    .
    .
   CC libpthread/nptl/pthread_getspecific.oS
libpthread/nptl/pthread_getspecific.c:27:1: warning: 'visibility' 
attribute ignored on non-class types
    .
    .
    .
   CC libpthread/nptl/unwind.oS
libpthread/nptl/unwind.c: In function 'unwind_stop':
libpthread/nptl/unwind.c:96:5: warning: implicit declaration of function 
'__libc_longjmp'
libpthread/nptl/unwind.c: At top level:
libpthread/nptl/unwind.c:123:1: warning: redeclaration of 
'__pthread_unwind' with different visibility (old visibility preserved)
libpthread/nptl/pthreadP.h:250:1: note: previous declaration of 
'__pthread_unwind' was here
   CC libpthread/nptl/vars.oS
   AR cr libpthread/nptl/libpthread_so.a
   STRIP -x -R .note -R .comment libpthread/nptl/libpthread_so.a
   CC libpthread/nptl/pthread_atfork.oS
   AR cr lib/libpthread_nonshared.a
   STRIP -x -R .note -R .comment lib/libpthread_nonshared.a
   CC libpthread/nptl/sysdeps/pthread/pt-initfini.s
   GEN libpthread/nptl/sysdeps/pthread/defs.h
   GEN libpthread/nptl/sysdeps/pthread/pt-crti.S
   AS libpthread/nptl/sysdeps/pthread/pt-crti.o
   GEN libpthread/nptl/sysdeps/pthread/pt-crtn.S
   AS libpthread/nptl/sysdeps/pthread/pt-crtn.o
   LD libpthread-0.9.33.2.so
libpthread/nptl/libpthread_so.a(unwind-forcedunwind.oS): In function 
`pthread_cancel_init':
unwind-forcedunwind.c:(.text+0x26): undefined reference to `dlopen'
unwind-forcedunwind.c:(.text+0x3d): undefined reference to `dlsym'
libpthread/nptl/libpthread_so.a(unwind-forcedunwind.oS): In function 
`__unwind_freeres':
unwind-forcedunwind.c:(__libc_freeres_fn+0x18): undefined reference to 
`dlclose'
collect2: ld returned 1 exit status
make: *** [lib/libpthread.so] Error 1



The LD command that fails here is:
gcc -nostartfiles -Wl,-EL -shared -Wl,--warn-common -Wl,--warn-once 
-Wl,-z,combreloc -Wl,-z,relro -Wl,-z,defs -Wl,-s 
./lib/ld64-uClibc-0.9.33.2.so ./lib/libdl-0.9.33.2.so 
-Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal 
-Wl,-soname=libpthread.so.0 -nostdlib -o lib/libpthread-0.9.33.2.so 
./libpthread/nptl/sysdeps/pthread/pt-crti.o -Wl,--whole-archive 
libpthread/nptl/libpthread_so.a -Wl,--no-whole-archive ./lib/interp.os 
-L./lib ./lib/libc.so /usr/lib/gcc/x86_64-linux-gnu/4.5.3/libgcc.a 
./libpthread/nptl/sysdeps/pthread/pt-crtn.o


Adding -Wl,--no-as-needed makes this command complete successfully, but 
restarting make deletes the file and tries again. I couldn't find away 
to have this option passed to this command automatically, and I'm not 
sure that is the right fix anyway.


More information about the uClibc mailing list