Skip to content
Thomas Bonfort edited this page Apr 6, 2012 · 1 revision

(New link for building on Macos 10.3.x is at bottom of this document.) (New link for building on Macos 10.2.3 is at bottom of this document.)

Successfully compiling MapServer requires certain pre-requisites to be in place. Needless to say, you need the latest and greatest version of MacOS X (currently 10.1.2) with developer tools (available as a free download from http://developer.apple.com if you register for a free developer account). The developer tools give you a bunch of goodies including cc, the all important c compiler which replaces gcc on MacOS X.

Another good place to visit is http://www.darwinfo.org which has available additional developer tools that Apple forgot ;-) to include. Btw, 10.1.2 comes with Apache, Perl, and PHP pre-installed.

!MapServer itself depends upon other libraries of software to do the many things it does. Some of these are (version numbers given here are the latest that are known to work with !MapServer) --

* gd 1.8.4 (mandatory) available at http://boutell.com. The easiest instructions for building gd on MacOS X are at http://www.stepwise.com/Articles/Workbench/2001-06-12.01.html                                                                                                                                                                                                                                                                                              
      o libpng 1.2.1 available at http://www.libpng.org                                                                                                                                                                                                                                                                                                                                                                                                                       
            + zlib (fortunately provided by Apple) - libpng depends upon zlib.                                                                                                                                                                                                                                                                                                                                                                                                
      o libjpeg-6b                                                                                                                                                                                                                                                                                                                                                                                                                                                            
* libtiff                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
* PostgresQL (for PostGIS support). The best and easiest PostgresQL installation package for MacOS X has been created by Marc Liyanage at http://www.entropy.ch. Marc's website is also the best source for a MySQL installation package for MacOS X if MySQL support is required in your !MapServer website.                                                                                                                                                                 
* GDAL 1.1.5 (for raster data support). Maintained by Frank Warmerdam at http://www.remotesensing.org/gdal.                                                                                                                                                                                                                                                                                                                                                                   
* Proj 4.4.4                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
* Perl for !MapScript support. Perl 5.6.0 is already built and installed with 10.1. If Perl 5.6.1 is desired then it needs to be built from scratch. Notes coming soon.                                                                                                                                                                                                                                                                                                       
* PHP 4.0.6 for !MapScript support. PHP is already built and installed with 10.1. PHP/Mapscript will not work on OS X at this time because dynamic libraries are not yet supported on PHP on MacOS X. See link http://developer.apple.com/internet/macosx/php.html. Also, keep in mind that PHP/MapScript does not yet work with PHP 4.1.x. Latest information on PHP/MapScript is available at http://www.dmsolutions.ca where Daniel Morrisette maintains it.               
* !FreeType 1.3.1 for Truetype font support                                                                                                                                                                                                                                                                                                                                                                                                                                   

== Compiling on OS 10.2 ==
=== Using Default Mac Compiler (GCC 3.1) ===

Before you start, read the developer docs that come with the Mac OS X Developer package. A couple important tips that I picked up from these docs are that you should be using -fPIC and -no-cpp-precomp in your compile and link flag options and that you may need a dummy 'malloc.h' from time to time. The Mac compiler searches /usr/local/lib and include by default and you can head off many warnings by removing these paths from include and lib dirs in your makefiles.

These are not detailed instructions, just a list of 'gotchas' that I (Sean Gillies, [email protected]) have encountered:

==== GD-2.0.1 ====

Unless you really want WBMP, disable it when you configure. I built libgd as static and shared object (.so), but not as a .dylib. I've found that gd-2.0.1 works well with the libfreetype that comes with XDarwin and is installed under /usr/X11R6/lib.

==== PROJ-4.4.5 ====

The configure script for proj-4 doesn't work properly for OS X. There's no darwin target and this leaves you a bit stranded when it comes to building shared libs. I built a static libproj.a and link against it. The apps ('cs2cs' etc) work fine.

It seems that there is a darwin target by installing proj-4.4.6 on darwin6.4 (OS X v10.2.4).

==== GDAL-1.1.7 ====

Unless you really want the Python mod, disable it when you configure. You'll need to make some changes to your GDALmake.opt file. I added -DPROJ_STATIC to the C- and CXX_OPTFLAGS. You may need to add -dl to the LIBS. Your LD_SHARED should be = g++ -dynamiclib.

==== Libwww-5.4.0 ====

This seemed to build OK, but I wasn't able to link it to mapserver. Haven't had time to work it out, so I'm not using it for now.

==== !MapServer ====

I've been able to build mapserver from the July 22 2002 CVS without too much trouble. You will probably need to use g++ as your linker rather than gcc, so this means replacing CC with CXX further towards the end of the makefile where the mapserver utilities are being linked. If you are getting errors like 'missing symbol __gxx_personality_v0', then you need to replace CC with CXX.

== Cookbook Instructions for MacOS 10.2.3 ==

A new set of instructions for building PHP 4.3.1, !MapServer, !PHP/Mapscript, postgresql and postGIS on macos 10.2.3 has been compiled and posted at http://home.nc.rr.com/wwheaton . (It is not posted in the WIKI due to formatting issues.) Note that !PHP/Mapscript does compile and work with PHP4.3.1 and Macos 10.2.3 so Macos users now can build fully functional web-mapping systems.

== Fink ==

There is a package manager for OS X with many OSS ports for OS X, maybe someone will make a fink package? ;-)

http://fink.sourceforge.net

== Building and Installing MapServer for Mac OS 10.3.x ==

Includes instructions for !MapServer CGI & PHP-MapScript, and for building all necessary support libraries (graphics libs, geotiff, gdal, PHP, proj, pdflib, libgrass) and a basic outline to building PostGIS (that one's not a high priority for me, but I may do something detailed in the future for completeness). Kept up-to-date to current versions of all related parts.

http://webpages.charter.net/kyngchaos/macosx/index.html

Clone this wiki locally