+universal and static libraries

René J. V. Bertin rjvbertin at gmail.com
Thu Feb 14 11:23:15 UTC 2019


> You can have static archives containing fat object files but some tools
> can't handle such archives.

That's what I thought too, and what is confirmed by the successful universal 
build.

Here, the tool failing is the linker, installed through port:ld-latest ... It's 
possible of course that this is due to a missed step earlier in the build when 
the libraries were created. If so, that step could have been fixed somehow during 
the repeated (incremental) build attempts preceding that one-time successful 
build.

> You also absolutely must have a table of
> contents in the archives for this to work (i.e. use the 's' option with
> ar or run ranlib afterwards.)

Of course. In another life I actually used the system libtool with the `-static` 
argument to create them.
Nowadays I set AR and family in configure.env to point to the llvm-ar (c.s.) from 
a port:llvm-X.Y - that's a requisite also to work with LTO and static archives.
(And no, in this case I'm not using LTO.)


Muniversal mode works of course, but it doubles any build system overhead. And 
as I mentioned elsewhere, that overhead can be significant in autoconf-based 
projects, due to Apple's security stuff; with a mesa build I basically lose one 
of my CPU cores to the gatekeeper daemon.

R.



More information about the macports-dev mailing list