Open JamesRamm opened 9 years ago
Browsing the code, looks like I need to make sure HAVE_PYCAIRO is defined aswell - mapnik_python.cpp
checks for both HAVE_CAIRO and HAVE_PYCAIRO.
I suppose this will not be enough though, because mapnik_python.cpp
is gonna attempt to #include
pycairo.h and it looks like the cairo build undertaken when building the dependencies didn't do anything about pycairo.. hmf.
So I'm thinking I need to install pycairo, then ensure that my python\include directory where pycairo.h is hopefully gonna turn up is in my list of includes for mapnik-gyp... Is this the 'normal' way of building with pycairo support?
Any info on this? related: https://github.com/mapnik/mapnik-packaging/issues/22
I suspect I am simply not correctly defining library paths in the gyp file, but there isn't much to go on to figure it out....
Adding cairo.lib
to the libraries
section of the _mapnik
target in the gyp file seems to have done the trick. Also need to add the -lcairo
flag.
Easy when you know how - this could really do with documenting.
Mapnik built with pycairo, but attempting to render to a pycairo context causes the python interpreter to hang. Seg fault perhaps?
Clearly there is something not right in the build...
I think you are on the right track. I've never tried to get pycairo working on windows, so thanks for helping with this. Can you describe how to installed pycairo exactly?
Here is what I've done (evidently it is wrong as mapnik won't render with cairo, but mapnik does build happily)
Ok..the version of pycairo I had installed when building was py2cairo-1.10.0 and I just downloaded the installer from gohlke (http://www.lfd.uci.edu/~gohlke/pythonlibs/) and ran it. That gave me a pycairo.h
file in my python installation and a package called cairo
containing _cairo.pyd
.
In the gyp & bat file, I made sure that the python version being used was the one to which I had installed pycairo. In the _mapnik
target section I added cairo.lib
and pycairo.h
.
This was it. Mapnik builds and tests pass.
Then I tried to run python with mapnik/cairo. First it complained about missing dll's and I followed a tutorial in issue #22 to fill in the missing deps. Cairo then works from python, but attempting to call mapnik.render
with a cairo Context
ends up with python.exe
hanging/crashing.
There is obv. something bad happening at some point, but I am at a loss as to where. Do we need to build our own pycairo bindings?.
I'll put up a step-by-step of what I changed in the build files a little later...
How to enable cairo python bindings in the mapnik build?
HAVE_CAIRO
is defined and mapnik builds with cairo support. Butmapnik.have_pycairo()
returns false.