Changes between Initial Version and Version 1 of SolarisStaticBuild


Ignore:
Timestamp:
Jan 26, 2009, 12:43:55 PM (15 years ago)
Author:
jmckenna
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SolarisStaticBuild

    v1 v1  
     1= Creating MapServer on Solaris (as a mostly static binary) =
     2
     3Last Modified: 07/21/2004 10:12:21
     4
     5== Introduction ==
     6
     7This 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:
     8
     9freetype -- font engine that supports !TrueType fonts
     10jpg, png, tiff -- image formats
     11zlib -- compression library needed by png
     12gd -- rendering engine for gif and png image formats
     13proj -- projection engine
     14pdf -- portable document format for map output
     15curl -- curl is for transferring files with URL syntax
     16gdal -- for reading and writing raster file formats
     17ogr -- for reading and writing vector file formats (included in gdal distribution)
     18
     19The 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/
     20
     21Installing 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
     22
     23$ 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.
     24
     25All 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.
     26
     27You 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
     28
     29Development Software 1. libiconv GNU libiconv is a conversion library. This package is needed in static form for gcc and mapserv
     30
     31 $ tar zxvf libiconv-1.9.1.tar.gz
     32 $ cd libiconv-1.9.1
     33 $ configure --prefix=/usr/local/static  --enable-static=yes
     34 $ make; make install
     35
     362. gcc Yes you need a separate gcc with only static libraries.
     37
     38 $ tar zxvf gcc-3.4.0.tar.gz
     39 $ cd gcc-3.4.0
     40 $ mkdir objdir
     41 $ cd objdir
     42 $ CONFIG_SHELL=/bin/ksh
     43 $ export CONFIG_SHELL
     44 $ ../configure --prefix=/usr/local/static              --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld             --disable-nls
     45 $ make bootstrap
     46 $ make install
     47
     48Supporting programs and libraries Prior to compiling the remaining software you'll need to adjust the enviroment variables PATH and LD_LIBRARY_PATH.
     49
     50In csh or tcsh:
     51
     52 % setenv PATH "/usr/local/static/bin:/bin:/usr/bin:/usr/ccs/bin:/usr/local/bin"
     53 % setenv LD_LIBRARY_PATH "/usr/local/static/lib:/lib:/usr/lib:$ORACLE_HOME/lib"
     54
     55In ksh or bash:
     56
     57 $ export PATH="/usr/local/static/bin:/bin:/usr/bin:/usr/ccs/bin"
     58 $ export LD_LIBRARY_PATH="/usr/local/static/lib:/lib:/usr/lib:$ORACLE_HOME/lib"
     59
     60freetype
     61
     62 $ tar zxvf freetype-2.1.4.tar.gz
     63 $ cd freetype-2.1.4
     64 $ ./configure --prefix=/usr/local/static --disable-shared
     65 $ make
     66 $ make install
     67
     68jpeg If 'make test' doesn't complain, you're okay.
     69
     70 $ tar zxvf jpegsrc.v6b.tar.gz
     71 $ cd jpeg-6b
     72 $ ./configure --prefix=/usr/local/static --enable-static
     73 $ make
     74 $ make test
     75 $ make install
     76 $ make install-lib
     77
     78zlib The test should tell you it went smoothly by printing '*** zlib test OK ***'.
     79
     80 $ tar zxvf zlib-1.1.4.tar.gz
     81 $ cd zlib-1.1.4
     82 $ ./configure --prefix=/usr/local/static
     83 $ make
     84 $ make test
     85 $ make install
     86
     87png 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.
     88
     89 $ tar zxvf libpng-1.2.5.tar.gz
     90 $ cd libpng-1.2.5
     91 $ cp scripts/makefile.solaris Makefile
     92 $ sed "s:^prefix=.*:prefix=/usr/local/static:" < Makefile > Makefile.1
     93 $ sed "s:^ZLIBLIB=.*:ZLIBLIB=/usr/local/static/lib:" < Makefile.1 > Makefile.2
     94 $ sed "s:^ZLIBINC=.*:ZLIBINC=/usr/local/static/include:" < Makefile.2 > Makefile
     95 $ rm Makefile.?
     96 $ make
     97 $ make test
     98 $ make install-headers
     99 $ make install-static
     100
     101tiff 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.
     102
     103 $ tar zxvf tiff-v3.6.0.tar.gz
     104 $ cd tiff-v3.6.0
     105 $ ./configure --noninteractive --prefix=/usr/local/static
     106 $ sed "/cd man/d" < Makefile > Makefile.1
     107 $ make -f Makefile.1
     108 $ make -f Makefile.1 install
     109 $ rm /usr/local/static/lib/libtiff.so
     110
     111gd Everything works fine here. gd needs the libiconv shared library to compile.
     112
     113 $ tar zxvf gd-2.0.21gif.tar.gz
     114 $ cd gd-2.0.21gif
     115 $ ./configure --prefix=/usr/local/static --disable-shared
     116 $ make
     117 $ make install
     118
     119proj 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:
     120
     121 $ tar zxvf proj-4.4.7.tar.gz
     122 $ cd proj-4.4.7/nad
     123 $ tar zxvf ../../proj-nad27-1.1.tar.gz
     124 $ cd ..
     125 $ ./configure --prefix=/usr/local/static --disable-shared
     126 $ make
     127 $ make install
     128
     129pdf Nothing special here.
     130
     131 $ tar zxvf pdflib-4.0.3.tar.gz
     132 $ cd pdflib-4.0.3
     133 $ ./configure --prefix=/usr/local/static --without-java --disable-shared
     134 $ make
     135 $ make test
     136 $ make install
     137
     138curl This package in particular is used by mapserver 4.x.x instead of libwww which was used in previous mapserver versions.
     139
     140 $ tar zxvf curl-7.10.8.tar.gz
     141 $ cd curl-7.10.8
     142 $ ./configure --prefix=/usr/local/static --without-ssl --disable-shared
     143 $ make
     144 $ make install
     145
     146gdal Almost done with supporting packages...
     147
     148 $ tar zxvf gdal-1.2.0.tar.gz
     149 $ cd gdal-1.2.0
     150 $ ./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
     151 $ make
     152 $ make install
     153
     154ORACLE For Oracle connections, MapServer needs Oracle client version 8.1.7 or later, earlier versions will not work.
     155
     156Installing 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.
     157
     158 $ tar zxvf mapserver-4.2.1.tar.gz
     159 $ cd mapserver-4.2.1
     160 $ ./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
     161                --with-wfs --enable-debug --without-httpd
     162
     163Edit 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 <webserver-root>/cgi-bin $ chown nobody:nobody <webserver-root>/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:
     164
     165No 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
     166
     167Done!
     168
     169Common 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.