Opened 22 years ago

Closed 22 years ago

#182 closed defect (fixed)

mapscript/perl does not include linkage for OGR static libs.

Reported by: alex_rice@… Owned by: sdlime
Priority: high Milestone:
Component: MapScript Version: 4.0
Severity: normal Keywords:
Cc:

Description

-- original problem description -- (solution shown below.)
% perl
use mapscript;
dyld: perl Undefined symbols:
_CPLCalloc
_CPLSPrintf
_CPLStrdup
_GetFieldAsString__10OGRFeaturei
_GetFieldDefn__14OGRFeatureDefni
_GetFieldIndex__14OGRFeatureDefnPCc
_GetParamDbl__11OGRStylePen27ogr_style_tool_param_pen_idRi
_GetParamDbl__13OGRStyleLabel29ogr_style_tool_param_label_idRi
_GetParamDbl__14OGRStyleSymbol30ogr_style_tool_param_symbol_idRi
_GetParamStr__11OGRStylePen27ogr_style_tool_param_pen_idRi
_GetParamStr__12OGRStyleToolR15ogr_style_paramR15ogr_style_valueRi
_GetParamStr__13OGRStyleBrush29ogr_style_tool_param_brush_idRi
_GetParamStr__13OGRStyleLabel29ogr_style_tool_param_label_idRi
_GetParamStr__14OGRStyleSymbol30ogr_style_tool_param_symbol_idRi
_GetPartCount__11OGRStyleMgrPCc
_GetPart__11OGRStyleMgriPCc
_GetRGBFromString__12OGRStyleToolPCcRin3
_GetType__12OGRStyleTool
_InitFromFeature__11OGRStyleMgrP10OGRFeature
_IsLocal__19OGRSpatialReference
_OGRRegisterAll
_Open__20OGRSFDriverRegistrarPCciPP11OGRSFDriver
_SetUnit__12OGRStyleTool23ogr_style_tool_units_idd
_VSIFree
(perl exits)

perl mapscript compiles OK, and doesn't seem to depend on any shared libraries, except 
system ones. (On MacOS X, "otool -L" is equivalent to the "ldd" command on Linux)

% otool -L /Library/Perl/darwin/auto/mapscript/mapscript.bundle                                                  
/Library/Perl/darwin/auto/mapscript/mapscript.bundle:
        /usr/lib/libz.1.1.3.dylib (compatibility version 1.0.0, current version 1.1.3)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 55.1.0)

% ../../mapserv -v
MapServer version 3.6.1 OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP SUPPORTS=
PROJ SUPPORTS=TTF SUPPORTS=WMS_SERVER INPUT=TIFF INPUT=EPPL7 
INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=SHAPEFILE

% otool -L ../../mapserv -v
../../mapserv:
        /usr/lib/libz.1.1.3.dylib (compatibility version 1.0.0, current version 1.1.3)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 55.1.0)

Here is the build output for perl mapscript:

perl Makefile.PL
-I/Users/alex/ARC/gis/Mapserver/mapserver-3.6.1 -I/usr/local/include -I/usr/local/include -
I/usr/local/include -I/usr/local/include -I/Users/alex/ARC/gis/Mapserver/gdal-1.1.7/ogr/
ogrsf_frmts -I/Users/alex/ARC/gis/Mapserver/gdal-1.1.7/ogr -I/Users/alex/ARC/gis/
Mapserver/gdal-1.1.7/ogr/../port
-L/Users/alex/ARC/gis/Mapserver/mapserver-3.6.1 -lmap -L/usr/local/lib -lgd -L/usr/local/
lib -ljpeg -lttf -L/usr/local/lib -lpng -lz -L/usr/local/lib -ltiff -L/usr/local/lib -ljpeg -lttf -L/usr/
local/lib -lpng -lz -L/usr/local/lib -lproj -L/usr/local/lib -ljpeg -L/usr/local/pgsql/lib -lpq -lm
Writing Makefile for mapscript

% make
mkdir blib
mkdir blib/lib
mkdir blib/arch
mkdir blib/arch/auto
mkdir blib/arch/auto/mapscript
mkdir blib/lib/auto
mkdir blib/lib/auto/mapscript
cp mapscript.pm blib/lib/mapscript.pm
cc -c -I/Users/alex/ARC/gis/Mapserver/mapserver-3.6.1 -I/usr/local/include -I/usr/local/
include -I/usr/local/include -I/usr/local/include -I/Users/alex/ARC/gis/Mapserver/gdal-
1.1.7/ogr/ogrsf_frmts -I/Users/alex/ARC/gis/Mapserver/gdal-1.1.7/ogr -I/Users/alex/ARC/
gis/Mapserver/gdal-1.1.7/ogr/../port -g -pipe -pipe -fno-common -no-cpp-precomp -
flat_namespace -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing -O3     -DVERSION=\
"0.10\" -DXS_VERSION=\"0.10\"  -I/System/Library/Perl/darwin/CORE -
DIGNORE_MISSING_DATA -DUSE_EPPL -DUSE_PROJ -DUSE_PROJ_API_H -
DUSE_TIFF -DUSE_JPEG -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -
DUSE_GD_FT -DUSE_OGR mapscript_wrap.c
cc: -flat_namespace: linker input file unused since linking not done
Running Mkbootstrap for mapscript ()
chmod 644 mapscript.bs
LD_RUN_PATH="/Users/alex/ARC/gis/Mapserver/mapserver-3.6.1:/usr/local/lib:
/usr/lib:/usr/local/pgsql/lib" cc -o blib/arch/auto/mapscript/mapscript.bundle  -bundle  -
flat_namespace -undefined suppress mapscript_wrap.o    -L/Users/alex/ARC/gis/
Mapserver/mapserver-3.6.1 -lmap -L/usr/local/lib -lgd -L/usr/local/lib -ljpeg -lttf -L/usr/
local/lib -lpng -lz -L/usr/local/lib -ltiff -L/usr/local/lib -ljpeg -lttf -L/usr/local/lib -lpng -lz -L/
usr/local/lib -lproj -L/usr/local/lib -ljpeg -L/usr/local/pgsql/lib -lpq -lm
chmod 755 blib/arch/auto/mapscript/mapscript.bundle
cp mapscript.bs blib/arch/auto/mapscript/mapscript.bs
chmod 644 blib/arch/auto/mapscript/mapscript.bs

-- Solution--


My mapserver build is all static linking, including OGR. The mapserver build creates 
perlvars file, which has the OGR libs on line 5. perl mapscripts Makefile.PL only takes the 
first 4 lines.

My mapserver makefile has this OGR section. Note OGR_LIB is blank, i guess because 
it's statically linked.

# Optional OGR Support.  OGC Simple Feature inspired interface for vector
# formats.  See http://gdal.velocet.ca/projects/opengis/
OGR=      -DUSE_OGR
OGR_LIB=
OGR_INC=  -I/Users/alex/ARC/gis/Mapserver/gdal-1.1.7/ogr/ogrsf_frmts -I/Users/a\
lex/ARC/gis/Mapserver/gdal-1.1.7/ogr -I/Users/alex/ARC/gis/Mapserver/gdal-1.1.7\
/ogr/../port
OGR_STATIC= /Users/alex/ARC/gis/Mapserver/gdal-1.1.7/ogr/ogrsf_frmts/ogrsf_frmt\
s.a /Users/alex/ARC/gis/Mapserver/gdal-1.1.7/ogr/ogr.a /Users/alex/ARC/gis/Maps\
erver/gdal-1.1.7/ogr/../port/cpl.a

The problem is that perl mapscript's Makefile.PL is not copying the 5th line from the 
"perlvars" file. The 5th line has the OGR stuff. I appended the contents of OGR_STATIC in 
mapserver makefile to the EXTRALIBS and LDLOADLIBS in the perl mapscript makefile, 
compiled and re-installed.

Change History (1)

comment:1 by sdlime, 22 years ago

Resolution: fixed
Status: newclosed
Version: 3.63.7
I believe this is now fixed in the main branch. I simply updated Makefile.PL to
look at that 5th line and make use of it. I'm not set up to test it here though.

Steve
Note: See TracTickets for help on using tickets.