[lfs-dev] More on static libs

Bruce Dubbs bruce.dubbs at gmail.com
Wed Mar 11 19:11:21 PDT 2015

Fernando de Oliveira wrote:
> On 11-03-2015 22:13, Bruce Dubbs wrote:
>> I've been working with static libraries today.
>> I was able to remove most of them and got through a complete LFS build.
>> What was left was:
>> bzip2:/usr/lib/libbz2.a
>> gcc:/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/libgcc.a
>> gcc:/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/libgcc_eh.a
>> gcc:/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/libgcov.a
>> glibc:/usr/lib/libc.a
>> glibc:/usr/lib/libc_nonshared.a
>> glibc:/usr/lib/libcrypt.a
>> glibc:/usr/lib/libdl.a
>> glibc:/usr/lib/libg.a
>> glibc:/usr/lib/libieee.a
>> glibc:/usr/lib/libm.a
>> glibc:/usr/lib/libmcheck.a
>> glibc:/usr/lib/libpthread.a
>> glibc:/usr/lib/libpthread_nonshared.a
>> glibc:/usr/lib/librpcsvc.a
>> However, some additional tests failed.  The *new* failures are:
>> 078-binutils-2.25:FAIL: static preinit array
>> 078-binutils-2.25:FAIL: static init array
>> 078-binutils-2.25:FAIL: static fini array
>> 078-binutils-2.25:FAIL: static init array mixed
>> 078-binutils-2.25:FAIL: Could not link a static executable
>> 078-binutils-2.25:FAIL: Run mpx1 with -static
>> 078-binutils-2.25:FAIL: Run mpx2 with -static
>> 103-libtool-2.4.6: 70: Runpath in libtool library files    FAILED
>> 103-libtool-2.4.6:117: enforced lib prefix                 FAILED
>> 103-libtool-2.4.6:170: Run tests with low max_cmd_len      FAILED
>> 110-automake-1.15:FAIL: t/lex-clean-cxx.sh
>> 110-automake-1.15:FAIL: t/lex-depend-cxx.sh
>> I'm having second thoughts about removing the static libraries.  There
>> are really not that many in LFS and some in glibc appear to really be
>> needed.  I'm not sure if the gcc libraries above are needed or not.
>> OTOH, Ubuntu 14.04.2 has none of the above libraries in a standard install.
>> Is removing static libaries really worthwhile?  I'm leaning to no.  It
>> takes away options from the user that would be hard to replace without
>> rebuilding the entire system.
> Please, I'm having good results. But as I told before, I started
> removing *.a from gmp, not before. Nno problem with binutils and libtool
> tests. I did remove the two failing tests of automake. I have removed
> bzip2:/usr/lib/libbz2.a.
> I've installed gperf today. Again, the way I did, only the two automake
> tests seem to be new failures, so, if they are essential, we can leave
> flex with .a.
> I may finish tomorrow or Friday. Binutils, gcc and glibc, I didn't
> remove. All three or at least one I noticed there were no shared
> matching some static.

I did some more checking on a Ubuntu system.  Doing the tests in Adjusting the 
Toolchain there I found:

attempt to open /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a succeeded
attempt to open /usr/lib/x86_64-linux-gnu/libc_nonshared.a succeeded
attempt to open /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a succeeded

Looking at those directories, I see quite a few static libraries as well as some 
object files like crt1.o, etc.

I really think libgcc.a and libc_nonshared.a are pretty essential for allmost 
all executables.  I'm not sure about others.

   -- Bruce

More information about the lfs-dev mailing list