Installing Cairo on OS X Lion

扶醉桌前 提交于 2019-12-22 12:25:38

问题


When I try to install Cairo on OS X Lion with Python 2.7.2 it just does not work, I can build and install it, but when it comes to import cairo in python it can't be found. I have tried the How to install PyCairo 1.10 on Mac OSX with default and it just produces this error

 "_cairo_xlib_surface_get_width", referenced from:
  _xlib_surface_get_width in surface.c.1.o

ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/l9/71rhp2vs7w34bm4x6mfwms500000gn/T//cc1fcO7s.out (No such file or directory)
Waf: Leaving directory `/Users/andrewlynch/Downloads/py2cairo-1.10.0/build_directory'
Build failed
 -> task failed (exit status 1): 
    {task 4550820944: cshlib cairomodule.c.1.o,context.c.1.o,font.c.1.o,path.c.1.o,pattern.c.1.o,matrix.c.1.o,surface.c.1.o -> _cairo.so}
['/usr/bin/gcc', 'src/cairomodule.c.1.o', 'src/context.c.1.o', 'src/font.c.1.o', 'src/path.c.1.o', 'src/pattern.c.1.o', 'src/matrix.c.1.o', 'src/surface.c.1.o', '-o', '/Users/andrewlynch/Downloads/py2cairo-1.10.0/build_directory/src/_cairo.so', '-L/usr/local/Cellar/cairo/1.10.2/lib', '-lcairo', '-lpython2.7', '-dynamiclib', '-Wl,-F.', '-arch', 'i386', '-arch', 'x86_64', '-Wl,-F.', '-Wl,-F.', '-arch', 'i386', '-arch', 'x86_64', '-arch', 'i386', '-arch', 'x86_64']}

回答1:


I had a similar experience while trying to install PyCairo on OSX Lion. The default install tries to use architecture i386 to install. You need to change this to the 64bit architecture, x86_64.

I tried setting the CFLAGS and CXXFLAGS to 'arch x86_64', but this didn't work. To make it work, I had to set ARCHFLAGS to this value.

export ARCHFLAGS="-arch x86_64"

Hopefully, this will solve the problem for you.



来源:https://stackoverflow.com/questions/11191411/installing-cairo-on-os-x-lion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!