[mapserver-users] Java MapScript Win32 DLL

Andrew Collins andrewrcollins at yahoo.com
Sun Oct 6 08:13:37 EDT 2002


Steps taken:

1. Compiled MapServer with gcc using MinGW and MSYS.

2. Generated MapScript C and Java code with swig.

3. Produced dll with dlltool and gcc using MinGW and MSYS.

I have had absolutely no luck using the dll. This is the
first time that I've used MinGW, MSYS, dlltool, gcc and
swig to produce a dll. I'm certain that I have missed
some fundamental steps somewhere. Here is a listing of
the files I've used, the commands I've executed and the
changes to the 3.6.1 distribution that I've made to
produce the "mapscript_java.dll" file:

A batch file to download all the necessary files, makes
use of "curl", but "wget" would probably work, too...
==

@echo off

echo mapserver-3.6.1.tar.gz
curl "http://mapserver.gis.umn.edu/dist/mapserver-3.6.1.tar.gz" --output
"mapserver-3.6.1.tar.gz"

echo swigwin-1.3.15.zip
curl "http://telia.dl.sourceforge.net/sourceforge/swig/swigwin-1.3.15.zip"
--output "swigwin-1.3.15.zip"

echo MinGW-2.0.0-3.exe
curl "http://telia.dl.sourceforge.net/sourceforge/mingw/MinGW-2.0.0-3.exe"
--output "MinGW-2.0.0-3.exe"

echo MSYS-1.0.8-2002.09.07-1.exe
curl
"http://telia.dl.sourceforge.net/sourceforge/mingw/MSYS-1.0.8-2002.09.07-1.exe"
--output "MSYS-1.0.8-2002.09.07-1.exe"

echo gdlib-1.8.4-lib.zip
curl "http://telia.dl.sourceforge.net/sourceforge/gnuwin32/gdlib-1.8.4-lib.zip"
--output "gdlib-1.8.4-lib.zip"

echo freetype-2.1.2-1-lib.zip
curl
"http://telia.dl.sourceforge.net/sourceforge/gnuwin32/freetype-2.1.2-1-lib.zip"
--output "freetype-2.1.2-1-lib.zip"

echo libjpeg-6b-lib.zip
curl "http://telia.dl.sourceforge.net/sourceforge/gnuwin32/libjpeg-6b-lib.zip"
--output "libjpeg-6b-lib.zip"

echo libpng-1.2.4-1-lib.zip
curl
"http://telia.dl.sourceforge.net/sourceforge/gnuwin32/libpng-1.2.4-1-lib.zip"
--output "libpng-1.2.4-1-lib.zip"

echo xpm-3.4k-1-lib.zip
curl "http://telia.dl.sourceforge.net/sourceforge/gnuwin32/xpm-3.4k-1-lib.zip"
--output "xpm-3.4k-1-lib.zip"

echo zlib-1.1.4-lib.zip
curl "http://telia.dl.sourceforge.net/sourceforge/gnuwin32/zlib-1.1.4-lib.zip"
--output "zlib-1.1.4-lib.zip"

echo regex-0.12-lib.zip
curl "http://telia.dl.sourceforge.net/sourceforge/gnuwin32/regex-0.12-lib.zip"
--output "regex-0.12-lib.zip"

pause

==

1. Install MinGW
   E:\win32app\MinGW

2. Install MSYS
   E:\win32app\MinGW\1.0

3. Unzip Swig
   E:\win32app\SWIG-1.3.15

4. Unzip MapServer
   E:\win32app\MinGW\1.0\bin\%USERPROFILE%\mapserver-3.6.1

5. Unzip required libraries
   gdlib-1.8.4-lib.zip
   freetype-2.1.2-1-lib.zip
   libjpeg-6b-lib.zip
   libpng-1.2.4-1-lib.zip
   xpm-3.4k-1-lib.zip
   zlib-1.1.4-lib.zip
   regex-0.12-lib.zip

   E:\win32app\MinGW\1.0\bin\%USERPROFILE%\mapserver-3.6.1\include
   E:\win32app\MinGW\1.0\bin\%USERPROFILE%\mapserver-3.6.1\lib
   E:\win32app\MinGW\1.0\bin\%USERPROFILE%\mapserver-3.6.1\manifest

6. Run MSYS

==

$ cd
$ cd mapserver-3.6.1
$ mv lib/libgd.dll.a lib/libgd_dll.a
$ mv mapogr.cpp mapogr.c
$ vi configure

  Change two lines:

GD_CHECKLIB=c

  to:

GD_CHECKLIB=gd

$ ./configure --with-jpeg=. --with-gd=. --with-freetype=. --with-zlib=.
--with-png=. --without-pdf --without-tiff --without-eppl --without-wms
--without-php

$ vi Makefile

  Change line:

mapogr.o: mapogr.cpp
    $(CXX) -c $(CFLAGS) mapogr.cpp -o mapogr.o

  to:

#mapogr.o: mapogr.cpp
#    $(CC) -c $(CFLAGS) $< -o $@

$ make lib
$ cd mapscript
$ cd java
$ cp ../mapscript.i .

Use the following "Makefile"
==

#
# SWIG Stuff
#
SWIG=/e/win32app/SWIG-1.3.15/swig

#
# Java Stuff
#
JAVAC=/e/win32app/j2sdk1.4.1/bin/javac
JAR=/e/win32app/j2sdk1.4.1/bin/jar
JAVA_INCLUDE=-I/e/win32app/j2sdk1.4.1/include
-I/e/win32app/j2sdk1.4.1/include/win32

CC=gcc

#
# Set these to the values appropriate for your MapServer build- cut & paste
from ../../perlvars
#
CCFLAGS=-DIGNORE_MISSING_DATA -DUSE_EPPL -DUSE_TIFF -DUSE_JPEG -DUSE_GD_TTF
-DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DGD_HAS_GDIMAGEGIFPTR
LDFLAGS=-Wl,--dll -nostartfiles -L../.. -lmap -L../../lib -lgd -lgd_dll -lpng
-lpng12_dll -lz -lz_dll -ljpeg -ljpeg_dll -lfreetype -lfreetype_dll -lttf
-ltty_dll -lregex -lregex_dll

#
# --- You shouldn't have to edit anything else. ---
#
all: interface mapscript_dll mapscript_java mapscript_jar

interface: mapscript.i
	$(SWIG) -I../.. -java -shadow -package edu.umn.gis.mapscript mapscript.i

mapscript_dll: mapscript_wrap.c
	$(CC) -c $(CCFLAGS) $(JAVA_INCLUDE) -I../../ -I../../include/ mapscript_wrap.c
	dlltool --dllname mapscript_java.dll --output-exp mapscript_java.o
--output-lib mapscript_java.lib --output-def mapscript_java.def
mapscript_wrap.o
	$(CC) mapscript_wrap.o mapscript_java.o -o mapscript_java.dll $(LDFLAGS)


mapscript_java::
	$(JAVAC) -d . *.java
	
mapscript_jar::
	$(JAR) cf mapscript.jar edu

clean:
	rm -rf *.c *.o *.def *.lib *.dll edu *.java *.jar

==

$ make

==

The resulting "mapscript_java.dll" doesn't work.

=====
Andrew Collins - andrewrcollins at yahoo.com
http://profiles.yahoo.com/andrewrcollins/

__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com



More information about the mapserver-users mailing list