Extract object (*.o) files from an iPhone static library

15,462

Code: ar -t mylib.a This will list all of the files in the archive.

Code: ar -xv mylib.a myobj.o This will extract the object give myobj.o from the library mylib.a.

Share:
15,462
Brett
Author by

Brett

Me, being me.

Updated on June 22, 2022

Comments

  • Brett
    Brett almost 2 years

    I have a set of iPhone static libraries (a *.a file) in which I only call a few of the classes from. I have used AR in the past (with linux libraries) to extract the object files from the static library, remove the unwanted object files and rearchive.

    However, when I try this with an iPhone compliled static library, I get the following error:

    ar: CustomiPhoneLib.a is a fat file (use libtool(1) or lipo(1) and ar(1) on it)
    ar: CustomiPhoneLib.a: Inappropriate file type or format
    

    Does anyone know how to extract the object files from an iphone compiled static library? Doing thie could potentially reduce the final file size.