Universal Postgres

It turns out that nobody seems to know how to build a Universal version of PostgreSQL for OSX. This turned into a problem for me when I was trying to build a version of PHP with support for postgres — I needed Universal (four-architecture) libraries.

The following seems to work (I’m running an Intel Leopard):

1) I have the following variables set in my .bashrc — I build everything Universal. If you don’t have these variables set, you should set them now.

export CCFLAGS='-arch ppc -arch ppc64 -arch i386 -arch x86_64 -pipe'
export CFLAGS='-arch ppc -arch ppc64 -arch i386 -arch x86_64 -pipe -no-cpp-precomp'
export CXXFLAGS='-arch ppc -arch ppc64 -arch i386 -arch x86_64 -pipe'
export LDFLAGS='-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load'

2) ./configure --with-the-options-of-your-choice

3) LD=gcc AR=libtool AROPT='-static -o' LDREL='$(LDFLAGS) -nostartfiles -r' make -e

4) sudo make install

Step 3 was the tricky bit 😉

Advertisements