Build of py2cairo fails in Mac OS X with Homebrew

感情迁移 提交于 2019-12-14 03:13:00

问题


I've made the debatable decision to do some network analysis directly in Python instead of R. However, I'm having trouble getting all the igraph dependencies installed, ultimately failing with py2cairo.

After updating Xcode to latest, installed cairo with Homebrew:

brew install cairo

A few warnings there for dependent libraries, and the brew link step failed. After chowning a few directories, I ran brew link again and it worked.

Then, I uninstalled and re-installed python-igraph using pip.

Now I need to install py2cairo from source (I'm running Python 2.7.6 in a virtualenv) and so downloaded it from this source:

git clone git://git.cairographics.org/git/py2cairo

Following Install pycairo in virtualenv, I ran ./waf configure --prefix=$VIRTUAL_ENV with no problems.

Running ./waf build falls over with these errors:

ld: warning: ignoring file /usr/local/Cellar/cairo/1.14.2_1/lib/libcairo.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/Cellar/cairo/1.14.2_1/lib/libcairo.dylib
[...]
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I then tried to switch to using autogen.sh. First problem was that pkg.m4 was missing on my machine, so I tried reinstalling pkg-config with Homebrew again. Didn't work. So I downloaded pkg.m4 from here http://web.mit.edu/barnowl/src/pkg-config/pkg-config-0.23/pkg.m4, then installed libtools with Homebrew, and changed references in autogen to glibtoolize etc.

But then autogen.sh terminates with following errors:

autogen.sh: running `aclocal'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/m4:/usr/local/Cellar/automake/1.15/share/aclocal/pkg.m4:155: ERROR: end of file in comment
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1

回答1:


export ARCHFLAGS='-arch x86_64' # this is for Mac os x ./waf clean ./waf configure --prefix=`python -c "import sys; print sys.prefix"` ./waf build ./waf install

This works well on my Mac



来源:https://stackoverflow.com/questions/31764676/build-of-py2cairo-fails-in-mac-os-x-with-homebrew

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