mapnik / python-mapnik

Python bindings for mapnik
GNU Lesser General Public License v2.1
160 stars 91 forks source link

Fails to build with Mapnik 4.0.0 #279

Open sebastic opened 4 months ago

sebastic commented 4 months ago

A few patches are required to build with the mapnik (4.0.0+ds-1) Debian package:

The above two patches needed to be rebased to work with python-mapnik @ https://github.com/mapnik/python-mapnik/commit/248003c9da0de1ec7996cebd007c982f9875f2a3

Unfortunately the pybind11 port doesn't support all variants of mapnik::value_holder::value_holder():

c++ -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -Werror=implicit-function-declaration -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/python-mapnik-0.0~20240614-248003c9d=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/lib/python3/dist-packages/pybind11/include -I/usr/include/python3.11 -c src/mapnik_datasource.cpp -o build/temp.linux-x86_64-cpython-311/src/mapnik_datasource.o -std=c++17 -fvisibility=hidden -I/usr/include/mapnik -I/usr/include/mapnik/agg -DMAPNIK_THREADSAFE -DBOOST_REGEX_HAS_ICU -DBIGINT -DMAPNIK_MEMORY_MAPPED_FILE -DHAVE_LIBXML2 -DHAVE_PNG -DHAVE_JPEG -DHAVE_TIFF -DHAVE_WEBP -DHAVE_CAIRO -DMAPNIK_USE_PROJ -DMAPNIK_PROJ_VERSION=90401 -DGRID_RENDERER -DSVG_RENDERER -DMAPNIK_HAS_DLCFN -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/sysprof-6 -pthread -I/usr/include/libxml2 -I/usr/include/x86_64-linux-gnu -I/usr/include/webp -I/usr/include/cairo -I/usr/include/pixman-1
cc1plus: warning: '-Werror=' argument '-Werror=implicit-function-declaration' is not valid for C++
cc1plus: warning: '-Werror=' argument '-Werror=implicit-function-declaration' is not valid for C++
In file included from /usr/include/mapnik/datasource.hpp:28,
                 from src/mapnik_datasource.cpp:26:
/usr/include/mapnik/params.hpp: In instantiation of 'mapnik::value_holder::value_holder(T&&) [with T = long long int]':
src/mapnik_value_converter.hpp:183:42:   required from here
/usr/include/mapnik/params.hpp:58:49: error: no matching function for call to 'mapbox::util::variant<mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool>::variant(long long int)'
   58 |         : value_holder_base(std::forward<T>(obj))
      |                                                 ^
In file included from /usr/include/mapnik/util/variant.hpp:27,
                 from /usr/include/mapnik/params.hpp:29:
/usr/include/mapbox/variant.hpp:560:20: note: candidate: 'template<class T, class Traits, class Enable> mapbox::util::variant<Types>::variant(T&&) [with Traits = T; Enable = Traits; Types = {mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool}]'
  560 |     VARIANT_INLINE variant(T&& val) noexcept(std::is_nothrow_constructible<typename Traits::target_type, T&&>::value)
      |                    ^~~~~~~
/usr/include/mapbox/variant.hpp:560:20: note:   template argument deduction/substitution failed:
/usr/include/mapbox/variant.hpp:559:15: error: no type named 'type' in 'struct std::enable_if<false, void>'
  559 |               typename Enable = typename std::enable_if<Traits::is_valid && !std::is_same<variant<Types...>, typename Traits::value_type>::value>::type >
      |               ^~~~~~~~
/usr/include/mapbox/variant.hpp:572:20: note: candidate: 'mapbox::util::variant<Types>::variant(mapbox::util::variant<Types>&&) [with Types = {mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool}]'
  572 |     VARIANT_INLINE variant(variant<Types...>&& old)
      |                    ^~~~~~~
/usr/include/mapbox/variant.hpp:572:48: note:   no known conversion for argument 1 from 'long long int' to 'mapbox::util::variant<mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool>&&'
  572 |     VARIANT_INLINE variant(variant<Types...>&& old)
      |                            ~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/mapbox/variant.hpp:566:20: note: candidate: 'mapbox::util::variant<Types>::variant(const mapbox::util::variant<Types>&) [with Types = {mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool}]'
  566 |     VARIANT_INLINE variant(variant<Types...> const& old)
      |                    ^~~~~~~
/usr/include/mapbox/variant.hpp:566:53: note:   no known conversion for argument 1 from 'long long int' to 'const mapbox::util::variant<mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool>&'
  566 |     VARIANT_INLINE variant(variant<Types...> const& old)
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/mapbox/variant.hpp:554:20: note: candidate: 'mapbox::util::variant<Types>::variant(mapbox::util::no_init) [with Types = {mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool}]'
  554 |     VARIANT_INLINE variant(no_init) noexcept
      |                    ^~~~~~~
/usr/include/mapbox/variant.hpp:554:28: note:   no known conversion for argument 1 from 'long long int' to 'mapbox::util::no_init'
  554 |     VARIANT_INLINE variant(no_init) noexcept
      |                            ^~~~~~~
/usr/include/mapbox/variant.hpp:547:20: note: candidate: 'mapbox::util::variant<Types>::variant() [with Types = {mapnik::value_null, long int, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool}]'
  547 |     VARIANT_INLINE variant() noexcept(std::is_nothrow_default_constructible<first_type>::value)
      |                    ^~~~~~~
/usr/include/mapbox/variant.hpp:547:20: note:   candidate expects 0 arguments, 1 provided
error: command '/usr/bin/c++' failed with exit code 1

This might be caused by 64-bit time_t (-D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64) being used in Debian.

claeyswo commented 2 months ago

Same problem here.