-
Notifications
You must be signed in to change notification settings - Fork 2
SolarisStaticBuild
Last Modified: 07/21/2004 10:12:21
== Introduction ==
This document describes how to install !MapServer v4.2.1 software, and its supporting packages, as static libraries and binaries. Several open source software packages must be installed along with !MapServer to provide additional functionality. Here's a brief description of what each one does for !MapServer:
freetype -- font engine that supports !TrueType fonts
jpg, png, tiff -- image formats
zlib -- compression library needed by png
gd -- rendering engine for gif and png image formats
proj -- projection engine
pdf -- portable document format for map output
curl -- curl is for transferring files with URL syntax
gdal -- for reading and writing raster file formats
ogr -- for reading and writing vector file formats (included in gdal distribution)
The following instructions assume the user is familiar with installing software from source on UNIX and that Apache and perl are already installed. This procedure was tested on Solaris 2.9 using gcc v3.4.0, gnu make and perl v5.8.3. You'll need the GNU C compiler to get started (as well as GNU make). If you don't already these, you can get pre-compiled versions here in Sun's package format: http://www.sunfreeware.com/
== Installing Software ==
Most of the packages can be installed by doing the usual 'make; make install'. Most of them have a configure script. !MapServer must be installed using the configure script with a bunch of options. Below are detailed instructions on how to compile and install each software package. Depending on your version of tar, you'll need to use it to extract the individual tarballs of the software
$ gunzip -c some_package.tar.gz | tar xvf - or, if you have gnu tar (recommended): $ tar zxvf some_package.tar.gz I will assume that you are using this version of tar (get it from http://www.sunfreeware.com/) This will place the tarred distributions for all of the supporting software into the current directory. Directions for building each software package are given below. It is important to install them in the order given, since packages further down the list may depend on those listed above them.
All instructions assume you are installing as root and that you want to install into the /usr/local/static directory structure (eg, executables will be put in /usr/local/static/bin, libraries will be put in /usr/local/static/lib, etc). If you would rather install to a different location, you will need to edit the Makefile or use the proper options with the configure scripts. Each distribution should have a README or INSTALL file detailing how to do this.
You will first need to create an independent development environment. We used /usr/local/static as the root directory for all library and binary installs. This will show up in the configure option --prefix=/usr/local/static
=== Development Software ===
==== libiconv ====
GNU libiconv is a conversion library. This package is needed in static form for gcc and mapserv
$ tar zxvf libiconv-1.9.1.tar.gz
$ cd libiconv-1.9.1
$ configure --prefix=/usr/local/static --enable-static=yes
$ make; make install
==== gcc ====
Yes you need a separate gcc with only static libraries.
$ tar zxvf gcc-3.4.0.tar.gz
$ cd gcc-3.4.0
$ mkdir objdir
$ cd objdir
$ CONFIG_SHELL=/bin/ksh
$ export CONFIG_SHELL
$ ../configure --prefix=/usr/local/static --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --disable-nls
$ make bootstrap
$ make install
Supporting programs and libraries Prior to compiling the remaining software you'll need to adjust the enviroment variables PATH and LD_LIBRARY_PATH.
In csh or tcsh:
% setenv PATH "/usr/local/static/bin:/bin:/usr/bin:/usr/ccs/bin:/usr/local/bin"
% setenv LD_LIBRARY_PATH "/usr/local/static/lib:/lib:/usr/lib:$ORACLE_HOME/lib"
In ksh or bash:
$ export PATH="/usr/local/static/bin:/bin:/usr/bin:/usr/ccs/bin"
$ export LD_LIBRARY_PATH="/usr/local/static/lib:/lib:/usr/lib:$ORACLE_HOME/lib"
==== freetype ====
$ tar zxvf freetype-2.1.4.tar.gz
$ cd freetype-2.1.4
$ ./configure --prefix=/usr/local/static --disable-shared
$ make
$ make install
==== jpeg ====
If 'make test' doesn't complain, you're okay.
$ tar zxvf jpegsrc.v6b.tar.gz
$ cd jpeg-6b
$ ./configure --prefix=/usr/local/static --enable-static
$ make
$ make test
$ make install
$ make install-lib
==== zlib ====
The test should tell you it went smoothly by printing '*** zlib test OK ***'.
$ tar zxvf zlib-1.1.4.tar.gz
$ cd zlib-1.1.4
$ ./configure --prefix=/usr/local/static
$ make
$ make test
$ make install
==== png ====
For this one you have to copy the appropriate Makefile for your system from the scripts directory. There's a generic one for solaris that works. When you run 'make test', you should see 'PASS (9782 zero samples)' in the output and 'libpng passes test' at the very end if all went smoothly. As you can see we need to use sed to make some changes to three internal variables so the install and make will go where we want.
$ tar zxvf libpng-1.2.5.tar.gz
$ cd libpng-1.2.5
$ cp scripts/makefile.solaris Makefile
$ sed "s:^prefix=.*:prefix=/usr/local/static:" < Makefile > Makefile.1
$ sed "s:^ZLIBLIB=.*:ZLIBLIB=/usr/local/static/lib:" < Makefile.1 > Makefile.2
$ sed "s:^ZLIBINC=.*:ZLIBINC=/usr/local/static/include:" < Makefile.2 > Makefile
$ rm Makefile.?
$ make
$ make test
$ make install-headers
$ make install-static
==== tiff ====
This configure script is interactive, but you can turn that off with the --noninteractive flag. Since the prefix doesn't work for the man page install, I've included a sed command that fixes the problem.
$ tar zxvf tiff-v3.6.0.tar.gz
$ cd tiff-v3.6.0
$ ./configure --noninteractive --prefix=/usr/local/static
$ sed "/cd man/d" < Makefile > Makefile.1
$ make -f Makefile.1
$ make -f Makefile.1 install
$ rm /usr/local/static/lib/libtiff.so
==== gd ====
Everything works fine here. gd needs the libiconv shared library to compile.
$ tar zxvf gd-2.0.21gif.tar.gz
$ cd gd-2.0.21gif
$ ./configure --prefix=/usr/local/static --disable-shared
$ make
$ make install
==== proj ====
The usual with a little file moving. Proj has two parts, the main projection engine (proj-4.4.7.tar.gz) and datum support files (proj-nad27-1.1.tar). The datum files must be untarred into the nad subdirectory of proj, as follows:
$ tar zxvf proj-4.4.7.tar.gz
$ cd proj-4.4.7/nad
$ tar zxvf ../../proj-nad27-1.1.tar.gz
$ cd ..
$ ./configure --prefix=/usr/local/static --disable-shared
$ make
$ make install
==== pdf ====
Nothing special here.
$ tar zxvf pdflib-4.0.3.tar.gz
$ cd pdflib-4.0.3
$ ./configure --prefix=/usr/local/static --without-java --disable-shared
$ make
$ make test
$ make install
==== curl ====
This package in particular is used by mapserver 4.x.x instead of libwww which was used in previous mapserver versions.
$ tar zxvf curl-7.10.8.tar.gz
$ cd curl-7.10.8
$ ./configure --prefix=/usr/local/static --without-ssl --disable-shared
$ make
$ make install
==== gdal ====
Almost done with supporting packages...
$ tar zxvf gdal-1.2.0.tar.gz
$ cd gdal-1.2.0
$ ./configure --prefix=/usr/local/static --with-ecw --without-ld-shared --with-oci=$ORACLE_HOME --with-png=internal --with-jpeg=internal --with-gif=internal --with-libz=internal --with-libtiff=internal
$ make
$ make install
==== ORACLE ====
For Oracle connections, !MapServer needs Oracle client version 8.1.7 or later, earlier versions will not work.
==== Installing !MapServer ====
The install process below assumes you would like to build !MapServer with ORACLE support. Set the proper versions and locations for your installations of ORACLE and gd. Before you build, make sure ORACLE_HOME is correct and that $ORACLE_HOME/lib is in your LD_LIBRARY_PATH. In the examples below, Apache's web documents directory is /opt/html and its cgi-bin is /opt/cgi-bin. Set them to the appropriate directories on your system.
$ tar zxvf mapserver-4.2.1.tar.gz
$ cd mapserver-4.2.1
$ ./configure --without-jpeg --with-gd=../gd-2.0.21gif --with-freetype=/usr/local/static --enable-force-freetype1 --with-zlib --with-png --with-pdf --without-tiff --without-eppl --with-proj --with-ogr --with-gdal=../gdal-1.2.0/apps/gdal-config --with-wmsclient --with-wfsclient --with-oraclespatial=$ORACLE_HOME --with-sde=/opt2/sde/sdeexe83 --with-sde-version=83 \ <-- if using SDE input
--with-wfs --enable-debug --without-httpd
===== Edit the Makefile =====
Find the line that begins with: GDAL_LIB= Change the last part of the line to look like: gdal-1.2.0/.libs/libgdal.a -lNCSEcw -lNCSUtil The -lNCSEcw -lNCSUtil is needed if you are including ECW support $ make mapserv The resulting executable should have 755 permissions. If it doesn't, set it that way and then trying running it: $ chmod 755 mapserv $ ./mapserv You should get this message: This script can only be used to decode form results and should be initiated as a CGI process via a httpd server. Next, copy the executable into your cgi-bin directory and make it owned by the user id under which apache runs (normally apache or nobody). $ cp mapserv /cgi-bin $ chown nobody:nobody /cgi-bin/mapserv Now try accessing !MapServer from a web page by going to this URL on your host: http://myhost/cgi-bin/mapserv This should produce the message:
No query information to decode. QUERY_STRING is set, but empty. Next, install the MapScript perl module. MapScript for PHP is also available, but instructions for installing it are not included here. For this part, you will need to have Perl installed on your machine. $ cd mapscript/perl $ perl Makefile.PL $ make $ make install
Done!
== Common Problems ==
One common problem is getting Apache's environment variables right. In order to run !MapServer, it needs to have the correct LD_LIBRARY_PATH. Set this by adding a line like the following to the beginning of Apache's httpd.conf file.
setenv LD_LIBRARY_PATH /lib:/usr/lib:/usr/local/lib:/oracle/9.2/lib:/opt2/sde/sdeexe83/lib
If you can run !MapServer at the command line without any problems, but get 'Internal Server Error' when accessing it via the web, most likely your environment does not match Apache's. If Apache cannot run !MapServer due to LD_LIBRARY_PATH problems, it will complain about a missing library. The resulting error in Apache's error log will probably look something like this:
ld.so.1: mapserv: fatal: libclntsh.so.8.0: open failed: No such file or directory
In this case, it was looking for an oracle library that it could not find. For such problems, make sure Apache also has ORACLE_HOME set in httpd.conf as well, like so:
setenv ORACLE_HOME /oracle/9.2
A common problem with installing !MapScript/perl is that it will not compile with some older versions of Perl. In testing, the !MapScript Perl module compiled successfully using Perl v5.8.3.