[klibc] can I create lib.a from dir/lib.a?

H. Peter Anvin hpa at zytor.com
Sun Jul 9 11:31:11 PDT 2006

Sam Ravnborg wrote:
> In an attempt to solve some of the dependency issues when building klibc
> library I started to do a modular build of klibc library.
> The priciple is simple. build all sub-directories specified with
> lib-y := dir/ before the final lib.a
> But reading "man ar" it was not obvious if:
> ar cp lib.a dir/lib.a dir2/lib.a file1.o file2.o
> would produce the desired result.
> The linux kernel uses lr -r instead, but thats not libraries.
> I could try it out but thought asking the list could reveal some
> pratical experiences.

It doesn't.  ar is an archiver, kind of like zip (but without 
compression), and still has braindamage from trying to behave as if 
anyone still used it that way.

One of those braindamages is that the above command line will add 
dir/lib.a and dir2/lib.a as members, instead of their contents; it 
doesn't "flatten".  And no, the linker and binutils don't understand 
this kind of nested libraries.


More information about the klibc mailing list