[cairo] pycairo segfaults on server with cairo built without x, gtk, pygtk

Jeff Kowalczyk jtk at yahoo.com
Fri Dec 24 05:54:22 PST 2004


I have added the option to build cairo without X on my Gentoo linux
installation. I also added packaging for pycairo, which has the option of
treating pygtk and numeric as dependencies. As with cairo, the pycairo
build process will detect the absence of gtk or numeric and configure
accordingly.

However, on the server which has cairo built without X, pycairo segfaults
on the included examples which should not have any dependency on pygtk.
The png files are created, but the segfault happens before any data is
written, and without additional debug information. Running the samples as
root does not change the behavior.

pycairo works fine with these and other samples on my laptop (cairo built
with X, with gtk and pygtk, numeric). Thanks for any info on the bug.

    $ python gradient.py

    Segmentation fault

    $ python hering.py

    Segmentation fault

    $ python spiral.py

    Segmentation fault

    $ ls -l *.png *.ps

    -rw-r--r--  1 myuser users 0 Dec 24 08:46 gradient.png

    -rw-r--r--  1 myuser users 0 Dec 24 08:46 hering.png

    -rw-r--r--  1 myuser users 0 Dec 24 08:46 spiral.ps


Here is an excerpt of the pycairo configure stage on this server, no X,
gtk or pygtk, has numeric.


    checking how to hardcode library paths into programs... immediate

    checking whether stripping libraries is possible... yes

    checking for a Python interpreter with version >= 2.2... python

    checking for python... /usr/bin/python

    checking for python version... 2.4

    checking for python platform... linux2

    checking for python script directory...
    ${prefix}/lib/python2.4/site-packages

    checking for python extension module directory...
    ${exec_prefix}/lib/python2.4/site-packages

    checking for headers required to compile python extensions... found

    checking for pkg-config... /usr/bin/pkg-config

    checking for cairo >= 0.2.0... yes

    checking CAIRO_CFLAGS... -I/usr/include/freetype2
    -I/usr/include/libpng12

    checking CAIRO_LIBS... -lcairo -lfontconfig -lpixman -lpng12 -lz -lm

    checking for   gtk+-2.0 >= 2.0.0   pygtk-2.0 >= 1.99.16... Package
    gtk+-2.0 was not found in the pkg-config search path.

    Perhaps you should add the directory containing `gtk+-2.0.pc'

    to the PKG_CONFIG_PATH environment variable

    No package 'gtk+-2.0' found

    checking for Numeric/arrayobject.h... yes

    configure: creating ./config.status

    config.status: creating Makefile

    config.status: creating cairo/__init__.py

    config.status: creating cairo/Makefile

    config.status: creating config.h

    config.status: executing depfiles commands

    Configuration:

    Additional modules:

        build cairo.gtk   ?     false

        build cairo.numpy ?     true

    make  all-recursive

    make[1]: Entering directory
    `/var/tmp/portage/pycairo-0.1.3/work/pycairo-0.1.3'

    Making all in cairo

    make[2]: Entering directory
    `/var/tmp/portage/pycairo-0.1.3/work/pycairo-0.1.3/cairo'

    if /bin/sh ../libtool --tag=CC --mode=compile i686-pc-linux-gnu-gcc
    -DHAVE_CONFIG_H -I. -I. -I..  -I/usr/include/python2.4
    -I/usr/include/freetype2 -I/usr/include/libpng12      -O2
    -march=athlon-xp -mtune=athlon-xp -pipe -fomit-frame-pointer -Wall
    -std=c9x -MT pycairo-matrix.lo -MD -MP -MF ".deps/pycairo-matrix.Tpo"
    -c -o pycairo-matrix.lo pycairo-matrix.c; \

    then mv -f ".deps/pycairo-matrix.Tpo" ".deps/pycairo-matrix.Plo"; else
    rm -f ".deps/pycairo-matrix.Tpo"; exit 1; fi

    if /bin/sh ../libtool --tag=CC --mode=compile i686-pc-linux-gnu-gcc
    -DHAVE_CONFIG_H -I. -I. -I..  -I/usr/include/python2.4
    -I/usr/include/freetype2 -I/usr/include/libpng12      -O2
    -march=athlon-xp -mtune=athlon-xp -pipe -fomit-frame-pointer -Wall
    -std=c9x -MT pycairo-surface.lo -MD -MP -MF
    ".deps/pycairo-surface.Tpo" -c -o pycairo-surface.lo
    pycairo-surface.c; \

    then mv -f ".deps/pycairo-surface.Tpo" ".deps/pycairo-surface.Plo";
    else rm -f ".deps/pycairo-surface.Tpo"; exit 1; fi

    mkdir .libs

    i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I..
    -I/usr/include/python2.4 -I/usr/include/freetype2
    -I/usr/include/libpng12 -O2 -march=athlon-xp -mtune=athlon-xp -pipe
    -fomit-frame-pointer -Wall -std=c9x -MT pycairo-surface.lo -MD -MP -MF
    .deps/pycairo-surface.Tpo -c pycairo-surface.c  -fPIC -DPIC -o
    .libs/pycairo-surface.o

    i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I..
    -I/usr/include/python2.4 -I/usr/include/freetype2
    -I/usr/include/libpng12 -O2 -march=athlon-xp -mtune=athlon-xp -pipe
    -fomit-frame-pointer -Wall -std=c9x -MT pycairo-matrix.lo -MD -MP -MF
    .deps/pycairo-matrix.Tpo -c pycairo-matrix.c  -fPIC -DPIC -o
    .libs/pycairo-matrix.o

    pycairo-matrix.c: In function `pycairo_matrix_richcmp':

    pycairo-matrix.c:91: warning: dereferencing type-punned pointer will
    break strict-aliasing rules

    pycairo-matrix.c:91: warning: dereferencing type-punned pointer will
    break strict-aliasing rules

    pycairo-matrix.c:93: warning: dereferencing type-punned pointer will
    break strict-aliasing rules

    pycairo-matrix.c:93: warning: dereferencing type-punned pointer will
    break strict-aliasing rules


Gentoo packaging for those interested:

http://bugs.gentoo.org/show_bug.cgi?id=75346

http://bugs.gentoo.org/show_bug.cgi?id=75348






More information about the cairo mailing list