I am in a different position with respect to this fix. I had installed cmake 2.8.2_3 before the Apple Java update. After the Apple Java update, the cmake upgrade from 2.8.2_3 to 2.8.2_4 failed saying that I needed to install Java from Apple, which was already installed. As far as I can tell, the Apple update to Java 1.6.0_22 did not properly update the header path. In the updated version the header path leads to a dead end. I was able to fix this by doing the following.
1) Create directory
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Headers
2) Copy entire contents of directory
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Headers
to directory
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Headers
After this fix the upgrade to cmake 2.8.2_4 worked. However, if the macports cmake could be made to look for the Java headers in /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Headers this would resolve an existing problem.
From: https://trac.macports.org/ticket/26934
5. 最终大戏来了,安装OpenCV: http://sunny.in.th/2010/04/27/installing-opencv-21-on-snow-leopard.html
Installing OpenCV 2.1 on Snow Leopard has become quite easy at least easier than 2.0. Version 2.1 can now be compiled as 64-bit library.
Before version 2.1 OpenCV used Carbon which is the old GUI interface for Mac OS. Carbon supports only 32-bit and has been deprecated by Apple. The new GUI interface for Mac OS is Cocoa. With Snow Leopard being a 64-bit kernel it would be nice if we could compile OpenCV as a 64-bit library and not not 32-bit just because of Carbon. Thanks to the OpenCV team they have added Cocoa support in version 2.1.
To install OpenCV check out the code from the svn repository and compile it.
$ svn co https://code.ros.org/svn/opencv/trunk/opencv
$ cd opencv
$ mkdir build
$ cd build
$ cmake ..
Configure the make by
If you want you can build the samples as well.
Press c
to configure, followed by g
to generate. Next build and install OpenCV by
$ make -j8
$ sudo make install
That’s it!!! Simple right.
If you want to use Python with OpenCV there’s a little more that needs to be done. By default OpenCV copies the shared object file required by the Python interface to /usr/local/lib/python2.6/site-packages/cv.so
which is not under Python path. Add the following line to your .bashrc
or .bash_profile
PYTHONPATH=/usr/local/lib/python2.6/site-packages/cv.so:$PYTHONPATH
Trying running some C
samples which are in /usr/local/share/opencv/samples/c/
. The Python samples at/usr/local/share/opencv/samples/python/
doesn’t work since they are based on the old SWIG-Python interface. Try running the sample Python code which is in the opencv
directory that was checked out from subversion. It’s insidesamples/python
.