OS X Lion 上的 32 位 OpenCV?可能的? [英] 32-bit OpenCV on OS X Lion? Possible?
问题描述
我已经用谷歌搜索并尝试了好几天,试图弄清楚如何让 32 位 OpenCV 在 OS X Lion 上运行,但只能找到 64 位版本.
所以我有以下问题:
OpenCV 库有 32 位或 64 位架构,对吗?
如何让 32 位 OpenCV 在 Lion 上运行?我尝试了以下方法:- 通过 MacPorts 安装 OpenCV:不,MacPorts 安装 64 位版本.BI 删除了 OpenCV 和 MacPorts.
- 通过 Homebrew 安装 OpenCV 2.4.1,使用以下命令:
brew install opencv --build32
但看起来它们也是 64 位的.删除了 OpenCV 和 Homebrew.
- 我自己使用标准的 unix makefile 安装 OpenCV 2.4.1.不,它们看起来仍然像 64 位.
我写了它们看起来像 64 位",因为我必须在 OS X Snow Leopard 下制作的 Xcode 项目中替换 OpenC,针对 32 位 Mac,我总是收到大量错误,例如:>
ld: 警告:忽略文件/usr/local/Cellar/opencv/2.4.1/lib/libopencv_calib3d.2.4.1.dylib,文件是为不受支持的文件格式构建的,这不是所链接的架构 (i386)
所以我想 OpenCV 的东西是 64 位的.如果我强制项目以 64 位运行,它会摩擦但无法正常工作并卡住.
是否有标准的方法来检查我的 OpenCV 库是 64 位还是 32 位?
从哪里可以获得 32 位 OpenCV?
解决了问题.
总结:在 64 位 Mac OSX Lion 上可以有 32 位 OpenCV 库.
怎么样?
第一步:下载 OpenCV 2.4.0
第 2 步:下载并安装 CMake.
第 3 步:解压 OpenCV 包.
第 4 步:在 OpenCV 包内创建一个单独的目录用于构建
mkdir 构建光盘构建cmake -G "Unix Makefiles" -D CMAKE_OSX_ARCHITECTURES=i386 -D CMAKE_C_FLAGS=-m32 -D CMAKE_CXX_FLAGS=-m32 ..
(这将强制进行 32 位编译)
make -j8须藤制作安装
第 5 步:享受!
如需更多参考,请访问 Mac OS X OpenCV 端口页面
感谢大家让我走上正轨:
@karlphilip:我试着按照你的建议去做,但是没有 make 选项编译阶段会失败,因为架构不连贯.
@hamstergene:MacPorts 在新安装后卡住了,也许我还有一些旧安装的残留 :((奇怪,我按照官方说明删除了它).
@Adrien:这就是我所做的,但我不得不合并两种方法:)
I've been googling and trying for days now, trying to figure out how to get 32-bit OpenCV working on OS X Lion, but can just find 64-bit version.
So i have the following questions:
OpenCV libraries come in 32-bit or 64-bit arch, is that correct?
How do I get 32-bit OpenCV working on Lion? I've trying the following ways: - Install OpenCV via MacPorts: nope, MacPorts installs a 64-bit version.BI removed OpenCV and MacPorts.
- Install OpenCV 2.4.1 via Homebrew, using the following command:
brew install opencv --build32
but looks like they are 64-bit too. Removed OpenCV and Homebrew.
- Install OpenCV 2.4.1 by myself using standard unix makefiles. Nope, they still look like 64-bit.
I've written "they look like 64-bit" because i have to replace OpenC in a Xcode project made under OS X Snow Leopard, targeted for 32-bit Mac, and I always get tons of errors like:
ld: warning: ignoring file /usr/local/Cellar/opencv/2.4.1/lib/libopencv_calib3d.2.4.1.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
so i suppose that the OpenCV stuff is 64-bit. If i force the project to run in 64-bit, it rubs but doesn't work properly and gets stuck.
Is there a standard way to check if my OpenCV libraries are 64-bit or 32-bit?
Where can i get 32-bit OpenCV?
Solved the problem.
Recap: it is possible to have 32-bit OpenCV libraries on 64-bit Mac OSX Lion.
How?
Step 1: Download OpenCV 2.4.0
Step 2: Download and install CMake.
Step 3: Untar the OpenCV package.
Step 4: Make a separate directory inside the OpenCV package for building
mkdir build
cd build
cmake -G "Unix Makefiles" -D CMAKE_OSX_ARCHITECTURES=i386 -D CMAKE_C_FLAGS=-m32 -D CMAKE_CXX_FLAGS=-m32 ..
(this will force the 32-bit compile)
make -j8
sudo make install
Step 5: Enjoy!
For forther reference please visit Mac OS X OpenCV Port Page
Thanks all for putting me on the right track:
@karlphilip: I tried to do as you suggested, but without the make options the compile phase fails, because the architectures are incoherent.
@hamstergene: MacPorts got stuck after the new installation, maybe I have some remains of the older install :( (strange, i followed the official instrusctions to remove it).
@Adrien: That's what I've done, but i had to merge 2 approaches :)
这篇关于OS X Lion 上的 32 位 OpenCV?可能的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!