mapnik / python-mapnik

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

How should i build python-mapnik for Mapnik 4.0.1 #283

Open mar0321 opened 3 months ago

mar0321 commented 3 months ago

Hi i would love to have python-mapnik with mapnik 4.0.1 version but it seems to have issues with mapbox::variant which doesnt know long long int data type, but also it looks like there is an issue with support of c++14 and mapnik is currently c++17?

In file included from /usr/local/include/mapnik/datasource.hpp:28, from src/mapnik_datasource.cpp:26: /usr/local/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/local/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>::vari ant(long long int)’ 58 | : value_holder_base(std::forward<T>(obj)) | ^ In file included from /usr/local/include/mapnik/util/variant.hpp:27, from /usr/local/include/mapnik/params.hpp:29, from /usr/local/include/mapnik/datasource.hpp:28, from src/mapnik_datasource.cpp:26: /usr/local/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/local/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::a llocator<char> >, bool>&&’ 572 | VARIANT_INLINE variant(variant<Types...>&& old) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/local/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_tr aits<char>, std::allocator<char> >, bool}]’ 566 | VARIANT_INLINE variant(variant<Types...> const& old) | ^~~~~~~ /usr/local/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/local/include/mapbox/variant.hpp:560:20: note: candidate: ‘template<class T, class Traits, class Enable> mapbox::util::variant<Types>::variant(T&&) [with T = T; Traits = Traits; Enable = Enable; 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/local/include/mapbox/variant.hpp:560:20: note: template argument deduction/substitution failed: /usr/local/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/local/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/local/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/local/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/local/include/mapbox/variant.hpp:547:20: note: candidate expects 0 arguments, 1 provided error: command '/usr/bin/c++' failed with exit code 1



EDIT: 13.08.2024 a sucsefully made u build and istall setup.py after some changes in params.hpp but still when i want to call import mapnik:
SyntaxError: invalid syntax
>>> import mapnik
`# /usr/local/lib/python3.9/dist-packages/mapnik-4.0.1-py3.9-linux-x86_64.egg/mapnik/__pycache__/__init__.cpython-39.pyc matches /usr/local/lib/python3.9/dist-packages/mapnik-4.0.1-py3.9-linux-x86_64.egg/mapnik/__init__.py
# code object from '/usr/local/lib/python3.9/dist-packages/mapnik-4.0.1-py3.9-linux-x86_64.egg/mapnik/__pycache__/__init__.cpython-39.pyc'
# /usr/local/lib/python3.9/dist-packages/mapnik-4.0.1-py3.9-linux-x86_64.egg/mapnik/__pycache__/mapnik_settings.cpython-39.pyc matches /usr/local/lib/python3.9/dist-packages/mapnik-4.0.1-py3.9-linux-x86_64.egg/mapnik/mapnik_settings.py
# code object from '/usr/local/lib/python3.9/dist-packages/mapnik-4.0.1-py3.9-linux-x86_64.egg/mapnik/__pycache__/mapnik_settings.cpython-39.pyc'
import 'mapnik.mapnik_settings' # <_frozen_importlib_external.SourceFileLoader object at 0x7f46c4d986d0>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/local/lib/python3.9/dist-packages/mapnik-4.0.1-py3.9-linux-x86_64.egg/mapnik/__init__.py", line 69, in <module>
    from ._mapnik import *
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 565, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1108, in create_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
ImportError: Internal error while parsing type signature (1)`
edoardoramalli commented 3 weeks ago

Do you have any news? which changes did you make?

mumins commented 19 hours ago

I have identical error with recently cloned mapnik [bb3106d] and python-mapnik [10315a6].