4

在 OS X 10.5 (intel) 上构建 OpenCV 时出现以下错误:

ld: warning in .libs/_cv_la-_cv.o, file is not of required architecture
ld: warning in .libs/_cv_la-error.o, file is not of required architecture
ld: warning in .libs/_cv_la-pyhelpers.o, file is not of required architecture
ld: warning in .libs/_cv_la-cvshadow.o, file is not of required architecture
ld: warning in ../../../cv/src/.libs/libcv.dylib, file is not of required architecture
ld: warning in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libcxcore.dylib, file is not of required architecture
Undefined symbols for architecture i386:
"_fputs$UNIX2003", referenced from:
  _PySwigObject_print in _cv_la-_cv.o
  _PySwigPacked_print in _cv_la-_cv.o
  _PySwigPacked_print in _cv_la-_cv.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/Sr/Srq9N4R8Hr82xeFvW3o-uk+++TI/-Tmp-//cchT0WVX.out (No such file or directory)
make[4]: *** [_cv.la] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

运行 ./configure --without-python 时一切正常。另一个奇怪的是,当我使用 Python 2.4.5 或 2.5.1 时一切都构建好了,切换到 Python Framework 2.5.2 后出现问题

4

3 回答 3

1

在链接时寻找 /Developer/SDKs/MacOSX10.4u.sdk 时警告不同架构似乎有点奇怪 - 你能给我们一些关于你的构建环境的更多细节(XCode,GCC,Python,$PATH 的版本ETC)

或者,任何可用的 OpenCV 二进制文件都不适合您吗?

于 2008-11-26T10:29:09.330 回答
0

/Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib 只是删除导致我收到警告的文件后指向 /usr/local/lib 的链接:

ld: warning in .libs/_cv_la-_cv.o, file is not of required architecture
ld: warning in .libs/_cv_la-error.o, file is not of required architecture
ld: warning in .libs/_cv_la-pyhelpers.o, file is not of required architecture
ld: warning in .libs/_cv_la-cvshadow.o, file is not of required architecture
ld: warning in ../../../cv/src/.libs/libcv.dylib, file is not of required architecture
ld: warning in /Users/Pietras/opencv/cxcore/src/.libs/libcxcore.dylib, file is not of required architecture
Undefined symbols for architecture i386: ... `

这些文件是由 make 创建的。

gcc:i686-apple-darwin9-gcc-4.0.1

$路径:

/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/sw/bin:/sw/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/AVRMacPack/bin:/usr/X11R6/bin

XCode 3(最新)

Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) - 来自 python.org 的 MacPython(试图降级并使用它而不是 2.5.2,但这不再起作用了......)

which python
/Library/Frameworks/Python.framework/Versions/Current/bin/python

我没有找到任何适用于 OS X 的 Python OpenCV 二进制文件。我尝试将 macports 中的 python2.4 或 2.5 设置为默认值并编译和安装,但是当我尝试导入时出现总线错误或致命错误Python 错误解释器未初始化(版本不匹配?)并退出。

于 2008-11-26T17:42:00.283 回答
0

好的,我有点解决了

它需要使用来自 macports 或其他任何东西的 python 编译。然后我需要运行/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5(这是我以前的 python 版本)并且 OpenCV 可以正常工作。

于 2008-11-26T20:37:14.033 回答