在 OS X Snow Leopard 上安装 PyCairo 或 Py2Cairo

发布于 2024-11-30 14:54:55 字数 4409 浏览 2 评论 0原文

尝试在 OS X Snow Leopard 上设置 PyCairo。这个网站上有很多关于它的问题,但我遇到了编译错误,这是我以前从未见过的。

这是我的环境变量...

PKG_CONFIG_PATH=/usr/local/Cellar/cairo/1.10.2/lib/pkgconfig/
PYTHON=PYTHON3

这是我的 WAF 配置的样子:

TeaMac:py2cairo itadmin$ ./waf configure
  ./options()
Setting top to                           : /Users/itadmin/Sites/py2cairo
Setting out to                           : /Users/itadmin/Sites/py2cairo/build_directory
  ./configure()
Checking for 'gcc' (c compiler)          : ok
Checking for program python              : PYTHON3
python executable 'PYTHON3' different from sys.executable '/usr/bin/python'
Checking for python version              : (3, 2, 1, 'final', 0)
Checking for library python3.2           : not found
Checking for library python3.2           : yes
Checking for program python3.2-config    : /usr/local/bin/python3.2-config
Checking for header Python.h             : yes
Checking for program pkg-config          : /usr/local/bin/pkg-config
Checking for 'cairo' >= 1.10.0           : yes
Configuration:
PREFIX                                   : /usr/local
LIBDIR                                   : /usr/local/lib
'configure' finished successfully (0.580s)

这是 $ ./waf build 步骤的肮脏之处:

[random section of file where GCC errors start coming up...]
../src/surface.c: In function 'xlib_surface_get_depth':
../src/surface.c:1418: warning: return makes pointer from integer without a cast
../src/surface.c: In function 'xlib_surface_get_height':
../src/surface.c:1423: warning: return makes pointer from integer without a cast
../src/surface.c: In function 'xlib_surface_get_width':
../src/surface.c:1428: warning: return makes pointer from integer without a cast
../src/surface.c: At top level:
../src/surface.c:1441: warning: initialization makes integer from pointer without a cast
../src/surface.c:1459: warning: initialization makes pointer from integer without a cast
../src/surface.c:1467: warning: initialization from incompatible pointer type
../src/surface.c:1470: warning: initialization from incompatible pointer type
../src/surface.c:1477: warning: initialization from incompatible pointer type
lipo: can't figure out the architecture type of: /var/tmp//ccuzD4lS.out
lipo: can't figure out the architecture type of: /var/tmp//ccCSYwzk.out
Waf: Leaving directory `/Users/itadmin/Sites/py2cairo/build_directory'
Build failed
 -> task failed (exit status 1):
        {task 4312417936: c cairomodule.c -> cairomodule.c.1.o}
['/usr/bin/gcc', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-arch', 'i386', '-arch', 'x86_64', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-arch', 'i386', '-arch', 'x86_64', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-fno-strict-aliasing', '-fno-common', '-dynamic', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-arch', 'i386', '-arch', 'x86_64', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-fno-strict-aliasing', '-I/Users/itadmin/Sites/py2cairo/build_directory/src', '-I/Users/itadmin/Sites/py2cairo/src', '-I/usr/local/Cellar/cairo/1.10.2/include/cairo', '-I/usr/local/Cellar/pixman/0.22.0/include/pixman-1', '-I/usr/local/include/libpng15', '-I/usr/X11/include', '-I/usr/X11/include/freetype2', '-I/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m', '-DNDEBUG', '../src/cairomodule.c', '-c', '-o', 'src/cairomodule.c.1.o']
 -> task failed (exit status 1):
        {task 4312418384: c pattern.c -> pattern.c.1.o}
['/usr/bin/gcc', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-arch', 'i386', '-arch', 'x86_64', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-arch', 'i386', '-arch', 'x86_64', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-fno-strict-aliasing', '-fno-common', '-dynamic', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-arch', 'i386', '-arch', 'x86_64', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-fno-strict-aliasing', '-I/Users/itadmin/Sites/py2cairo/build_directory/src', '-I/Users/itadmin/Sites/py2cairo/src', '-I/usr/local/Cellar/cairo/1.10.2/include/cairo', '-I/usr/local/Cellar/pixman/0.22.0/include/pixman-1',
[GCC errors galore for 500 lines...]

Trying to set up PyCairo on OS X Snow Leopard. There are quite a few questions about it on this site, but I'm getting compile errors, which I haven't seen before.

Here are my environment variables...

PKG_CONFIG_PATH=/usr/local/Cellar/cairo/1.10.2/lib/pkgconfig/
PYTHON=PYTHON3

Here's what my WAF config looks like:

TeaMac:py2cairo itadmin$ ./waf configure
  ./options()
Setting top to                           : /Users/itadmin/Sites/py2cairo
Setting out to                           : /Users/itadmin/Sites/py2cairo/build_directory
  ./configure()
Checking for 'gcc' (c compiler)          : ok
Checking for program python              : PYTHON3
python executable 'PYTHON3' different from sys.executable '/usr/bin/python'
Checking for python version              : (3, 2, 1, 'final', 0)
Checking for library python3.2           : not found
Checking for library python3.2           : yes
Checking for program python3.2-config    : /usr/local/bin/python3.2-config
Checking for header Python.h             : yes
Checking for program pkg-config          : /usr/local/bin/pkg-config
Checking for 'cairo' >= 1.10.0           : yes
Configuration:
PREFIX                                   : /usr/local
LIBDIR                                   : /usr/local/lib
'configure' finished successfully (0.580s)

And here's the nastiness of the $ ./waf build step:

[random section of file where GCC errors start coming up...]
../src/surface.c: In function 'xlib_surface_get_depth':
../src/surface.c:1418: warning: return makes pointer from integer without a cast
../src/surface.c: In function 'xlib_surface_get_height':
../src/surface.c:1423: warning: return makes pointer from integer without a cast
../src/surface.c: In function 'xlib_surface_get_width':
../src/surface.c:1428: warning: return makes pointer from integer without a cast
../src/surface.c: At top level:
../src/surface.c:1441: warning: initialization makes integer from pointer without a cast
../src/surface.c:1459: warning: initialization makes pointer from integer without a cast
../src/surface.c:1467: warning: initialization from incompatible pointer type
../src/surface.c:1470: warning: initialization from incompatible pointer type
../src/surface.c:1477: warning: initialization from incompatible pointer type
lipo: can't figure out the architecture type of: /var/tmp//ccuzD4lS.out
lipo: can't figure out the architecture type of: /var/tmp//ccCSYwzk.out
Waf: Leaving directory `/Users/itadmin/Sites/py2cairo/build_directory'
Build failed
 -> task failed (exit status 1):
        {task 4312417936: c cairomodule.c -> cairomodule.c.1.o}
['/usr/bin/gcc', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-arch', 'i386', '-arch', 'x86_64', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-arch', 'i386', '-arch', 'x86_64', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-fno-strict-aliasing', '-fno-common', '-dynamic', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-arch', 'i386', '-arch', 'x86_64', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-fno-strict-aliasing', '-I/Users/itadmin/Sites/py2cairo/build_directory/src', '-I/Users/itadmin/Sites/py2cairo/src', '-I/usr/local/Cellar/cairo/1.10.2/include/cairo', '-I/usr/local/Cellar/pixman/0.22.0/include/pixman-1', '-I/usr/local/include/libpng15', '-I/usr/X11/include', '-I/usr/X11/include/freetype2', '-I/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m', '-DNDEBUG', '../src/cairomodule.c', '-c', '-o', 'src/cairomodule.c.1.o']
 -> task failed (exit status 1):
        {task 4312418384: c pattern.c -> pattern.c.1.o}
['/usr/bin/gcc', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-arch', 'i386', '-arch', 'x86_64', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-arch', 'i386', '-arch', 'x86_64', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-fno-strict-aliasing', '-fno-common', '-dynamic', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-arch', 'i386', '-arch', 'x86_64', '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk', '-fno-strict-aliasing', '-I/Users/itadmin/Sites/py2cairo/build_directory/src', '-I/Users/itadmin/Sites/py2cairo/src', '-I/usr/local/Cellar/cairo/1.10.2/include/cairo', '-I/usr/local/Cellar/pixman/0.22.0/include/pixman-1',
[GCC errors galore for 500 lines...]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

去了角落 2024-12-07 14:54:55

在以下位置找到了该问题的解决方案:
https://bugs.freedesktop.org/show_bug.cgi?id=37414

基本上,您可以通过修改“build_directory/c4che/_cache.py”文件来解决此问题。该问题源于 waf 尝试构建多个不同的 -arch 选项。快速修复 - 注释掉包含“-arch”的每一行,您的构建就会成功。

Found a solution for this issue on:
https://bugs.freedesktop.org/show_bug.cgi?id=37414

Basically, you can work around this by modifying the "build_directory/c4che/_cache.py" file. The problem stems from waf attempting to build for multiple different -arch options. The quick fix - comment out every line that contains '-arch', and your build will succeed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文