Compile PostGIS 2.0 (SVN)

Ryan Schmidt ryandesign at macports.org
Mon Aug 29 13:59:00 PDT 2011


On Aug 29, 2011, at 10:12, JP Glutting wrote:

> Thanks Ryan,
> 
> I deleted the source directory for postgis 2.0 SVN, started a new shell and unzipped it, so start over clean. Then I set the environmental variables:
> 
> export CPPFLAGS=-I/opt/local/include
> export LDFLAGS=-L/opt/local/lib
> export CPATH=/opt/local/include
> export LIBRARY_PATH=/opt/local/lib
> export CFLAGS="-arch i386 -arch x86_64" 
> export LDFLAGS="-L/opt/local/lib -arch i386 -arch x86_64" 
> export CC=/opt/local/bin/gcc-4.3 
> export CXX=/opt/local/bin/g++-4.3 
> and ran
> 
> ./configure --with-raster
> 
> But it fails pretty quickly:
> 
> checking build system type... i686-apple-darwin11.1.0
> checking host system type... i686-apple-darwin11.1.0
> checking for gcc... /opt/local/bin/gcc-4.3
> checking for C compiler default output file name... configure: error: C compiler cannot create executables
> See `config.log' for more details.
> 
> (I didn't have gcc43 installed, but it even fails on the binary I have in that directory: gcc-mp-4.4)

Right, that won't work because MacPorts gcc compilers don't understand -arch flags. Only Apple's specially modified versions of gcc distributed with Xcode can do that.

You shouldn't use MacPorts gcc compilers unless Apple's Xcode versions of gcc won't work for the specific software you're building.

You're on Lion, so you should be trying to compile things using clang or llvm-gcc-4.2 anyway instead of gcc.


> However, after taking the the GCC and GXX declarations out, I got an error from GDAL, and it turned out that GDAL hadn't built properly +universal, so I rebuilt it and PostGIS compiled correctly. 
> 
> I'm glad it is finally working. Thanks for all the information, Ryan. I hope this thread is useful to someone else trying to compile the SVN version of PostGIS using Macports dependencies.




More information about the macports-users mailing list