[cairo] Re: pycairo link error on Mac OS X
jeremy.d.brewer at gmail.com
Tue Jan 9 16:56:08 PST 2007
I ran 'make check' after rebuilding cairo, and it fails on a lot of
tests complaining about functions starting with CG* (Quartz
functions). After some trial and error I determined that these
errors are due to configuring with --enable-quartz and --enable-
atsui. More specifically, anytime that a program is linked against
libpng dynamically and uses Quartz or atsui (-framework CoreServices -
framework ApplicationServices) there will be a runtime error because
of the case-sensitivity of libPng and libpng.
I encountered a similar problem when trying to build libjpeg for the
Python Imaging Library, and I eventually gave up on getting the
dynamic libs to work and only used static libs.
To get cairo and pycairo working, I removed the dynamic libpng libs
and created a symlink libpng12.dylib that points to the static lib.
I did the latter because the cairo build explicitly names
libpng12.dylib when linking instead of -lpng, but I couldn't find
where it was explicitly stated in the Makefile (grep -r
libpng12.dylib * yields nothing, and my pkg-config scripts didn't
seem to have anything either).
To get pycairo to compile, I had to alter the LDFLAGS environment
variable before configuring as below:
setenv LDFLAGS '-Xlinker -framework -Xlinker CoreServices -Xlinker -
framework -Xlinker ApplicationServices'
I figured out how to do this from the following web site detailing
freetype issues with Mac OS X:
Only if cairo statically links libpng will this not cause a runtime
error for me because of the case sensitivity issue mentioned above.
I hope someone finds this info helpful as I spent several hours
tinkering with this stuff.
More information about the cairo