mapnik / python-mapnik

Python bindings for mapnik

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile error with latest mapnik 3.0.23

crmathew opened this issue · comments

Hi

I am compiling a tileserver stack from scratch (on Slackware 14.2, with only python3 installed), testing new versions before updating an old (mostly) working install.

Everything has gone well so far, but I get c++ compile errors when building mapnik-python current against more recent mapnik versions.

These seem to be due to API changes (header files moved and renamed, classes shifted about within the files, etc.

I managed to fix the first few errors by editing various #include lines to point to the right place, but now have run into actual compile-time interface issues (calling functions that don't exist etc).

Here are the first few errors, the fixing of which triggered the next in knock-on fashion;


src/mapnik_datasource.cpp:37:37: fatal error: mapnik/geometry/box2d.hpp: No such file or directory


src/mapnik_datasource_cache.cpp:31:34: fatal error: mapnik/value/types.hpp: No such file or directory


src/mapnik_envelope.cpp:33:37: fatal error: mapnik/geometry/box2d.hpp: No such file or directory


src/mapnik_envelope.cpp:34:34: fatal error: mapnik/value/error.hpp: No such file or directory


src/mapnik_envelope.cpp:34:29: fatal error: mapnik/values.hpp: No such file or directory


src/mapnik_envelope.cpp: In function 'mapnik::box2d from_string(const string&)':
src/mapnik_envelope.cpp:61:15: error: 'value_error' is not a member of 'mapnik'
throw mapnik::value_error(ss.str());


src/mapnik_feature.cpp:37:34: fatal error: mapnik/value/types.hpp: No such file or directory


src/mapnik_geometry.cpp:38:45: fatal error: mapnik/geometry/geometry_type.hpp: No such file or directory


Then I get these, which I do not think can be fixed with simple filename hacks:

src/mapnik_geometry.cpp: In function 'void polygon_add_ring_impl(mapnik::geometry::polygon&, const mapnik::geometry::linear_ring&)':
src/mapnik_geometry.cpp:193:10: error: 'struct mapnik::geometry::polygon' has no member named 'push_back'
poly.push_back(ring); // copy
^
src/mapnik_geometry.cpp: In function 'void export_geometry()':
src/mapnik_geometry.cpp:268:28: error: 'size' is not a member of 'mapnik::geometry::polygon'
.def("num_rings", &polygon::size, "Number of rings")

While I appreciate that these are complicated software packages doing very tricky things, and I am glad folks are working to make it possible in the open source realm, I must say, I've been trying to get a cleanly installed tile-server (via repeatable process) running via apache for 2 or 3 years now and never quite managed. There is always some version incompatibility or compilation fudging needing to be done, or some niggly error message filling up the error logs (presuming I can get some combination of versions working together). Python versioning and install/configure systems providing most of the headache - everyone is using a different packaging system...

I have tried to attach my full install process as a text file, but github says 'error', so here it is inline (there earlier parts up until the current errors)

As root, create the folders:

/usr/local/tileserver/
/usr/local/tileserver/bin

Perform the following for root user and normal user:

nano ~/.bashrc

add to the file:

. /etc/profile

Then, as root, modify /etc/profile to add to PATH:

/usr/local/tileserver/bin

As root, modify /etc/ld.so.conf - add the following lines:

/usr/local/lib
/usr/local/lib64
/usr/local/tileserver/lib
/usr/local/tileserver/lib64

As 'data-wranger' [non-root] user:

mkdir Setup
mkdir Setup/Middleware

cd ~/Setup/Middleware

Install proj.6:

cd ~/Setup/Middleware
wget https://download.osgeo.org/proj/proj-6.3.0.tar.gz
tar -xvf proj-6.3.0.tar.gz
cd proj-6.3.0/
./configure --prefix=/usr/local/tileserver/
make
make install [as root]

Install OpenJPEG:

cd ~/Setup/Middleware
wget https://github.com/uclouvain/openjpeg/archive/v2.3.1.tar.gz
mv v2.3.1.tar.gz openjpeg-v2.3.1.tar.gz
tar -xvf openjpeg-v2.3.1.tar.gz
mkdir openjpeg-v2.3.1-build
cd openjpeg-v2.3.1-build
cmake ../openjpeg-2.3.1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/tileserver
make
make install [as root]
ldconfig [as root]

Install GEOS:

cd ~/Setup/Middleware
wget http://download.osgeo.org/geos/geos-3.8.0.tar.bz2
tar -xvf geos-3.8.0.tar.bz2
cd geos-3.8.0
./configure --prefix=/usr/local/tileserver/
make
make install [as root]
ldconfig [as root]

Install GDAL:

cd ~/Setup/Middleware
wget https://github.com/OSGeo/gdal/releases/download/v3.0.3/gdal-3.0.3.tar.gz
tar -xvf gdal-3.0.3.tar.gz
cd gdal-3.0.3
./configure --prefix=/usr/local/tileserver/ --with-python --with-proj=/usr/local/tileserver/ --with-openjpeg=/usr/local/tileserver/ --with-geos=/usr/local/tileserver/bin/geos-config -with-curl
make
make install [as root]
ldconfig [as root]

Install PostgreSQL:

[ skipped, not relevant ]

Install PostGIS:

[ skipped, not relevant ]

Install ModestMaps:

cd ~/Setup/Middleware
mkdir modestmaps
cd modestmaps/
wget https://github.com/stamen/modestmaps-py/archive/master.zip
#wget https://github.com/migurski/modestmaps-py/archive/master.zip
mv master.zip modestmaps.zip [ because who wants to unzip their master? ]
unzip modestmaps.zip
cd modestmaps-py-master/
[as root] python setup.py install

Install PILLOW:

PILLOW seems not be needed for Slackware 14.2 install, but it was needed for earlier distros

... but in case

python setup.py install [as root]

Install Mapnik:

cd ~/Setup/Middleware
wget https://github.com/mapnik/mapnik/releases/download/v3.0.23/mapnik-v3.0.23.tar.bz2
tar -xvf mapnik-v3.0.23.tar.bz2
cd mapnik-v3.0.23
[configure with override to support proj.6:]
./configure --prefix=/usr/local/tileserver/ GDAL_CONFIG=/usr/local/tileserver/bin/gdal-config PROJ_LIBS=/usr/local/tileserver/lib PROJ_INCLUDES=/usr/local/tileserver/include CUSTOM_DEFINES="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1"
[build it:]
make
make install [as root]

Install Mapnik-python (instruction for 3.0.16, but I am currently using master):

cd ~/Setup/Middleware
mkdir mapnik-python
mkdir mapnik-python/v3.0.16
cd mapnik-python/v3.0.16/
wget https://github.com/mapnik/python-mapnik/archive/v3.0.16.tar.gz
tar -xvf v3.0.16.tar.gz
cd python-mapnik-3.0.16/
python setup.py install [don't run bootstrap]

[ errors here, with current stack softwar versions)

Install Tilestache:

cd ~/Setup/Middleware
mkdir tilestache
wget https://github.com/TileStache/TileStache/archive/v1.51.5.tar.gz
mv v1.51.5.tar.gz tilestache/
cd tilestache/
tar -xvf v1.51.5.tar.gz
cd TileStache-1.51.5/
[as root] python setup.py install

Install mod_python

[OBSOLETED - prefer WSGI now, current project ]

You have to use the v3.0.x branch of python-mapnik and mapnik: https://github.com/mapnik/mapnik/tree/v3.0.x/