Andrew Lynch
Andrew Lynch

Reputation: 1317

Installing Cairo on OS X Lion

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']}

Upvotes: 2

Views: 1156

Answers (1)

legend12
legend12

Reputation: 375

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.

Upvotes: 2

Related Questions