[OSM-dev] libxml2 segfault parsing OSM data with C++, but not C

Nick Whitelegg nick at hogweed.org
Thu Feb 14 21:40:09 GMT 2008

Hello everyone,

Have written a test program to attempt to parse OSM data with libxml2 using 
its SAX parser, as an initial step in bringing direct OSM support to Mapnik. 
For some reason, it runs successfully if it's a C program (saved as .c and 
compiled with gcc) but segfaults if C++ (saved as .cpp, compiled with g++)

The crash occurs in xmlSAXUserParseFile though can't get any more specific 
information than that.

Anyone who has used libxml got any idea on this one?

My test program is at


with the test OSM file at



More information about the dev mailing list