Static binary (no shared libs) fails in Busybox 1.3.0 ?

Rich Felker dalias at aerifal.cx
Mon Dec 18 06:28:46 UTC 2006


On Mon, Dec 18, 2006 at 09:56:40AM +0800, Steven at busybox.net wrote:
> I know this issue sources.redhat.com/bugzilla/show_bug.cgi?id=3400, but if with correct options in gcc, this won't be a problem.
> However, in Fedora Core 6:
> gcc -v
> Using built-in specs.
> Target: i386-redhat-linux
> Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
> Thread model: posix
> gcc version 4.1.1 20061011 (Red Hat 4.1.1-30)
> 
> ~/tmp/busybox/busybox-1.3.0>make menuconfig
> Choose "Build BusyBox as a static binary (no shared libs)", keep othe settings as default value, then
> 
> ~/tmp/busybox/busybox-1.3.0>make
> SPLIT   include/autoconf.h -> include/config/*
> GEN     include/bbconfigopts.h
> CC      applets/applets.o
> applets/applets.c:22:2: error: #warning Static linking against glibc produces buggy executables
> applets/applets.c:23:2: error: #warning (glibc does not cope well with ld --gc-sections).
> applets/applets.c:24:2: error: #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
> applets/applets.c:25:2: error: #warning Note that glibc is utterly unsuitable for static linking anyway.
> make[1]: *** [applets/applets.o] Error 1
> make: *** [applets] Error 2
> 
> I also tried in gcc 3.2.2 in RedHat Linux 9, it has same problem.
> Does anyone has same problem ?

Did you actually READ the above message? glibc has critical bugs that
make it so programs static-linked against glibc with gc-sections
option DO NOT WORK. Thus BB has provided an error message for you
rather than generating a binary that will seriously misbehave under
many circumstances.

glibc authors have intentionally not supported static linking for a
long time. If you want static linking, use a different libc that
properly supports it.

Rich




More information about the busybox mailing list