Ticket #1249 (closed defect: fixed)

Opened 8 years ago

Last modified 8 years ago

Java mapscript fails to compile

Reported by: unicoletti Owned by: sdlime
Priority: high Milestone:
Component: MapScript Version: 4.5
Severity: normal Keywords:
Cc: sgillies@…, jerry.pisk@…

Description

I have checked out mapserver from cvs and I was not able to compile Java mapscript.

These are the configure options:

/configure --with-threads --with-pdf --with-proj --without-tiff --without-wms
--with-gdal=/opt/gdal/bin/gdal-config

And this is the error I get:
unicoletti@friedrich java $ make interface all
mkdir -p edu/umn/gis/mapscript
swig -java -package edu.umn.gis.mapscript -o mapscript_wrap.c ../mapscript.i
mv *.java edu/umn/gis/mapscript/
gcc -fpic -c -O2 -fPIC -Wall -DIGNORE_MISSING_DATA -DNEED_STRLCAT  -DUSE_EPPL
-DUSE_PROJ -DUSE_PROJ_API_H      -DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_JPEG
-DUSE_GD_WBMP -DUSE_GD_FT -DGD_HAS_GDIMAGEGIFPTR -DGD_HAS_GETBITMAPFONTS
-DUSE_PDF   -DUSE_GDAL    -DUSE_THREAD -I/usr/include -I/opt/gdal/include     
-I/opt/sun-j2sdk1.4.2_03/include -I/opt/sun-j2sdk1.4.2_03/include/linux
-fno-strict-aliasing mapscript_wrap.c
mapscript_wrap.c: In function `layerObj_applySLD':
mapscript_wrap.c:1324: warning: implicit declaration of function `msSLDApplySLD'
mapscript_wrap.c: In function `layerObj_applySLDURL':
mapscript_wrap.c:1327: warning: implicit declaration of function `msSLDApplySLDURL'
mapscript_wrap.c: In function `layerObj_generateSLD':
mapscript_wrap.c:1330: warning: implicit declaration of function `msSLDGenerateSLD'
mapscript_wrap.c: In function `mapObj_saveQueryAsGML':
mapscript_wrap.c:1525: warning: implicit declaration of function `msGMLWriteQuery'
mapscript_wrap.c: At top level:
mapscript_wrap.c:36765: error: syntax error before "if"
make: *** [mapscript_so] Error 1

It looks the problem lies in the following lines of code (from mapscript.i):
%init %{
        if (msSetup() != MS_SUCCESS)
    {
        msSetError(MS_MISCERR, "Failed to set up threads and font cache",
                   "msSetup()");
    }
%}

They refer to bug 1203.

Change History

Changed 8 years ago by sdlime

  • cc sgillies@… added

Changed 8 years ago by sdlime

  • cc jerry.pisk@… added

Changed 8 years ago by jerry.pisk@…

I do have a fix, I was waiting on seang to decide whether he wants to use it 
or pursue single initialization code for all languages. The problem is that 
swig's %init section will not work with Java.

Changed 8 years ago by sgillies@…

  • status changed from new to assigned
OK, I moved that %init block within the next #ifdef SWIGPYTHON so that it is
Python only.  Committed to CVS HEAD.

Changed 8 years ago by unicoletti

It now compiles fine and I can use it from my java webapp.

Also an issue present in recent cvs checkouts related to gdImageSetThickness
that crashed java mapscript is solved.

Changed 8 years ago by sdlime

  • status changed from assigned to closed
  • resolution set to fixed
Marking as fixed for now...
Note: See TracTickets for help on using tickets.