Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine static libraries on Apple

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?

like image 538
Era Avatar asked Nov 17 '11 16:11

Era


People also ask

Is XCFramework static or dynamic?

An XCFramework can be either static or dynamic and can include headers.

What is the difference between static library and shared library?

Static libraries take longer to execute, because loading into the memory happens every time while executing. While Shared libraries are faster because shared library code is already in the memory. In Static library no compatibility issue has been observed.


1 Answers

you can use libtool to do it

libtool -static -o new.a old1.a old2.a 
like image 95
Bruce Avatar answered Oct 11 '22 12:10

Bruce