macos 文件是为 i386 构建的,这不是在 Mac OSX 10.6 上为 iOS 4.2 编译 OpenCV2.2 时链接的架构 (x86_64)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5220435/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
file was built for i386 which is not the architecture being linked (x86_64) while compiling OpenCV2.2 for iOS 4.2 on Mac OSX 10.6
提问by LeonardChallis
I have been following the simple guide at http://www.atinfinity.info/wiki/index.php?OpenCV/Using%20OpenCV%202.2%20on%20iOS%20SDK%204.2(which uses the older guide I've also read at http://niw.at/articles/2009/03/14/using-opencv-on-iphone/en) to get OpenCV2.2 compiled to work on iOS 4.2. Everything went smoothly until I tried to build. When I run the following:
我一直在遵循http://www.atinfinity.info/wiki/index.php?OpenCV/Using%20OpenCV%202.2%20on%20iOS%20SDK%204.2 上的简单指南(它使用我也阅读过的旧指南在http://niw.at/articles/2009/03/14/using-opencv-on-iphone/en) 编译 OpenCV2.2 以在 iOS 4.2 上工作。一切都很顺利,直到我尝试构建。当我运行以下命令时:
lc:opencv_simulator leonard$ ../opencv_cmake.sh Simulator ../../OpenCV-2.2.0/
I get the following error:
我收到以下错误:
ld: warning: in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libSystem.dylib,
file was built for i386 which is not the architecture being linked (x86_64)
This is using (among other settings, obviously):
这是使用(在其他设置中,显然):
-D CMAKE_OSX_ARCHITECTURES="i386"
I read that on OSX 10.6 i386 is seen as the default, so it uses the system default (but that is x86_64). I also read I could use:
我在 OSX 10.6 上读到 i386 被视为默认值,因此它使用系统默认值(但这是 x86_64)。我还阅读了我可以使用的内容:
export CFLAGS=-m32
export CPPFLAGS=-m32
But this doesn't work either.
但这也行不通。
Any ideas?
有任何想法吗?
采纳答案by JeremyP
The gcc flag for building a specific architecture is -march
as in
用于构建特定架构的 gcc 标志-march
如
gcc -march=i386 ...