python-mapnik
python-mapnik copied to clipboard
Missing boost_python boost library
Hello,
I'm trying to build python-mapnik with export MASON_BUILD=true and then PYCAIRO=true python setup.py install.
However, the build fails with:
Missing boost_python boost library, try to add its name with BOOST_PYTHON_LIB environment var.
but before it printed:
* Installed binary package at /home/oliver/Projects/mapnik/python-mapnik/mason_packages/linux-x86_64/boost_libpython/1.63.0
* Linking /home/oliver/Projects/mapnik/python-mapnik/mason_packages/linux-x86_64/boost_libpython/1.63.0
* Links will be inside /home/oliver/Projects/mapnik/python-mapnik/mason_packages/.link/
* Using bash fallback for symlinking (install lndir for faster symlinking)
* Done linking /home/oliver/Projects/mapnik/python-mapnik/mason_packages/linux-x86_64/boost_libpython/1.63.0
When I install libboost-python1.63 via apt, the build succeeds, but tests fail:
ArgumentError: Python argument types in
DatasourceCache.register_datasources(str)
did not match C++ signature:
register_datasources(std::string)
In my understanding, I shouldn't need install those lib system wide as a mason build is to be provide this as a package. Is this a bug in the mason build?
Can you please try to set export BOOST_PYTHON_LIB=boost_python before build with mason?
This helped. Should that possibly be documented in the readme? Shall I make a PR?
After installing template_postgis database, all test running through except one import error relating to missing pycairo.
However, when pycairo is installed, tests are aborted:
python_tests.cairo_test.test_pycairo_svg_surface1 ... python: ../../../../src/cairo-scaled-font.c:459: _cairo_scaled_glyph_page_destroy: Assertion `!scaled_font->cache_frozen' failed.
Aborted (core dumped)
This seems to be a long standing problem that affects a lot of programs. In mapnik it seemed to be fixed (#2675) but this is obviously not true anymore?
Should that possibly be documented in the readme? Shall I make a PR?
I think this is a bug in setup.py in the first place, but some general advice in the readme about BOOST_PYTHON_LIB, BOOST_THREAD_LIB and BOOST_SYSTEM_LIB variables would be good to have.
Concerning the Cairo problem, I have no clue. Is it just tests what crashes or does it crash also when you try to render something yourself?
I think this is a bug in setup.py in the first place, but some general advice in the readme about BOOST_PYTHON_LIB, BOOST_THREAD_LIB and BOOST_SYSTEM_LIB variables would be good to have.
I've also felt this. I never understood why these needed to be provided. @talaj - if you have time would be great to change setup.py to have reasonable defaults here.
Concerning the Cairo problem, I have no clue. Is it just tests what crashes or does it crash also when you try to render something yourself?
No, will come back here if I tested a bit more.
It seems to be just the tests, so far. I could successfully run the python tutorial and I was able to produce svg with cairo:
#!/usr/bin/env python
import mapnik, cairo
m = mapnik.Map(600,300)
m.background = mapnik.Color('steelblue')
s = mapnik.Style()
r = mapnik.Rule()
polygon_symbolizer = mapnik.PolygonSymbolizer()
polygon_symbolizer.fill = mapnik.Color('#f2eff9')
r.symbols.append(polygon_symbolizer)
line_symbolizer = mapnik.LineSymbolizer()
line_symbolizer.stroke = mapnik.Color('rgb(50%,50%,50%)')
line_symbolizer.stroke_width = 0.1
r.symbols.append(line_symbolizer)
s.rules.append(r)
m.append_style('My Style',s)
ds = mapnik.Shapefile(file='ne_110m_admin_0_countries.shp')
layer = mapnik.Layer('world')
layer.datasource = ds
layer.styles.append('My Style')
m.layers.append(layer)
m.zoom_all()
mapnik.render_to_file(m,'world.png', 'png')
print "rendered image to 'world.png'"
surface = cairo.SVGSurface('world.svg', m.width, m.height)
mapnik.render(m, surface)
surface.finish()
print "rendered image to 'world.svg'"
exit()
I'd like to know what this assertion error means, though. When you look it up in the web, it seems to occur frequently in connection to cairo. I am completely at sea here as I am a complete c and c++ rookie.
As for the variables mentioned above: On a fresh Ubuntu 16.04 (Installed in LXC Container) I had to set all three ones:
export BOOST_PYTHON_LIB=boost_python
export BOOST_THREAD_LIB=boost_thread
export BOOST_SYSTEM_LIB=boost_system
so it would be a good idea to have that in the docs.
I just made a pull request where I added a hint to README.md concerning the missing BOOST libraries. This topic could then be closed, I think.
However, the cairo problem is not solved. I am going to open a new issue for that.
I also ran into this problem of missing the boost_python boost library. For anybody needing to install the library on Ubuntu 16.04, they can use the following command:
sudo apt-get install libboost-python-dev
@d3netxer's tip helped on Ubuntu 17.10 as well