I'm trying to install PostGIS 2.2.1 on Mac OS X 10.8. I've installed all of the prerequisites for PostGIS and am now running the configure command:

./configure CC=/usr/bin/clang CXX=/usr/bin/clang++ "CFLAGS=-arch x86_64 -arch i386" "LDFLAGS=-arch x86_64 -arch i386" "CXXFLAGS=-arch x86_64 -arch i386" 

I'm getting the following error:

configure: error: could not find libpq

I have PostgreSQL 9.1.4 installed and I believe I see the libpq libraries which is owned by root:wheel:


I did the following but it didn't help:

export LD_LIBRARY_PATH=/usr/local/pgsql/lib

This too in case PostGIS just needs to know where Postgres is installed:

export LD_LIBRARY_PATH=/usr/local/pgsql

Finally, I ran this command with and without sudo:

./configure CC=/usr/bin/clang CXX=/usr/bin/clang++ "CFLAGS=-arch x86_64 -arch i386" "LDFLAGS=-arch x86_64 -arch i386" "CXXFLAGS=-arch x86_64 -arch i386" "LD_LIBRARY_PATH=/usr/local/pgsql/lib"

What am I doing wrong? I found another post here where someone else had the same problem but the solutions noted there didn't work for me.


UPDATE: I'm looking in the PostGIS config.log file and can at least see why the error is occurring. I just don't quite understand what to do to prevent it.

ld: warning: ignoring file /usr/local/pgsql/lib/libpq.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /usr/local/pgsql/lib/libpq.dylib
Undefined symbols for architecture i386:
  "_PQserverVersion", referenced from:
      _main in conftest-sxaGdF.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I finally solved the problem by deleting the postgis directory and re-running the commands without any of the command line arguments (CFLAGS, etc.) shown in my initial question. I did the following:

sudo make install
make clean

I found the "make clean" command while researching the problem. This command causes the library to run a bunch of tests that validates the installation. Today I'll be testing my installation but right now, everything appears to be OK.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.