Submitted by Joe Bussell <joe@…>

1) Build a Cygwin environment with: build tools (make, cmake, libtool, gcc, flex, bison, ... ) perl

Make sure that you DO NOT have Cygwin's Postgresql installed, this makes the compile of gdal fail. On multiple machines objdump reported that pq.dll was an unrecognized format (any ideas on why?)

I didn't bother with the Cygwin native gd or freetype either.

2) Download appropriate sources: freetype-2.1.3 gd-2.0.11 gdal-1.1.8 proj-4.4.6 mapserver-3.6.5

3) Build freetype. This is trivial, you will need to run: ./configure make make install

4) Build gd This is trivial, you will need to run: ./configure make make install

5) build gdal This is where things get weird and more work needs to be done. You will need to run: ./configure make make install edit the installed gdal-config. This is necesary as the install part of the makefile makes the choice that the library is not shared. The libraries that gdal-config reports are incorrectly articulated in the LIBS string. Specifically the '-l' is prepended to all libraries independent of their shared-ness. If the path ends with a '.a' it should not be prepended with -l. Additionally, the installer requires the addition of -l/usr/local/lib/lib which is just clearly wrong. Your mileage may vary. One build actually went completely correct with no edit required.

6) Build proj This is trivial, you will need to run: ./configure make make install

7) Build Mapserver Edit the so the following are correct: HEADER_INSTALL=/usr/local/include/mapserver-3.6/ LD= g++

then I used

./configure --with-gd --with-proj=/usr/local --with-freetype --with-gdal=/usr/local/bin/gdal-config

followed by: make make install

8) Now for the PERL Mapscript part. This is also weird and will require upstream patches to really be correct. To reproduce my hand hack first you need to run:

perl Makefile.PL

The Makefile you just creaed is not perfect. Edit it such that the linker is g++ as in step 7.

The link will still fail since gdal was built as a non-shared library. The linker will need the extra libs to make the dllwrap call work. To accomplish this I added the back-ticked command /usr/local/bin/gdal-config --libs to the end of the list of LDLOADLIBS. Why the list isn't properly propagated from LIBS, which is correct in the Makefile, is unknown to me at this point. It really should be fixed in MakeMaker??.

There is still one extra hook. dllwrap makes use of ld2, which is just a thin wrapper around perlld in Cygwin. The perlld in /usr/local/bin/ in my Cygwin envoronment tries to use ld as its linker. This fails to bring in the OGR and GDAL bits. You will need to edit /usr/local/bin/perlld.exe to have driver_name = g++;

now you can run make make install

You will still have to be sure to fully qualify mapscript objects when calling 'new' on them. in the examples does not do this correctly (see previous posts).

My hope is that the folks working on gdal can work out the shared library bits to improve the installed gdal-config. I also would like to see the Makefiles be built using g++ as the linker when it is available. I am unsure what my change to perlld will do to other perl builds (ie CPAN). I have install from CPAN after the change and did not observe any new problems.

back to PerlMapScript

Last modified 13 years ago Last modified on Jan 29, 2009, 9:47:28 AM