OpenCV 2.0 and Boost library in Snow Leopard

Since I installed Snow Leopard on my macbook I started having compilation problems. The reason is that my code depends on a couple of external libraries, namely OpenCV and Boost serialization, and these were broken.

Today, I finally managed to solve the problems, by following some hints I found in different websites.
First, I installed OpenCV 2.0 (which should be quite cool because it has cleaner and compact notation for matrix computations, among other things). For this I basically followed the recommendations at:
For the small programs that only depended on OpenCV, things started to work again. But other pieces of code I am writing also use Boost serialization library, in order to save and load complex objects to disk.
Compilation was working, but linking was failing. Basically, the problem was that the libraries had been compiled for different architectures. My OpenCV library was built for “i686″, whereas my Boost library was built for x84_64 architectures. I had installed Boost using macports, which for Mac OS X 10.6, builds using x86_64 if the CPU supports it, or i386 otherwise.
You can change this at the macports.conf file by uncommenting the line:
#build_arch i386
In my case, I actually changed it to i686, because I don’t care too much about compatibility with older platforms.
build_arch i686
After that:

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current month ye@r day *