rundel / carto-generator

C++ Parser for the Carto stylesheet language
15 stars 1 forks source link

Linux Seg Fault #7

Closed jharris2268 closed 13 years ago

jharris2268 commented 13 years ago

Ubuntu 11.04, 64bit, gcc version 4.5.2

Builds ok.

Running ./example test/test.xml results in segmentation fault: running demo ...

looking for 'shape.input' plugin in... /usr/local/lib/mapnik2/input

mml: SEGMENTATION FAULT

Valgrind output boils down to trying to access an null pointer to a std::string.

This appears to be fixed by adding the 'optional generator' [1] to the generator at lines 14 and 15 of gen_map_def.hpp:

    << omit[-qstring]
    << omit[-color]

Running on a version of the osm style found the same problem with line 8 of gen_line_pattern_symbolizer.hpp:

line_pattern_sym = -("line-pattern-file: " << -qstring << ";\n");

Keep up to good work, I'm looking forward to seeing this and the parser integrated into mapnik,

James

  1. http://www.boost.org/doc/libs/1_47_0/libs/spirit/doc/html/spirit/karma/reference/operator/optional.html
rundel commented 13 years ago

Currently I can't replicate this issue on osx with either gcc 4.2.1 or clang trunk. Could you post the osm style xml, I'll try that out as well. I'm in the process of getting a linux box together to test on and I'll see what I can find.

jharris2268 commented 13 years ago

Currently I can't replicate this issue on osx with either gcc 4.2.1 or clang trunk

If I change test.xml to specify a background-image, it runs ok. If I link against a more recent version of mapnik, built with a locally built boost, it runs BUT valgrind shows the same errors.

Perhaps you could try running it with valgrind, or : I think it works well enough on macs now to show up these sorts of problems.

I can work out how, I'll post my valgrind output.

Could you post the osm style xml You need to follow these instructions: www.openstreetmap.org/wiki/Mapnik . Adding a LinePatternSymbolizer to one of your test cases would be as useful.

jharris2268 commented 13 years ago

valgrind output: git://gist.github.com/1129267.git

rundel commented 13 years ago

Thanks for posting the valgrind output, I've run it through valgrind on my system and I am not seeing any leaks with either clang or gcc. Only other thing I can think of is that I have compiler optimizations turned off for the generator and mapnik currently for debugging.

jharris2268 commented 13 years ago

I rebuilt without optimisation. This runs (correctly now: previously I had another problem with colours being reported as rgb(0,0,0)), but with even more valgrind errors! Perhaps these are problems specific to my setup, with the complier picking up parts of the 'system' boost headers.

Btw, carto-parser does compile and run on linux.