Compile PostGIS 2.0 (SVN)

Ryan Schmidt ryandesign at
Mon Apr 25 09:29:58 PDT 2011

On Apr 25, 2011, at 11:14, JP Glutting wrote:

> I am having some trouble trying to compile the latest PostGIS code ( I need the raster support in the new version. I can't seem to get the code to compile on OS X, using Macports for the dependencies. So far, configure is complaining about not finding the PROJ.4 install directory. I have installed postgresql90, postgresql90-server and proj with the -k switch to keep the source code (I actually reinstalled proj with "sudo port -kf upgrade proj", which I think reinstalls and leaves the source code - please correct me if I am wrong).

Yes it does, but it would also rebuild all of proj's dependencies, if it had any. It doesn't, so you didn't experience this, but for future reference, if you're going to use the -f flag to force a port to rebuild, you almost certainly also want to use the -n flag to tell MacPorts to only rebuild this port, not also all of its dependencies.

> Using user-specified proj directory: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_gis_proj/work/proj-4.7.0/
> checking proj_api.h usability... yes
> checking proj_api.h presence... yes
> checking for proj_api.h... yes
> checking for pj_get_release in -lproj... no
> configure: error: could not find libproj - you may need to specify the directory of a PROJ.4 installation using --with-projdir
> when running 
> sudo ./configure --with-projdir=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_gis_proj/work/proj-4.7.0/
> I also tried
> sudo ./configure --with-projdir=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_gis_proj/work/proj-4.7.0/src
> and 
> sudo ./configure --with-projdir=/opt/local/include
> But it keeps getting stuck on pj_get_release, which seems to be the way of determining the release version of PROJ.4 - it is in the proj_api.h file, but it seems like configure can't find it or use it properly.
> I'm not sure what (if anything) I can do to get around this. Any ideas?

If you look in the existing postgis (1.5.2) portfile you'll see it uses the configure argument:


I wouldn't expect you to need to keep the source of any of the dependencies, but merely to have the compiled result installed into prefix /opt/local.

More information about the macports-users mailing list