I'm getting the same problem expressed here

Failing to build PostGIS on OS X 10.7 Lion

But in Mac OS X Snow Leopard. Things I have checked include:

  • PostgreSQL compiled to several architectures. I used the binary from http://www.postgresql.org/download/macosx/, and tested the dynlib objects with the tool file
  • PROJ and GEOS compiled for i386 and x86_64. I used the frameworks from http://www.kyngchaos.com
  • GDAL compiled from sources following KyngChaos instructions. I compiled it instead of using the provided framework because I'm a GDAL developer, and I'm going to work with it.
  • Trying to compile PostGIS, because I'm a PostGIS developer too, and I don't want to use the binaries. It has been configured correctly. I used this: https://gist.github.com/2002495

But I'm still getting the error: ld: symbol(s) not found for architecture i386

Other things I've tried:

  • Compile ONLY for arch i386. Not working. PostgreSQL expects PostGIS compiled for both architectures. I get the error ld: symbol(s) not found for architecture x86_64.
  • Compile ONLY for arch x86_64. Not working, for the same reason. I get the error ld: symbol(s) not found for architecture i386

I could provide configure and makefile logs, if needed, but the problem is this. It's a problem known in PostGIS lists, but I still haven't found a solution...

Thanks in advance, and best regards

  • Maybe you should add a link to the problem as expressed on the PostGIS mailing lists ... – Stev_k Mar 9 '12 at 11:44
  • I solved the problem, but here the link to my message in the postgis-devel list: postgis.refractions.net/pipermail/postgis-devel/2012-March/… – Jorge Arévalo Mar 9 '12 at 15:58
  • Do you really need PostGIS as a fat binary? If it is just for use on one Mac (i.e. you are not distributing binaries to other machines), save yourself a dumptruckload of pain and just build everything as x86_64. A package manager such a Homebrew or MacPorts can also help get things installed. – Sharpie Mar 9 '12 at 17:55
  • Yes, it's only for me. I could compile only for x86_64. I'm probably too lazy, because I followed instructions that compile for both archs. Thanks for the suggestion! – Jorge Arévalo Mar 11 '12 at 22:36

Build for both and only exclude powerpc binaries.

 ARCHFLAGS="-arch i386 -arch x86_64" ./configure
 ARCHFLAGS="-arch i386 -arch x86_64" ./make

But honestly, if you are already in the Kyngchaos realm with GEOS and proj.4, then just grab his PostgreSQL/PostGIS binaries, too.

| improve this answer | |
  • Thanks for the tip. Now I'm getting a different error: ar: libpgcommon.a is a fat file (use libtool(1) or lipo(1) and ar(1) on it) ar: libpgcommon.a: Inappropriate file type or format. I'd use the binaries, but the point is I'm a GDAL/PostGIS developer, and I need to compile both libraries by myself. – Jorge Arévalo Mar 9 '12 at 8:01
  • I finally solved the problem compiling PostgreSQL using -arch i386 -arch x86_64. – Jorge Arévalo Mar 9 '12 at 15:57
  • Sorry, I'm probably misunderstanding your answer, but your suggestion was to compile PostGIS with those flags. My solution was to compile PostgreSQL, a prerequisite, using those flags too, instead of using a precompiled version of PostgreSQL. Anyway, I'll mark your answer as valid. – Jorge Arévalo Mar 11 '12 at 22:33
  • Any binary that you will link against must match the architecture. So in your case client-postgresql/proj/geos/gdal/postgis/etc must match. When in doubt, use the file <library_name> command. – Ragi Yaser Burhum Mar 12 '12 at 5:18
  • Yes, I discovered the "file" command, and it's really useful. Thanks for the tip! – Jorge Arévalo Mar 13 '12 at 10:26

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.