Compile PostGIS 2.0 (SVN)
ryandesign at macports.org
Sat Aug 27 14:15:24 PDT 2011
On Aug 27, 2011, at 13:50, JP Glutting wrote:
> That is very helpful. Installing everything +universal was my idea, and probably not a good one.
It's ok to build universal if you want to, but you should probably then build everything universal, and not just some things.
> My thinking was that perhaps postgis (or part of it) was trying to compile as i386 and couldn't find the appropriate framework, as it was only built x86_64 (which is all I was using). So I built all the dependencies +universal, just in case.
That is what is happening, and it's because of a bug in our postgresql ports, for which I have filed a bug report for you:
Basically the problem is that you are building postgis non-universal, but postgresql is installed universal. Either install postgresql non-universal, or build postgis universal.
> the command: sudo port install geos +universal configure.compiler=macports-gcc-4.2 fails.
This is expected, since MacPorts gcc compilers don't understand -arch flags which are how software gets built universal. You can't install any port universal that uses a MacPorts gcc compiler. There's no need to use a MacPorts gcc compiler here either; use the Apple/Xcode gcc-4.2 compiler.
> sudo port install geos +universal configure.compiler=gcc-4.2 works, thanks! I had that in my notes, but I overlooked it. Thinking about too many different things at once.
There should not have been a need to specify anything extra on the command line, after I fixed the aforementioned ticket. Just "sudo port selfupdate" to receive the fix, and "sudo port install geos +universal" should have worked.
> Then I did
> export CC=gcc-4.2 (in case it was another compiler issue)
> ./configure --with-projdir=/opt/local --with-raster --prefix=/opt/local
> But I got the same error. I will just wait for a new version with a fix, I guess. I appreciate the tips, as this isn't a macports issue, and you folks have better things to do with your time.
Ah, I'm understanding now for the first time that you're building postgis by hand, not by using the postgis portfile. If you're going to do that, you should specify the extra environment variables that a MacPorts build would include, for example:
export CC=/opt/local/bin/gcc-4.2 <-- (or whichever C and C++ compilers
export CXX=/opt/local/bin/g++-4.2 <-- you want to use)
export CFLAGS="-arch i386 -arch x86_64" <-- (or whichever architectures
export LDFLAGS="-L/opt/local/lib -arch i386 -arch x86_64" <-- you want to use)
./configure ... --prefix=/opt/postgis <-- (do not use --prefix=/opt/local for software built by hand; only MacPorts should install things into /opt/local)
sudo make install
More information about the macports-users