As noted from my previous blog post regarding Mapserver on Debian, you don’t get AGG with Mapserver when installing directly from Debian packages. Thus, it would be better to install Mapserver by source. However, debian still helps because it would install all the necessary libraries needed for compiling mapserver.

./configure \
--with-agg \
--with-jpeg \
--with-gd \
--with-freetype \
--with-png \
--with-ogr \
--with-proj \
--with-gdal \
--with-httpd=/usr/sbin/apache2 \
--with-tiff \
--with-wfs \
--with-wcs \
--with-threads \
--with-wmsclient \
--with-wfsclient \
--with-geos \
--with-postgis \
--enable-debug

When I started installing yesterday, I did not know which packages/libraries are installed in my box. I dove off immediately by running my configure.sh above and received an error: Could not find gd.h or libgd.a/libgd.so in /usr/local..

The best way to figure out if you’re ready is reading thru the configure output.

checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for ranlib... ranlib
checking for flex... no
checking for lex... no
checking for yywrap in -lfl... no
checking for yywrap in -ll... no
checking for bison... no
checking for byacc... no
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking for exp in -lm... yes
checking for __gxx_personality_v0 in -lstdc++... yes
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for strcasecmp... yes
checking for strncasecmp... yes
checking for strdup... yes
checking for strlcat... no
checking for vsnprintf... yes
MapServer Version from mapserver.h: '5.0.2'
configure: checking where FreeType 2.x is installed...
checking for freetype-config... /usr/bin/freetype-config
        using libfreetype from -lfreetype -lz
checking for FT_Init_FreeType in -lfreetype... yes
        using libfreetype -lfreetype from system libs.
configure: checking where Zlib is installed...
checking for zlibVersion in -lz... yes
        using libz from system libs (-DUSE_ZLIB).
configure: checking where PNG is installed...
checking for png_init_io in -lpng... yes
        using libpng from system libs.
configure: checking whether we should include JPEG support...
checking for jpeg_read_header in -ljpeg... yes
        using libjpeg from system libs.
configure: checking where libXpm is installed...
checking for XpmFreeXpmImage in -lXpm... yes
        using libXpm from system libs.
configure: checking where libiconv is installed...
checking for iconv_open in -lc... yes
checking for libiconv_open in -liconv... no
        using libiconv from system libs.
        libiconv found. Enabling internationalization (-DUSE_ICONV)
configure: checking for GD 2.0.16 or higher...
checking for gdFontCacheSetup in -lgd... yes
        using libgd 2.0.16 (or higher) from system libs (-L/usr/lib -lgd -ljpeg -lfreetype -lpng -lz -lXpm -lX11 ).
checking for gdImageCreate in -lgd... yes
checking for gdImageGif in -lgd... yes
checking for gdImagePng in -lgd... yes
checking for gdImageJpeg in -lgd... yes
checking for gdImageWBMP in -lgd... yes
checking for gdImageStringFT in -lgd... yes
checking for gdImageOpenPolygon in -lgd... yes
checking for gdImageGifPtr in -lgd... yes
checking for gdFontGetTiny in -lgd... yes
        using GD ( -DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT -DGD_HAS_FTEX_XSHOW -DGD_HAS_GDIMAGEGIFPTR -DGD_HAS_GETBITMAPFONTS) from system libs.
configure: checking whether we should include PDF support...
checking for PDF_setlinewidth in -lpdf... no
checking for PDF_setrgbcolor in -lpdf... no
checking for PDF_moveto in -lpdf... no
checking for PDF_curveto in -lpdf... no
checking for PDF_show_xy in -lpdf... no
checking for PDF_load_font in -lpdf... no
        libpdf not found or too old... PDF support not included.
checking if AGG support requested... looking for agg libs in /usr
using libagg from /usr
using libaggfontfreetype from /usr
configure: checking whether we should include EPPL7 support...
        including EPPL7 support.
configure: checking whether we should include PROJ.4 support...
checking for pj_init in -lproj... yes
checking for pj_transform in -lproj... yes
        using PROJ.4 from system libs.
configure: checking whether we should include thread safe support...
checking for pthread_create in -lpthread... yes
        using -lpthread from system libs.
configure: checking whether we should include ESRI SDE support...
        ESRI SDE support not requested.
checking if GEOS support requested... yes
checking for geos-config... /usr/bin/geos-config
checking for GEOS version >= 2.2.2... yes. Found version 2.2.3
configure: checking whether we should include OGR support...
checking for gdal-config... /usr/bin/gdal-config
        OGR enabled (-DUSE_OGR).
checking if GDAL support requested... yes
checking checking ms JPEG output... no we, have GDAL available.
configure: checking whether we should include TIFF support...
checking for TIFFOpen in -ltiff... yes
        using libtiff from system libs.
checking if PostGIS support requested... yes
checking for pg_config... /usr/bin/pg_config
yes, user supplied pg_config
checking if MyGIS support requested... no
checking if OracleSpatial support requested... no
checking if MING/Flash support requested... no
configure: checking whether we should include WMS Server support...
        OGC WMS compatibility enabled (-DUSE_WMS_SVR).
configure: checking whether we should include WFS Server support...
        OGC WFS Server support enabled (-DUSE_WFS_SVR).
configure: checking whether we should include WCS Server support...
        OGC WCS Server support enabled (-DUSE_WCS_SVR).
configure: checking whether we should include WMS Client Connections support...
configure: checking whether we should include WFS Client Connections support...
configure: checking whether we should include OGC SOS Server support...
configure: checking for curl-config...
checking for curl-config... /usr/bin/curl-config
        found libcurl version 7.18.0
        OGC WMS Client Connections enabled (-DUSE_WMS_LYR).
        OGC WFS Client Connections enabled (-DUSE_WFS_LYR).
configure: checking for xml2-config...
configure: checking whether FastCGI support should be enabled...
        FastCGI support not enabled.
configure: checking HTTPD server (Apache) version...
        using user-supplied httpd (/usr/sbin/apache2)
        /usr/sbin/apache2 version is Apache/2.2.8 (2002008).
        Your system is apparently running Apache/2.2.8.  Setting stderr to non-blocking for msDebug() due to Apache 2.x bug (see MapServer bug 458 or Apache bug 22030).
Compiling with fast MS_NINT
checking compiler warnings... basic
configure: checking whether we should enable debug features...
        Enabling debug features: -g in CFLAGS.
configure: checking for PHP/MapScript module options...
        PHP/MapScript module not configured.
checking for g++ -shared ... yes
checking if --enable-runpath requested... no
checking if --with-java-include-os-name specified... no, autodetected linux
configure: creating ./config.status
config.status: creating Makefile
config.status: creating mapscript/java/Makefile
config.status: creating mapscript/csharp/Makefile
 
MapServer is now configured for
 
 -------------- Compiler Info -------------
  C compiler:                gcc -g -O2 -fPIC -Wall
  C++ compiler:              g++ -g -O2 -fPIC -Wall
  Debug:                     -g  -DNEED_NONBLOCKING_STDERR
  Generic NINT:
  Threading support:         -DUSE_THREAD
 
 -------------- Renderer Settings ---------
  zlib support:              -DUSE_ZLIB
  png support:
  jpeg support:
  iconv support:             -DUSE_ICONV
  AGG support:               -DUSE_AGG
  AGG Freetype support:      -laggfontfreetype
  Ming(flash) support:
  PDFLib support:
 
 -------------- Data Format Drivers -------
  native tiff support:       -DUSE_TIFF
  PostGIS support:           -DUSE_POSTGIS
  Proj.4 support:            -DUSE_PROJ
  EPPL7 support:             -DUSE_EPPL
  ArcSDE support:
  OGR support:               -DUSE_OGR
  GDAL support:              -DUSE_GDAL
  GEOS support:              -DUSE_GEOS
  Oracle Spatial support:
  FastCGI support:
 
 -------------- OGC Services --------------
  WMS Server:                -DUSE_WMS_SVR
  WMS Client:                -DUSE_WMS_LYR
  WFS Server:                -DUSE_WFS_SVR
  WFS Client:                -DUSE_WMS_LYR
  WCS Server:                -DUSE_WCS_SVR
  SOS Server:
 
 -------------- MapScript -----------------
  PHP MapScript:             no

I was able to weed out the problem above by checking on the libraries noted with “yes” above if they are installed or not. To overcome this, I needed to install the ff debian packages on ‘lenny(testing)’:

libagg-dev libgd2-xpm libgd2-xpm-dev libtiff4 libtiff4-dev libpng libpng-dev libxpm4 libxpm4-dev libfreetype6-dev libapache2-mod-python python-imaging

Results:

debsexy:/usr/lib/cgi-bin# ./mapserv -v
MapServer version 5.0.2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=THREADS SUPPORTS=GEOS INPUT=TIFF INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE