32-bit OpenCV on OS X Lion? Possible?

混江龙づ霸主 提交于 2019-11-30 15:47:44

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 :)

I ve had a hard time configuring OpenCv libraries on a number od different OSs. Turns out that the thing is auto-generating a sample project and then bulding business logic inside it.

See the installation instructions here

The web site of the OpenCV project has been significantly upgraded in the last year. A new tutorial section is avaiable, i was able to install OpenCV on my 32-bit core Mac OS Lion.

A very cool tutorial is also available at Sadeep's Tech Blog, covering an interesting range of details.

Hope this helps!

Here's something you can try: download OpenCV 2.4 sources and edit the CMakeLists.txt in the root directory. Around line 242 you will see:

# ----------------------------------------------------------------------------
#  Path for build/platform -specific headers
# ----------------------------------------------------------------------------
set(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h")
add_definitions(-DHAVE_CVCONFIG_H)
ocv_include_directories(${OPENCV_CONFIG_FILE_INCLUDE_DIR})

below the add_definitions() call, add this one:

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