Has anyone installed pycairo 1.10 on the mac using the new waf build? Its failing on can’t find python headers.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think waf is seriously broken for Mac OS X 🙁
Here’s how it worked for me. After
python waf configurefailed to find Python.h, I looked through the config.log file located in build_directory and found out that the true cause of failure was incompatible architecture. The waf script tries to build a simple source file with CPython calls in it using i386 architecture. It fails to do so, because my python is built for the x86_64 architecture.I guess, you could rebuild python as a universal binary, I haven’t tried that. It is possible, however, to build pycairo using the x86_64 architecture. Here’s how.
My setup:
Importrant: my python version is built for the
x86_64architecture. Make sure it is also the case for you before performing the steps described below.brew stands for homebrew. You must use it instead of fink or MacPorts in order for the following steps to work for you.
Now, to install cairo and pycairo I do the following:
brew install cairo(version 1.10.2 as of today)Get pycairo source for python 2.x (if you get a snapshot, it is named py2cairo, whereas pycairo now requires python 3.x). I used the source from master branch (commit f3435910d8f5365b45ebd4216f4043383c9e3e19)
Open
wscriptin your editor of choice, locate the lineenv = ctx.envin the functionconfigureand add the following line below itenv.append_unique('CFLAGS', ['-arch', 'x86_64'])Save the file
Run these commands in your terminal:
export CC=/usr/bin/gccexport PKG_CONFIG_PATH=/usr/local/Cellar/cairo/1.10.2/lib/pkgconfig/Important: the latter path will only work for you if you installed cairo via homebrew
Then run the waf commands described in the pycairo’s INSTALL file:
python waf configurepython waf buildpython waf installThis should do it. If it doesn’t work for you, I think it’s better to raise the topic on the pycairo mailing list (if it has one).