[mapserver-users] mapscript - Unable to load dynamic library '/usr/lib/php/modules/php_mapscript.so' undefined symbol: gdImagePngCtx
Ted Spradley
tspradley at snoogems.com
Fri Aug 14 11:46:51 PDT 2009
Hi guys,
I answered my own question while making this post, but am going ahead since
I see the issue has cropped up in the past and the threads didn't seem to
resolve.
*******************************************************************************
Post
*******************************************************************************
While installing/configuring Mapserver, I have been getting the
Warning/error message:
Warning: dl() [function.dl]: Unable to load dynamic library
'/usr/lib/php/modules/php_mapscript.so' -
/usr/lib/php/modules/php_mapscript.so: undefined symbol: gdImagePngCtx in
/var/www/vhosts/snoogems.com/httpdocs/phpinfo_mapscript.phtml on line 21
When attempting to call dl("php_mapscript.so") in a phpinfo script
Also on Apache startup:
'PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php/modules/php_mapscript.so' -
/usr/lib/php/modules/php_mapscript.so: undefined symbol: gdImagePngCtx in
Unknown on line 0'
System Configuration:
Linux/Apache 2.2.8(Fedora)/PHP 5.2.4/Mapserver-5.4.1/mapscript/php3
from phpinfo()
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.3.4
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
Mapserver configured as follows
#####################################################################
Mapserver
./configure --with-php=/usr/local/psa/admin/include/php
--with-ogr=/usr/local/bin/gdal-config
--with-gdal=/usr/local/bin/gdal-config
--with-httpd=/usr/sbin/httpd
--with-wfsclient
--with-wmsclient
--enable-debug
--with-curl-config=/usr/bin/curl-config
--with-proj=/usr/local
--with-tiff
--with-gd=/usr/lib/
--with-jpeg
--with-freetype=/usr/
--with-threads
--with-wcs
--with-postgis=/usr/bin/pg_config
--with-libiconv=/usr/bin
--with-xml2-config=/usr/bin/xml2-config
______________________________________________________________________________________
Which returned:
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for ranlib... ranlib
checking for flex... no
checking for lex... no
checking for bison... bison -y
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking for exp in -lm... yes
checking for __gxx_personality_v0 in -lstdc++... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... //bin/grep
checking for egrep... //bin/grep -E
checking for ANSI C header files... yes
checking for strcasecmp... yes
checking for strncasecmp... yes
checking for strdup... yes
checking for strrstr... no
checking for strcasestr... yes
checking for strlcat... no
checking for vsnprintf... yes
MapServer Version from mapserver.h: '5.4.1'
checking if pkg-config path is provided... checking for pkg-config...
/usr/bin/pkg-config
configure: checking where FreeType 2.x is installed...
using libfreetype from -lfreetype
configure: checking where Zlib is installed...
checking for zlibVersion in -lz... yes
using libz from system libs (-DUSE_ZLIB).
configure: checking where PNG is installed...
checking for png_init_io in -lpng... yes
using libpng from system libs.
configure: checking whether we should include JPEG support...
checking for jpeg_read_header in -ljpeg... yes
using libjpeg from system libs.
configure: checking where libXpm is installed...
checking for XpmFreeXpmImage in -lXpm... yes
using libXpm from system libs.
configure: checking where libiconv is installed...
checking for iconv_open in -lc... yes
checking for libiconv_open in -liconv... no
checking for iconv_open in -liconv... no
using libiconv from -L -lc
libiconv found. Enabling internationalization (-DUSE_ICONV)
configure: checking for GD 2.0.16 or higher...
checking for gdFontCacheSetup in -lgd... yes
using libgd 2.0.16 (or higher) from -L/usr/lib/ -lgd -ljpeg
-lfreetype -lpng -lz -lXpm -lX11
checking for gdImageGif in -lc... yes
checking for gdImagePng in -lc... yes
checking for gdImageJpeg in -lc... yes
checking for gdImageWBMP in -lc... yes
checking for gdImageStringFT in -lc... yes
checking for gdImageOpenPolygon in -lc... yes
checking for gdImageGifPtr in -lc... yes
checking for gdFontGetTiny in -lc... yes
using GD ( -DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP
-DUSE_GD_FT -DGD_HAS_FTEX_XSHOW -DGD_HAS_GDIMAGEGIFPTR
-DGD_HAS_GETBITMAPFONTS) from /usr/lib/.
configure: checking whether we should include PDF support...
checking for PDF_setlinewidth in -lpdf... no
checking for PDF_setrgbcolor in -lpdf... no
checking for PDF_moveto in -lpdf... no
checking for PDF_curveto in -lpdf... no
checking for PDF_show_xy in -lpdf... no
checking for PDF_load_font in -lpdf... no
libpdf not found or too old... PDF support not included.
checking if AGG support requested... no
checking if RGBA palette png support requested... no
configure: checking whether we should include EPPL7 support...
including EPPL7 support.
configure: checking whether we should include PROJ.4 support...
checking for pj_transform in -lproj... yes
using PROJ.4 from /usr/local.
configure: checking whether we should include thread safe support...
checking for pthread_create in -lpthread... yes
using -lpthread from system libs.
configure: checking whether we should include ESRI SDE support...
ESRI SDE support not requested.
checking if GEOS support requested... no
configure: checking whether we should include OGR support...
OGR enabled (-DUSE_OGR).
checking if GDAL support requested... yes, user supplied gdal-config
(/usr/local/bin/gdal-config)
checking checking ms JPEG output... no we, have GDAL available.
configure: checking whether we should include TIFF support...
checking for TIFFOpen in -ltiff... no
libtiff not found... TIFF support not included.
checking if PostGIS support requested... yes, user supplied pg_config
(/usr/bin/pg_config)
checking if MyGIS support requested... no
checking if OracleSpatial support requested... no
checking if MING/Flash support requested... no
configure: checking whether we should include WMS Server support...
OGC WMS compatibility enabled (-DUSE_WMS_SVR).
configure: checking whether we should include WFS Server support...
OGC WFS Server support not requested.
configure: checking whether we should include WCS Server support...
OGC WCS Server support enabled (-DUSE_WCS_SVR).
configure: checking whether we should include WMS Client Connections
support...
configure: checking whether we should include WFS Client Connections
support...
configure: checking whether we should include OGC SOS Server support...
OGC SOS Server support not requested.
checking for curl-config... yes, user supplied curl-config
(/usr/bin/curl-config)
found libcurl version 7.16.4
OGC WMS Client Connections enabled (-DUSE_WMS_LYR).
OGC WFS Client Connections enabled (-DUSE_WFS_LYR).
checking for libxml2... checking for xml2-config... /usr/bin/xml2-config
found libxml2 version 2.6.31
checking if FriBidi support requested... no
checking FastCGI support... not requested.
configure: checking HTTPD server (Apache) version...
using user-supplied httpd (/usr/sbin/httpd)
/usr/sbin/httpd version is Apache/2.2.8 (2002008).
Your system is apparently running Apache/2.2.8. Setting stderr to
non-blocking for msDebug() due to Apache 2.x bug (see MapServer bug 458 or
Apache bug 22030).
Compiling with fast MS_NINT
checking compiler warnings... basic
configure: checking whether we should enable debug features...
Enabling debug features: -g in CFLAGS.
configure: checking for PHP/MapScript module options...
checking for g++ -shared ... yes
checking for location of config.h or php_config.h...
/usr/local/psa/admin/include/php/main/php_config.h
checking whether we have PHP3 or PHP4... -DPHP4
checking whether we should use PHP's regex... yes
found regex_extra.h - building PHP MapScript with PHP's bundled
regex
PHP/MapScript module configured.
checking if --enable-runpath requested... no
checking if --with-java-include-os-name specified... no, autodetected linux
configure: creating ./config.status
config.status: creating Makefile
config.status: creating mapscript/php3/Makefile
config.status: creating mapscript/java/Makefile
config.status: creating mapscript/csharp/Makefile
MapServer is now configured for
-------------- Compiler Info -------------
C compiler: gcc -g -O2 -fPIC -Wall
C++ compiler: g++ -g -O2 -fPIC -Wall
Debug: -g -DNEED_NONBLOCKING_STDERR
Generic NINT:
-------------- Renderer Settings ---------
zlib support: -DUSE_ZLIB
png support:
palette rgba png support:
jpeg support:
iconv support: -DUSE_ICONV
AGG support:
AGG Freetype support:
Ming(flash) support:
PDFLib support:
-------------- Support Libraries ---------
Proj.4 support: -DUSE_PROJ
Libxml2 support: -DUSE_LIBXML2
FriBidi support:
Curl support: -DUSE_CURL
FastCGI support:
Threading support: -DUSE_THREAD
GEOS support:
-------------- Data Format Drivers -------
native tiff support:
PostGIS support: -DUSE_POSTGIS
EPPL7 support: -DUSE_EPPL
ArcSDE support:
OGR support: -DUSE_OGR
GDAL support: -DUSE_GDAL
Oracle Spatial support:
-------------- OGC Services --------------
WMS Server: -DUSE_WMS_SVR
WMS Client: -DUSE_WMS_LYR
WFS Server:
WFS Client: -DUSE_WMS_LYR
WCS Server: -DUSE_WCS_SVR
SOS Server:
-------------- MapScript -----------------
PHP MapScript: yes
End Mapserver config
#######################################################################
#######################################################################
Mapscript
# /mapserver/mapscript/php3
# make
g++ -shared -o php_mapscript.so php_mapscript_util.o php_mapscript.o
mapscript_i.o php_regex.o -L/usr/mapserver/mapserver-5.4.1 -lmapserver
-lxml2 -lz -lm -lcurl -L/usr/lib -lpq -ljpeg -lfreetype -lpng -lz
-lXpm -lX11 -L/usr/local/lib -lgdal -I/usr/include -lsqlite3 -L/usr/lib
-lexpat -lz -lm -lrt -ldl -lcurl -lpthread -L/usr/local/lib -lproj
-L/usr/lib/ -lgd -ljpeg -lfreetype -lpng -lz -lXpm -lX11 -L -lc -lz -lm
-lstdc++
copied php_mapscript.so to php modules dir /usr/lib/php/modules
End Mapscript config
#######################################################################
#######################################################################
Additional
cd /etc/php.d/gd.ini and Added the line:
extension=php_mapscript.so
# ldconfig
# service httpd restart
######################################################################
System Responses
from Apache's error_log 'PHP Warning: PHP Startup: Unable to load dynamic
library '/usr/lib/php/modules/php_mapscript.so' -
/usr/lib/php/modules/php_mapscript.so: undefined symbol: gdImagePngCtx in
Unknown on line 0'
So removed the line from gd.ini and placed it into php.ini ... same result
Result if calling function dl("php_mapscript.so") from a php script ....
Warning: dl() [function.dl]: Unable to load dynamic library
'/usr/lib/php/modules/php_mapscript.so' -
/usr/lib/php/modules/php_mapscript.so: undefined symbol: gdImagePngCtx in
/var/www/vhosts/snoogems.com/httpdocs/phpinfo_mapscript.phtml on line 21
#######################################################################
# ldd mapserv and # ldd php_mapscript.so both return
'libgd.so.2 => /usr/local/lib/libgd.so.2' ...
My best guess at this point is that 'undefined symbol: gdImagePngCtx ' may
relate to gd somehow not having PNG support ... so
cd /usr/gd/gd-2.0.35 and saw an executable 'fontconfigtest' ...
# ./fontconfigtest
fontconfig not compiled into gd
PNG not compiled into gd
so, took a wild ass guess
# ./configure --with-png
then
# make install
#######################################################################
Semi-resolved
So, Apache's error log now contains
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php/modules/php_mapscript.so' -
/usr/lib/php/modules/php_mapscript.so: undefined symbol: php_gd_gdImageCopy
However, running mapserv from the command line gives the proper response
# mapserv
This script can only be used to decode form results and
should be initiated as a CGI process via a httpd server.
and now running the script phpinfo_mapscript.phtml including the
dl("php_mapscript.so") runs properly and shows Mapserver/Mapscript as a
correctly configured PHP module ...
Sorry for the long post. I seemed to have answered my question in the
process of asking it, but am sure I will run into the php_gd_gdImageCopy as
a problem, but will cross that bridge when I come to it and refer back to
this post. Hope this helps someone.
Cheers,
Ted S.
p.s. Following up - a general Unix reminder that was a minor stumbling block
when checking:
# mapserv -v
and finding that my freshly configured settings were not present in the
newly compiled mapserv binary:
Always do a 'make clean', then 'make'!
--
View this message in context: http://n2.nabble.com/mapscript---Unable-to-load-dynamic-library-%27-usr-lib-php-modules-php_mapscript.so%27-undefined-symbol%3A-gdImagePngCtx-tp3446827p3446827.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
More information about the MapServer-users
mailing list