[OSM-Devserver] Fix für segmentation fault in mapnik

Nop ekkehart at gmx.de
Mo Dez 14 08:38:11 CET 2009


Hi!


Es scheint, daß es zwei Wege gibt, den Bug in 6.1 zu beheben:

1. Zusätzlich Cairo installieren
2. Gleich 0.7 installieren. Das soll in ein paar Tagen rauskommen.

Details siehe unten.

Bitte _keinen_ Vorab-Compile der 0.7 für Ubuntu installieren. Denn ich 
brauche für meine lokale Installation, gegen die ich denselben Style vor 
dem Hochladen fahre, die Windows-Binaries.

bye
	Nop



-------- Original-Nachricht --------
Betreff: Re: [Mapnik-users] mapnik.render causing segmentation fault
Datum: Sun, 13 Dec 2009 15:24:34 -0800
Von: Dane Springmeyer <blake at hailmail.net>
An: Nop <ekkehart at gmx.de>
CC: Mapnik users mailing-list <mapnik-users at lists.berlios.de>, 
mapnik-devel <mapnik-devel at lists.berlios.de>

On Dec 13, 2009, at 3:10 PM, Nop wrote:

>
> Hi!
>
> Am 13.12.2009 23:25, schrieb Dane Springmeyer:
>> install cairo's python bindings like:
>>
>> sudo apt-get install python-cairo
>>
>> and I think the problem will be fixed.
>
> Before I ask my admin, two questions:
>
> - Does this explain why it crashes on render(), but it does work
> with render_to_file() ?
>

Yes, render_to_file() does not have a function that uses cairo
directly like render() does.

> - Would this be fixed in 0.7?
>

Yes, I made a change in trunk 5 months ago to ensure this will not
crash when the dependency is missing.

http://trac.mapnik.org/changeset/1278/trunk/bindings/python/python_cairo.cpp

But, this problem is something that is only likely to happen with pre-
built packages because to prompt the crash you must have compiled
mapnik against the python-cairo headers and then removed the module.

Just to illustrate this subtle bug, here is a fresh karmic machine
(server edition which does not have python-cairo installed by default,
unlike desktop versions which do):

root at localhost:~# python
Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:54:09)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mapnik
>>> m = mapnik.Map(1,1)
>>> im = mapnik.Image(1,1)
>>> mapnik.render_to_file(m,'test.png')
>>> mapnik.render(m,im)
Segmentation fault

root at localhost:~# sudo apt-get install python-cairo
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
   python-cairo
0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
Need to get 0B/105kB of archives.
After this operation, 410kB of additional disk space will be used.
Selecting previously deselected package python-cairo.
(Reading database ... 15015 files and directories currently installed.)
Unpacking python-cairo (from .../python-
cairo_1.8.6-1ubuntu1_amd64.deb) ...
Setting up python-cairo (1.8.6-1ubuntu1) ...

Processing triggers for python-support ...
root at localhost:~# python
Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:54:09)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mapnik
>>> m = mapnik.Map(1,1)
>>> im = mapnik.Image(1,1)
>>> mapnik.render_to_file(m,'test.png')
>>> mapnik.render(m,im)
>>> exit()