[mapserver-users] Pyhton mapscript import error
Guillaume Sueur
no-reply at neogeo-online.net
Tue Feb 17 20:26:30 EST 2009
Hi,
python mapscript + agg is a real pain
I grabbed a howto file some months ago, on PerryGeo blog
(http://www.perrygeo.net/wordpress/)
find it here as attachment
it works fine. I've just tested it again few minutes ago.
Regards
Guillaume
gautamvs a écrit :
> I am getting error while importing mapscript in python
>
> <snip>
>>>> import mapscript
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "mapscript.py", line 7, in ?
> import _mapscript
> ImportError: /usr/local/lib/python2.4/site-packages/_mapscript.so: undefined
> symbol: _ZN3agg6gse5x7E
> </snip>
>
> when i removed the AGG suport in Mapserver , i am able to import without any
> error.
>
> But my application requires AGG support (ie. with Tilecache)
>
> I am using Mapserver 5.2.1, AGG 2.5, Python 2.4 on CentOS.
>
> Thanks for any help.
>
> Gautam
>
>
>
>
>
>
>
>
>
>
>
>
>
-------------- next part --------------
# agg
#agg 2.4
# based on http://trac.osgeo.org/mapserver/ticket/2215
tar -xzvf agg2.4.tar.gz
cd agg2.4
emacs src/Makefile
# add to CXXFLAGS ... -fPIC
CXXFLAGS= $(AGGCXXFLAGS) -I../include -L./ -fPIC
# add to the end of file
shared: $(OBJ) ../font_freetype/agg_font_freetype.o
$(CXX) -shared -W1,-soname,libagg.2.4.so -o libagg.so \$(OBJ) ../font_freetype/agg_font_freetype.o -L/usr/local/lib -lfreetype
make
cd examples/X11
emacs Makefile
# Change:
# -I/usr/local/include/freetype2 \
# To:
# `freetype-config --cflags` \
# add to both CXXFLAGS ...... -fPIC
######
CXXFLAGS= $(AGGCXXFLAGS) -I../../include \
-L../../src \
$(PIXFMT) -fPIC
CXXFREETYPEFLAGS= $(AGGCXXFLAGS) -Wall \
-I../../include \
-I../../font_freetype \
`freetype-config --cflags` \
-L../../src \
$(PIXFMT) -fPIC
######
make freetype
cd ../../font_freetype/
ar r libaggfontfreetype.a agg_font_freetype.o
cd ../src
ln -s ../font_freetype/libaggfontfreetype.a
cd ..
make clean
make
cd src
make shared
sudo cp libagg.so /usr/local/lib
sudo ldconfig
# mapserver
./configure --without-tiff --with-jpeg --with-png --with-freetype \
--with-zlib --with-threads --with-proj \
--with-gdal=/usr/local/bin/gdal-config --with-wcs --with-ogr \
--with-wmsclient --with-wfsclient --with-wfs \
--without-pdf --with-geos --enable-debug --with-agg=/home/perry/src/agg-2.4 \
--with-postgis=/usr/bin/pg_config \
--with-curl-config=/usr/bin/curl-config --with-httpd=/usr/sbin/apache2 --with-gd=/usr/local \
--with-fastcgi
make
sudo cp mapserv /usr/lib/cgi-bin/
sudo cp shp2img shp2pdf shptree shptreetst shptreevis sortshp tile4ms scalebar legend msencrypt mapserv /usr/local/bin/
#mapscript
cd mapscript/python
# swig -python -shadow -modern -o mapscript_wrap.c ../mapscript.i
swig -python -shadow -modern -templatereduce -fastdispatch -fvirtual -fastproxy \
-modernargs -castmode -dirvtable -fastinit -fastquery -noproxydel -nobuildnone \
-o mapscript_wrap.c ../mapscript.i
python setup.py build
cd tests/cases && python runalltests.py -v
# don't worry about the 4 test failures .. due to postgres database not being present
cd ../..
sudo python setup.py install --force
More information about the mapserver-users
mailing list