mapnik / python-mapnik

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

cairo.h not found #251

Open JBacc1 opened 2 years ago

JBacc1 commented 2 years ago

Hello, Strange issue, not even sure it is due to mapnik-python. I've installed mapnik 4.0.0 and everything seemed to be right. I go on trying to install mapnik-python, but get the issue: `In file included from src/mapnik_python.cpp:139: In file included from /usr/local/include/mapnik/cairo/cairo_renderer.hpp:33: /usr/local/include/mapnik/cairo/cairo_context.hpp:44:10: fatal error: 'cairo.h' file not found

include

     ^~~~~~~~~

1 error generated. error: command 'clang++-10' failed with exit status 1 Last command run was: clang++-10 -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fstack-protector-strong -Wformat -Werror=format-security -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c src/mapnik_python.cpp -o build/temp.linux-x86_64-3.8/src/mapnik_python.o -I/usr/local/include -I/usr/local/include/mapnik/agg -I/usr/local/include/mapnik/deps -I/home/jb/temp/mapnik/mason_packages/.link/include -I/home/jb/temp/mapnik/mason_packages/.link/include/freetype2 -I/home/jb/temp/mapnik/mason_packages/.link/include/libpng16 -I/home/jb/temp/mapnik/mason_packages/linux-x86_64/libgdal/2.2.3/include -I/home/jb/temp/mapnik/mason_packages/.link/include/cairo -I/home/jb/temp/mapnik/mason_packages/.link/include/pixman-1 -DMAPNIK_MEMORY_MAPPED_FILE -DMAPNIK_HAS_DLCFN -DBIGINT -DBOOST_REGEX_HAS_ICU -DHAVE_JPEG -DMAPNIK_USE_PROJ -DMAPNIK_PROJ_VERSION=70201 -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 -DHAVE_CAIRO -DGRID_RENDERER -DSVG_RENDERER -std=c++14 -DU_USING_ICU_NAMESPACE=0 -D_GLIBCXX_USE_CXX11_ABI=0 -fvisibility-inlines-hidden -pthread -ftemplate-depth-300 -O3 libcairo2-dev` is listed as installed.

JBacc1 commented 2 years ago

Answering to myself. I suppose cairo is not where it is supposed to be. Adding extra_comp_args.append('-I/usr/include/cairo') to setup.py helps compiling. I don't know if it is supposed to be done, or is just displacing the problem. I'm now blocked at linking stage: clang++-10 -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fwrapv -O2 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.8/src/mapnik_color.o build/temp.linux-x86_64-3.8/src/mapnik_coord.o build/temp.linux-x86_64-3.8/src/mapnik_datasource.o build/temp.linux-x86_64-3.8/src/mapnik_datasource_cache.o build/temp.linux-x86_64-3.8/src/mapnik_envelope.o build/temp.linux-x86_64-3.8/src/mapnik_expression.o build/temp.linux-x86_64-3.8/src/mapnik_feature.o build/temp.linux-x86_64-3.8/src/mapnik_featureset.o build/temp.linux-x86_64-3.8/src/mapnik_font_engine.o build/temp.linux-x86_64-3.8/src/mapnik_fontset.o build/temp.linux-x86_64-3.8/src/mapnik_gamma_method.o build/temp.linux-x86_64-3.8/src/mapnik_geometry.o build/temp.linux-x86_64-3.8/src/mapnik_grid.o build/temp.linux-x86_64-3.8/src/mapnik_grid_view.o build/temp.linux-x86_64-3.8/src/mapnik_image.o build/temp.linux-x86_64-3.8/src/mapnik_image_view.o build/temp.linux-x86_64-3.8/src/mapnik_label_collision_detector.o build/temp.linux-x86_64-3.8/src/mapnik_layer.o build/temp.linux-x86_64-3.8/src/mapnik_logger.o build/temp.linux-x86_64-3.8/src/mapnik_map.o build/temp.linux-x86_64-3.8/src/mapnik_palette.o build/temp.linux-x86_64-3.8/src/mapnik_parameters.o build/temp.linux-x86_64-3.8/src/mapnik_proj_transform.o build/temp.linux-x86_64-3.8/src/mapnik_projection.o build/temp.linux-x86_64-3.8/src/mapnik_python.o build/temp.linux-x86_64-3.8/src/mapnik_query.o build/temp.linux-x86_64-3.8/src/mapnik_raster_colorizer.o build/temp.linux-x86_64-3.8/src/mapnik_rule.o build/temp.linux-x86_64-3.8/src/mapnik_scaling_method.o build/temp.linux-x86_64-3.8/src/mapnik_style.o build/temp.linux-x86_64-3.8/src/mapnik_symbolizer.o build/temp.linux-x86_64-3.8/src/mapnik_view_transform.o build/temp.linux-x86_64-3.8/src/python_grid_utils.o -o build/lib.linux-x86_64-3.8/mapnik/_mapnik.cpython-38-x86_64-linux-gnu.so -L/usr/local/lib -lmapnik -L/home/jb/temp/mapnik/mason_packages/.link/lib -L/home/jb/temp/mapnik/mason_packages/linux-x86_64/libgdal/2.2.3/lib -pthread -lboost_filesystem -lboost_regex -lcairo -lpixman-1 -lpng -lproj -lsqlite3 -ltiff -lwebp -licui18n -lboost_system -lharfbuzz -ljpeg -licuuc -lfreetype -licudata -lz -ldl -lmapnik-wkt -lmapnik-json -lboost_python38 -lboost_thread -lboost_system -lrt -Wl,-z,origin -Wl,-rpath=$ORIGIN/lib with error message: /usr/bin/ld : ne peut trouver -lboost_filesystem /usr/bin/ld : ne peut trouver -lboost_regex /usr/bin/ld : ne peut trouver -lproj /usr/bin/ld : ne peut trouver -lsqlite3 /usr/bin/ld : ne peut trouver -lwebp clang: error: linker command failed with exit code 1 (use -v to see invocation) error: command 'clang++-10' failed with exit status 1

JBacc1 commented 2 years ago

Ok, that was for the newbie… apt-get install libproj-dev and others got the install supposed to be working: Installed /usr/local/lib/python3.8/dist-packages/mapnik-4.0.0-py3.8-linux-x86_64.egg Processing dependencies for mapnik==4.0.0 Finished processing dependencies for mapnik==4.0.0

But now, import mapnik throws: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.8/dist-packages/mapnik-4.0.0-py3.8-linux-x86_64.egg/mapnik/__init__.py", line 74, in <module> from ._mapnik import * ImportError: /usr/local/lib/python3.8/dist-packages/mapnik-4.0.0-py3.8-linux-x86_64.egg/mapnik/_mapnik.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN6mapnik4rule10set_filterERKSt10shared_ptrIN6mapbox4util7variantIJNS_10value_nullEbldN6icu_6613UnicodeStringENS_9attributeENS_16global_attributeENS_23geometry_type_attributeENS3_17recursive_wrapperINS_10unary_nodeINS_4tags6negateEEEEENSB_INS_11binary_nodeINSD_4plusEEEEENSB_INSH_INSD_5minusEEEEENSB_INSH_INSD_4multEEEEENSB_INSH_INSD_3divEEEEENSB_INSH_INSD_3modEEEEENSB_INSH_INSD_4lessEEEEENSB_INSH_INSD_10less_equalEEEEENSB_INSH_INSD_7greaterEEEEENSB_INSH_INSD_13greater_equalEEEEENSB_INSH_INSD_8equal_toEEEEENSB_INSH_INSD_12not_equal_toEEEEENSB_INSC_INSD_11logical_notEEEEENSB_INSH_INSD_11logical_andEEEEENSB_INSH_INSD_10logical_orEEEEENSB_INS_16regex_match_nodeEEENSB_INS_18regex_replace_nodeEEENSB_INS_19unary_function_callEEENSB_INS_20binary_function_callEEEEEEE