I'm building V8, and by default it builds as a "thin" archive, where the .a
files essentially just contain pointers to the object files on your filesystem instead of containing the object files themselves. See man ar for details.
I want to be able to put this library in a central place so that other people can link to it, and it would be obviously much easier to provide a normal archive file instead of providing a gaggle of object files as well.
How do I take the thin archives produced by the build and turn them into normal ones? I assume it would be as simple as enumerating the object files in the thin archive and rebuilding an archive using those, but I don't know what command can be used to list the archive's object files.
After some additional research,
ar -t
can be used to enumerate the object files in an archive, so after that it's just a matter of providing that list toar
as you usually would when creating an archive.The following script handled this for all of the libraries at once: