PostgreSQL Universal Binary Build Tips
Software — 4 Feb 2006 04:48 — 2293 days ago

Someone asked me how I created the universal binary PostgreSQL build.

I have a small script that does it for me, it's in my Subversion repository.

The trick is to use CFLAGS to pass multiple -arch flags to the compiler as described in Apple's tech note about configure-based command line builds. For packages which use the compiler driver cc to link, this is all that is required.

The PostgreSQL build seems to do some linking directly with ld, and ld does not understand multiple -arch flags, which is why my script runs a small Perl one-liner to rewrite all those ld lines in all Makefiles in the PostgreSQL source tree. The changed build rules run ld twice, once for each architecture, and splice the results together using lipo. This is exactly what cc does when passed multiple -arch flags.


Powered By blojsom