[lfs-dev] More on static libs

Bruce Dubbs bruce.dubbs at gmail.com
Thu Mar 12 15:32:21 PDT 2015

Ken Moffat wrote:
> On Thu, Mar 12, 2015 at 04:19:36PM -0500, Bruce Dubbs wrote:
>> I've thought a little more about this.  What do you think about adding this to
>> 6.73. Cleaning Up:
>> mkdir -p /usr/lib/static
>> mv -v /usr/lib/*.a /usr/lib/static
>> mv -v /usr/lib/static/lib{a,b,c,etc}.a /usr/lib
>> In other words, put all the static libs in a location not normally searched
>> and then move back only those really needed.
> First, it does not prevent builders on i686 from accidentally
> linking in a static lib if they make a mistake - by 6.73 everything
> in LFS chapter 6 has been built.

There are lots of ways to make mistakes, but I can't really see how someone can 
link a static library into one of the LFS packages without really going far from 
the book and changing a Makefile or similar.  I suppose removing a .so file may 
revert back to the complementary .a file.

> Second, I assume by "only those really needed" you mean primarily
> static glibc libs, i.e. those everyone assumes are used by configure
> scripts.  If I was doing that I would be tempted to move _nothing_
> back.

Yes, I was referring to glibc libraries, but I think you must have at least 
libc_nonshared.a somewhere in the search chain.  See the output from

$ echo 'main(){}' > dummy.c
$ cc dummy.c -v -Wl,--verbose &> dummy.log

What's *really* needed is unclear to me right now.

   -- Bruce

More information about the lfs-dev mailing list