terminate called after throwing an instance of 'mapnik::config_error' what(): Unable to find specified font face '' #1101

mediafactory opened this Issue Feb 24, 2012 · 28 comments


None yet
5 participants

I have used OSMBright project to connect my TileMill to OSM DB. Afterwards I exported the unmodified OSMBright style to mapnik-xml. I corrected the path to all shapes and removed all fonts except ttf-dejavu. On using this with mapnik2 from git master renderd dies with the given error message.

I have search for the Fonts in the XML and did not found any more than:

<FontSet name="fontset-0">
  <Font face-name="DejaVu Sans Book"/>
<FontSet name="fontset-1">
  <Font face-name="DejaVu Sans Bold Italic"/>
<FontSet name="fontset-2">
  <Font face-name="DejaVu Sans Bold"/>
<FontSet name="fontset-3">
  <Font face-name="DejaVu Sans Italic"/>

any hint?


springmeyer commented Feb 24, 2012

what mapnik version? It needs to be >= Mapnik 2.x to be compatible with TileMill produced stylesheets.

I did a fresh build from git master 1 hour ago.


springmeyer commented Feb 24, 2012

Any chance you have an earlier Mapnik version also installed?

Yes, I have mapnik 0.7 installed, too. But ldd returns:

ldd /usr/local/bin/renderd
linux-vdso.so.1 => (0x00007fffde5ff000)
libmapnik.so.2.0 => /usr/local/lib/libmapnik.so.2.0 (0x00007f475eb9f000)
libiniparser.so.3 => /usr/local/lib/libiniparser.so.3 (0x00007f475e99b000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f475e693000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f475e40f000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f475e1f9000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f475dfdb000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f475dc3c000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f475d9a4000)
libltdl.so.7 => /usr/lib/libltdl.so.7 (0x00007f475d799000)
libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f475d572000)
libtiff.so.4 => /usr/lib/x86_64-linux-gnu/libtiff.so.4 (0x00007f475d30f000)
libjpeg.so.62 => /usr/lib/x86_64-linux-gnu/libjpeg.so.62 (0x00007f475d0e9000)
libproj.so.0 => /usr/lib/libproj.so.0 (0x00007f475cea7000)
libicuuc.so.44 => /usr/lib/libicuuc.so.44 (0x00007f475cb60000)
libboost_filesystem.so.1.42.0 => /usr/lib/libboost_filesystem.so.1.42.0 (0x00007f475c94a000)
libboost_system.so.1.42.0 => /usr/lib/libboost_system.so.1.42.0 (0x00007f475c746000)
libboost_regex.so.1.42.0 => /usr/lib/libboost_regex.so.1.42.0 (0x00007f475c437000)
libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007f475c0db000)
libcairomm-1.0.so.1 => /usr/lib/libcairomm-1.0.so.1 (0x00007f475beb8000)
libcairo.so.2 => /usr/lib/x86_64-linux-gnu/libcairo.so.2 (0x00007f475bbfa000)
/lib64/ld-linux-x86-64.so.2 (0x00007f475f1f8000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f475b9e1000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f475b7dd000)
libicudata.so.44 => /usr/lib/libicudata.so.44 (0x00007f475a79c000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f475a594000)
libicui18n.so.44 => /usr/lib/libicui18n.so.44 (0x00007f475a1dd000)
libsigc-2.0.so.0 => /usr/lib/libsigc-2.0.so.0 (0x00007f4759fd7000)
libpixman-1.so.0 => /usr/lib/x86_64-linux-gnu/libpixman-1.so.0 (0x00007f4759d63000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f4759b2c000)
libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007f4759929000)
libxcb-render.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007f4759720000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f4759503000)
libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f47592f8000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f4758fc0000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f4758d95000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f4758b92000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f475898b000)


springmeyer commented Feb 24, 2012

thanks. /cc @herm - this appears to be being thrown from &processed_text::get_string_info() in processed_text.cpp. Perhaps related to #1077.


springmeyer commented Feb 24, 2012

@Henner - can you gist.github.com your entire xml?



herm commented Feb 25, 2012

Could you please tell me the output from current git? It doesn't fix the problem, but should help debugging it.

hmmmm, output has not changed:
renderd[7904]: DEBUG: Got incoming connection, fd 7, number 1
renderd[7904]: DEBUG: Got command RenderPrio fd(7) xml(osmbright), z(14), x(8674), y(5269)
renderd[7904]: DEBUG: Connection 0, fd 7 closed, now 0 left
NOTICE: Self-intersection at or near point 1.19738e+06 7.14599e+06
terminate called after throwing an instance of 'mapnik::config_error'
what(): Unable to find specified font set ''


springmeyer commented Feb 25, 2012

@Henner - can you remove mapnik 0.7.x, just to be sure that somehow it is not being used (despite the fact that 2.0 appears linked via ldd)?


springmeyer commented Feb 25, 2012

And then also clean and recompile renderd.

I did:
sudo apt-get remove renderd
sudo apt-get remove libmapnik0.7

and searched for renderd and libmapnik and only found the deb packages and the 2.0 version with its source

I did a fresh build of mod_tile and renderd - although there were no changes in SVN

Oh, I forgot to say: no changes...


springmeyer commented Feb 27, 2012

Just to confirm: you are or are not using renderd from packages? And you are saying that after removing libmapnik 0.7, updating to renderd trunk and mapnik master, and recompiling both, you are still seeing this error?

no I am not using renderd from packages - I did this in the very first place to set up my machine, but soon I realized that I have to use mapnik 2.0 - and the package from switchtoosm.org has only 0.7. So I downloaded mapnik and renderd and build it from master/trunk and ran into the described problem.
Yes, I still see those errors.
Any chance, that the mapnik-lib draws any version-number or something else on exceptions - this might be useful for future problems, too


herm commented Feb 29, 2012

I didn't have time to debug this one, yet. I think I might find enough time to do it this weekend.

egore commented Aug 15, 2012

Are there any news on this issue? I've been hit by it as well, using mapnik 2.0.1, latest mod_tile/renderd, latest mapnik-styles. All compiled by myself, no precompiled packages used.


springmeyer commented Aug 15, 2012

@egore - what mapnik styles are you using?

egore commented Aug 18, 2012

I grabed the mapnik-styles from http://svn.openstreetmap.org/applications/rendering/mapnik/ from a few days ago. All I did then was calling:

python generate_xml.py osm.xml --dbname gis --user postgres --accept-none --world_boundaries /usr/share/mapnik/world_boundaries
cp -r osm.xml inc symbols /usr/share/mapnik-stylesheets

egore commented Aug 21, 2012

I finally figured it out: what caused it for me:

By default renderd uses /usr/local/lib64/mapnik/fonts as fonts dir, which did not exist on my system. Changing it to /usr/share/fonts/dejavu finally caused renderd to no longer segfault.

Maybe it's a good idea to test if the given directory exists. And if it doesn't (or doesn't contain fonts) just make the startup fail?


springmeyer commented Aug 21, 2012

Nice debugging. It sounds like the issue is in renderd not mapnik, then?


springmeyer commented Aug 21, 2012

@egore - also, what exact error were you seeing that brought you to this ticket?


springmeyer commented Aug 22, 2012

Looking over this again: this issue can occur either:

  1. When a Mapnik 0.7.x style XML has not been upgraded to Mapnik 2 syntax, so face_name has not been fixed to be face-name (dashes) as per #644 and Mapnik older than 2.1 is used. Mapnik 2.1, as far as I can tell, will throw a better error in this case.

  2. When a Mapnik2 style XML is being used by Mapnik 0.7 (I think this was the original posters problem, despite the fact he thinks he was running Mapnik2 - in fact renderd was using mapnik 0.7.x).

  3. The renderd fonts path is incorrect. This is tricky to detect because Mapnik's python bindings automatically register fonts in the correct location, but if you are using Mapnik from renderd this is pure C++ and the automatic registration does not happen. Either way, with Mapnik 2.1 the error would have been better.

I don't see any fixes need in Mapnik 2.1 (aka master) in regards to this, so closing.


springmeyer commented Aug 22, 2012

re-opening, I see the problem now that persists in Mapnik 2.1.x

@springmeyer springmeyer reopened this Aug 22, 2012


springmeyer commented Aug 22, 2012

/cc @herm.

it appears that perhaps due to https://github.com/mapnik/mapnik/blob/master/src/formatting/format.cpp#L61 a style like this:

    <FontSet name="fontset">
        <Font face-name="Dejaasdfasdf"/>
    <Style name="style">
            <TextSymbolizer fontset-name="fontset">[name]</TextSymbolizer>

Will throw oddly, like: Unable to find specified font set 'fontset'


springmeyer commented Aug 23, 2012

slightly improved in the above commit, but same situation exists - that if not loading from an XML file and if no fonts have been successfully registered, the error message does not provide the actual Font face-name that is not working, which is pretty critical.

Here is my test file:

#include <boost/version.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <iostream>
#include <mapnik/memory_datasource.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/feature_factory.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/map.hpp>
#include <mapnik/params.hpp>
#include <mapnik/expression.hpp>
#include <mapnik/layer.hpp>
#include <mapnik/rule.hpp>
#include <mapnik/feature_type_style.hpp>
#include <mapnik/agg_renderer.hpp>
#include <mapnik/graphics.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/color_factory.hpp>
#include <mapnik/save_map.hpp>

int main( int, char*[] )
    // create a renderable map with a fontset and a text symbolizer
    // and do not register any fonts, to ensure the error thrown is reasonable
    mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();
    mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx,1));
    mapnik::transcoder tr("utf-8");
    UnicodeString ustr = tr.transcode("hello world!");
    mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::Point);
    mapnik::datasource_ptr memory_ds = boost::make_shared<mapnik::memory_datasource>();
    mapnik::memory_datasource *cache = dynamic_cast<mapnik::memory_datasource *>(memory_ds.get());
    mapnik::Map m(256,256);
    mapnik::font_set fontset("fontset");
    // NOTE: this is a valid font, but will fail because none are registered
    fontset.add_face_name("DejaVu Sans Book");
    m.insert_fontset("fontset", fontset);
    mapnik::layer lyr("layer");
    mapnik::feature_type_style the_style;
    mapnik::rule the_rule;
    mapnik::text_symbolizer text_sym(mapnik::parse_expression("[name]"),10,mapnik::color(0,0,0));
    m.insert_style("style",the_style );

    std::clog << mapnik::save_map_to_string(m);

    mapnik::image_32 buf(m.width(),m.height());
    mapnik::agg_renderer<mapnik::image_32> ren(m,buf);

    try {
    } catch (std::exception const& ex) {
        std::clog << ex.what() << "\n";


    if (!::boost::detail::test_errors()) {
        std::clog << "C++ fontset runtime: \x1b[1;32m✓ \x1b[0m\n";
#if BOOST_VERSION >= 104600
        ::boost::detail::report_errors_remind().called_report_errors_function = true;
    } else {
        return ::boost::report_errors();

springmeyer commented Aug 23, 2012

closing and tracking remaining issue in 2.1.x at #1434

ravaan commented Jun 7, 2016

please open this thread for further discussion..

facing the problem when rendering vector style sheet for local osm tile server:

screenshot from 2016-06-07 14 42 51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment