Combine static libraries

Erik Aigner picture Erik Aigner · Nov 17, 2011 · Viewed 18.4k times · Source

I tried the approach in this question, but it seems the linux version of ar is not the same as the mac version since I failed to combine the object files again.

What I basically want to do is is merge another static library into my Xcode static library build product via a run-script build phase.

Unfortunately I can't compile the other library directly into my project because it has it's own build system (therefore I use the compiled libs).

I think it should be possible to merge the other library via ar into the Xcode generated library without decompiling the build product. How do I accomplish this?

Answer

Bruce picture Bruce · Nov 17, 2011

you can use libtool to do it

libtool -static -o new.a old1.a old2.a