MapServer / MapServer-import

3 stars 2 forks source link

[MapServer]Variables not read when building python mapscript #680

Closed tbonfort closed 12 years ago

tbonfort commented 12 years ago

Reporter: nsavard@mapgears.com Date: 2004/05/25 - 19:25

Variables on line two of "mapscriptvars" file not read when building python
mapscript.  This causes some problem when using non standard library location. 
I included the "mapscriptvars" file and error message when starting the building
process.

The command use is "python setup.py build".

-------------------------
mapscriptvars:

[nsavard@localhost src]$ more mapscriptvars
/opt/mapserver_42/src
-DIGNORE_MISSING_DATA -DUSE_EPPL -DUSE_PROJ -DUSE_PROJ_API_H -DUSE_GD_PNG
-DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT -DUSE_OGR -DUSE_GDAL
-I. -I/usr/local//include -I/usr//include -I/opt/gdal_12//include
-L. -lmap -L/usr//lib -lgd -ljpeg -lfreetype -lpng -lz -ljpeg -lfreetype -lpng
-lz -L/usr/local//lib -lproj -ljpeg -L/opt/gdal_12//lib -lgdal -lcurl
-L/usr/kerberos/lib -lssl -lcrypto -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto
-lresolv -ldl
-lz -L/usr/kerberos/lib -lz -lssl -lcrypto -lssl -lcrypto -lgssapi_krb5 -lkrb5
-lcom_err -lk5crypto -lresolv -ldl -lz -lz -lm -lstdc++

----------------
Error message:

[nsavard@localhost python]$     python setup.py build
running build
running build_py
creating build
creating build/lib.linux-i686-2.2
copying mapscript.py -> build/lib.linux-i686-2.2
running build_ext
building '_mapscript' extension
creating build/temp.linux-i686-2.2
gcc -DNDEBUG -O2 -g -pipe -march=i386 -mcpu=i686 -D_GNU_SOURCE -fPIC -fPIC
-DIGNORE_MISSING_DATA -DUSE_EPPL -DUSE_PROJ -DUSE_PROJ_API_H -DUSE_GD_PNG
-DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT -DUSE_OGR -DUSE_GDAL
-I/usr/include/python2.2 -I/usr/include/python2.2 -c mapscript_wrap.c -o
build/temp.linux-i686-2.2/mapscript_wrap.o
In file included from mapscript_wrap.c:739:
../../map.h:61:21: ogr_api.h: No such file or directory
In file included from mapscript_wrap.c:739:
../../map.h:1158: error: syntax error before "hGeometry"
In file included from mapscript_wrap.c:741:
../../mapogcsld.h:72:25: cpl_minixml.h: No such file or directory
I
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/05/25 - 20:23

Good to see Python being used at DM Solutions!  Write me for help any time. 

Frank Warmerdam fixed this in the CVS main (4.3), but it's not going to be
fixed in 4.2.  Too close to the release.  We'll take of it for 4.2.1.

Work around is to run the setup script like

   python setup.py -I -I/opt/gdal_12/include build

See http://docs.python.org/dist/dist.html for more info about Python's
distutils module.

My idea for the best solution is to have the Python setup ignore mapscriptvars.
Instead, the mapserver makefile will write a distutils setup.cfg file in
mapscript/python.  Then we can clean up and simply setup.py.
tbonfort commented 12 years ago

Author: nsavard@mapgears.com Date: 2004/05/25 - 20:52

I tried the workaround and obtain an error message (see below).

--------------------
Error message:

[nsavard@localhost python]$ python setup.py build --helppython setup.py -I
-I/opt/gdal_12/include build
[nsavard@localhost python]$ python setup.py -I -I/opt/gdal_12/include build
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option -I not recognized
[
tbonfort commented 12 years ago

Author: nsavard@mapgears.com Date: 2004/05/25 - 20:53

I forgot to say that I'm switching to 4.3 for testing purpose.
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/05/25 - 21:11

Sorry, my previous instructions were bad.  Try

   python setup.py build_ext -I /opt/gdal_12/include build
tbonfort commented 12 years ago

Author: nsavard@mapgears.com Date: 2004/05/26 - 15:45

I'm happy to use mapscript Pyton.  Thank you for your help.
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/05/29 - 00:52

This is fixed in 4.2 as well as 4.3.  I simply copied the setup.py
in 4.3 (fixed by Frank) to the 4.2 branch and verified that it works.