[cairo] py2cairo - 'import cairo' fails with linking error
Jay Hendren
james.hendren at Colorado.EDU
Thu Mar 20 21:44:18 PDT 2014
I'm attempting to install py2cairo on top of local builds of python,
cairo, freetype, and a whole slew of other dependencies. I was able
to successfully compile py2cairo and it appears to be properly linked
with all necessary shared object files. But when I try to use py2cairo,
I get a linker error:
[arlsrv2 ~]% which python
/usr/local/python/bin/python
[arlsrv2 ~]% python
Python 2.7.1 (r271, Jun 14 2011, 11:40:39)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/py2cairo/lib/python2.7/site-packages/cairo/__init__.py", line 1, in <module>
from _cairo import *
ImportError: /usr/local/cairo-1.12.16/lib/libcairo.so.2: undefined symbol: FT_Library_SetLcdFilter
Cairo is complaining about the freetype library, which it links against.
Support for the LCD filter is not built into the system freetype library,
but it is build into my local build of the freetype library.
If I run ldd against the cairo library that the python importer is
complaining about, I can see that it appears to be linked properly to
my custom freetype build in /usr/local:
[arlsrv2 ~]% ldd /usr/local/cairo-1.12.16/lib/libcairo.so.2
linux-vdso.so.1 => (0x00007fff779fd000)
libpixman-1.so.0 => /usr/local/pixman-0.29.4/lib/libpixman-1.so.0 (0x00002aef7aa52000)
libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x00002aef7ad2d000)
libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x00002aef7af61000)
libXrender.so.1 => /usr/lib64/libXrender.so.1 (0x00002aef7b185000)
libX11.so.6 => /usr/lib64/libX11.so.6 (0x00002aef7b38f000)
libXext.so.6 => /usr/lib64/libXext.so.6 (0x00002aef7b69b000)
libz.so.1 => /lib64/libz.so.1 (0x00002aef7b8ac000)
librt.so.1 => /lib64/librt.so.1 (0x00002aef7bac1000)
libfreetype.so.6 => /usr/local/freetype-2.4.12/lib/libfreetype.so.6 (0x00002aef7bcca000)
libm.so.6 => /lib64/libm.so.6 (0x00002aef7bf58000)
libc.so.6 => /lib64/libc.so.6 (0x00002aef7c1dc000)
/lib64/ld-linux-x86-64.so.2 (0x0000003726200000)
libexpat.so.0 => /lib64/libexpat.so.0 (0x00002aef7c535000)
libXau.so.6 => /usr/lib64/libXau.so.6 (0x00002aef7c758000)
libXdmcp.so.6 => /usr/lib64/libXdmcp.so.6 (0x00002aef7c95b000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002aef7cb60000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aef7cd64000)
libbz2.so.1 => /usr/lib64/libbz2.so.1 (0x00002aef7cf81000)
[arlsrv2 ~]%
If I add the directory containing my local libfreetype to my run-time library search path, linking succeeds:
[arlsrv2 ~]% export LD_LIBRARY_PATH=/usr/local/freetype-2.4.12/lib
[arlsrv2 ~]% python
Python 2.7.1 (r271, Jun 14 2011, 11:40:39)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
>>>
Based on the evidence at hand, it would appear that the run-time linker
is somehow not searching the right path from within the python importer.
I've done my best to fix this, but I'm stymied - cairo was compiled with
-Wl,-rpath=/usr/local/freetype-2.4.12/lib , so the linker should be using
an absolute path rather than a library name in order to locate the
freetype library.
Any help fixing this would be immensely appreciated.
Thanks,
Jay
More information about the cairo
mailing list