mapnik / mapnik-support

Use the issues queue here to ask questions and offer help on using Mapnik (maybe if this works well we can retire the mailing list at http://mapnik.org/contact/?)
6 stars 6 forks source link

fatal error: mapbox/variant.hpp: No such file or directory #112

Open mamasue opened 5 years ago

mamasue commented 5 years ago

I've seen alot of posts about this error, but none of the suggestions have helped me. I'm trying to build an rpm for Centos 7. I have built and installed an rpm for Boost 1.67 and for Mapnik v3.0.21. variant.hpp does exist in the /usr/include/mapnik/mapbox directory, so not sure why it isn't finding it. Any help would be appreciated.

talaj commented 5 years ago

mapbox/variant.hpp is not part of the repo, it's a submodule:

$ git submodule status
d2588a8f1d6b5d480d228e6d8a906ce634bdea9a deps/mapbox/variant (v1.1.5)
4de7fe7a00e4e269cdaeb2fd0b69c4bfa4a6a61f test/data (v3.0.21)
0a804e64beee9af6b1388f45d89554fddbba89c5 test/data-visual (v3.0.21-1-g0a804e64)

Following argument is then added to the list of compiler arguments by SConstruct#L1759:

-Ideps/mapbox/variant/include

mapbox::variant headers are installed to include/mapnik by deps/mapnik/build.py.

mamasue commented 5 years ago

Yes. It was part of the mapnik rpm and the mapbox subdirectory is in the /usr/include/mapnik after I install the rpm, but when trying to build the python-mapnik rpm, it doesn't seem to be finding it.

[rpmbuild@rpm02sat mapnik]$ git submodule status d2588a8f1d6b5d480d228e6d8a906ce634bdea9a deps/mapbox/variant (v1.1.5) 4de7fe7a00e4e269cdaeb2fd0b69c4bfa4a6a61f test/data (v3.0.21) 13163a419eec939d189a371427022402b98bb08a test/data-visual (v3.0.21)

[rpmbuild@rpm02sat mapnik]$ ls -la /usr/include/mapnik/mapbox/ total 60 drwxr-xr-x. 2 root root 123 Oct 26 03:34 . drwxr-xr-x. 15 root root 8192 Oct 26 03:34 .. -rw-r--r--. 1 root root 1575 Oct 26 02:34 optional.hpp -rw-r--r--. 1 root root 2632 Oct 26 02:34 recursive_wrapper.hpp -rw-r--r--. 1 root root 31997 Oct 26 02:34 variant.hpp -rw-r--r--. 1 root root 912 Oct 26 02:34 variant_io.hpp -rw-r--r--. 1 root root 743 Oct 26 02:34 variant_visitor.hpp

talaj commented 5 years ago

Python bindings are taking path to /usr/include/mapnik from mapnik-config --cflags in setup.py#L224.

I can see -I/usr/include/mapnik there:

$ mapnik-config --cflags
-I/usr/include -I/usr/include/mapnik/agg -I/usr/include/mapnik -I/opt/szn/freetype/include/freetype2 -I/usr/include -I/usr/include/libxslt -I/usr/include/libexslt -I/usr/include/libxml2 -I/usr/include/gdal -I/usr/include/postgresql -I/opt/szn/cairo/include/cairo -I/opt/szn/cairo/include/pixman-1 -DMAPNIK_MEMORY_MAPPED_FILE -DMAPNIK_HAS_DLCFN -DBIGINT -DBOOST_REGEX_HAS_ICU -DHAVE_JPEG -DMAPNIK_USE_PROJ4 -DHAVE_PNG -DHAVE_WEBP -DHAVE_TIFF -DLINUX -DMAPNIK_THREADSAFE -DBOOST_SPIRIT_NO_PREDEFINED_TERMINALS=1 -DBOOST_PHOENIX_NO_PREDEFINED_TERMINALS=1 -DBOOST_SPIRIT_USE_PHOENIX_V3=1 -DNDEBUG -DMAPNIK_STATS_RENDER -DHAVE_CAIRO -DGRID_RENDERER -DSVG_RENDERER -DHAVE_LIBXML2 -std=c++11 -g -DMAPNIK_POSTGIS_PLUGIN_MAX_SIZE=500 -Og -fvisibility=hidden -fvisibility-inlines-hidden -Wall -pthread -ftemplate-depth-300 -Wsign-compare -O3
mamasue commented 5 years ago

So, now I see:

[root@rpm02sat bin]# mapnik-config --cflags -I//include -I//include/mapnik/agg -I//include/mapnik -I/usr/include -I/usr/include/freetype2 -I/usr/include/gdal -I/usr/pgsql-9.4/include -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng15 -I/usr/include/libdrm -DMAPNIK_MEMORY_MAPPED_FILE -DMAPNIK_HAS_DLCFN -DBIGINT -DBOOST_REGEX_HAS_ICU -DHAVE_JPEG -DMAPNIK_USE_PROJ4 -DHAVE_PNG -DHAVE_TIFF -DLINUX -DMAPNIK_THREADSAFE -DBOOST_SPIRIT_NO_PREDEFINED_TERMINALS=1 -DBOOST_PHOENIX_NO_PREDEFINED_TERMINALS=1 -DBOOST_SPIRIT_USE_PHOENIX_V3=1 -DNDEBUG -DHAVE_CAIRO -DGRID_RENDERER -std=c++11 -DU_USING_ICU_NAMESPACE=0 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -pthread -ftemplate-depth-300 -Wsign-compare -Wshadow -O3

Inside mapnik-config: CONFIG_PREFIX="$( cd "$( dirname $( dirname "$0" ))" && pwd )" CONFIG_MAPNIK_INCLUDE="${CONFIG_PREFIX}/include -I${CONFIG_PREFIX}/include/mapnik/agg -I${CONFIG_PREFIX}/include/mapnik"

CONFIG_PREFIX is evaluating / instead of /usr, so that is my issue. But I don't know how it's supposed to work? Any idea? Thanks for your help so far.

talaj commented 5 years ago

Where your mapnik-config is located?

$ which mapnik-config                                                                                                                                                        
/usr/bin/mapnik-config                

mapnik-config builds the prefix path from its location. So either the location is nonstandard or the shell code is interpreted wrongly on your system:

CONFIG_PREFIX="$( cd "$( dirname $( dirname "$0" ))" && pwd )"
mamasue commented 5 years ago

[rpmbuild@rpm02sat ~]$ which mapnik-config /bin/mapnik-config

[rpmbuild@rpm02sat /]$ ls -lad bin lrwxrwxrwx. 1 root root 7 Dec 12 2017 bin -> usr/bin

bin appears before /usr/bin in my path. I was able to workaround the issue by linking /usr/include to /include. I'll try moving my /usr/bin before /bin in my path and see if that works. Thanks for your help! I think I've got it now.

alsaleem00 commented 2 years ago

mapbox/variant.hpp does exist in mapnik/include. i solved this error by adding and additional include folder. -I"mapnik include folder"/mapnik