Archive for the ‘Mac’ Category.

Solving linker errors OpenThreads/Atomic on OSG projects on Mac OS X 10.6

I’ve just spent two days trying to figure out what was wrong with an OSG application I was not being able to build on Mac OS X 10.6. After importing all necessary OSG frameworks, I kept constantly getting linker errors saying the symbols OpenThreads::Atomic::operator--() and OpenThreads::Atomic::operator--() couldn’t be found.

It turns out it was a binary compatilbility issue. I built the 32-bit Debug Carbon configuration of OSG 2.8.3 from the Xcode project files that come in the source distribution (not the ones generated by CMake). The problem is that the Deployment Target is set to Mac OS X 10.4 in that project:

screen-shot-2010-06-11-at-120254-am

As far as I know, there’s no binary compatibility with libraries targeted at Mac OS X 10.4 or older starting with SDK 10.5. So, I was trying to build an application using the 10.6 SDK, but linking it to libraries built for Mac OS X 10.4.

Therefore, the solution was very simple (took me 2 days to find it, however). I just had to change the Deployment Target in the OSG Xcode project settings to 10.5 and rebuild it:

screen-shot-2010-06-11-at-120320-am

I first changed the Deployment Target to 10.6, but I wasn’t able to build OSG then. So I changed it to 10.5. I didn’t take the time to figure out what was wrong when targeting at 10.6, though.

Building OpenCV 2.0 on Mac OS X 10.6

I first tried it this way:


$ cd OpenCV-2.0.0
$ mkdir build
$ cd build
$ cmake ..
$ make

But it failed. I got lots of errors when trying to link highgui to the Carbon libraries. The problem is that Carbon is 32-bit only, and by default OpenCV was being built for 64-bit.

Here the (very simple) solution to that:


$ CFLAGS="-arch i386" CXXFLAGS="-arch i386" cmake ..
$ make