Oliver Nassar

Getting openFrameworks to work on OSX (command-line based)

May 08, 2011

Note I couldn't get the following working. I get all the way to the end and run into the following:

CMake Error at /Users/onassar/Temp/openFrameworks/cmake/OpenFrameworks.cmake:198
(message):
    Cannot find quicktime library
Call Stack (most recent call first):
    CMakeLists.txt:8 (include)
-- Configuring incomplete, errors occurred!

I tried using macports to install libquicktime to no avail. I hope someone see's this and might be able to help out. In the meantime, I'll try and debug and update if I find anything. Alternatively, I may look into the following guide which seems a little more streamlined: http://www.quietless.com/kitchen/getting-started-with-openframeworks/

Installation

I decided to log my dev-flow while trying to get openFrameworks installed on OSX (Snow Leopard). Despite the fact that I'm following a tutorial entitled Getting started with openFrameworks on OS X, I thought it'd make sense as I ran into a few hiccups with it already.

Disclaimer I'm running an x86_64 setup, not an i386 one. This is why I've decided to write this one despite the fact that it's based off the one linkde to above. I'll be repeating a bunch of steps there to make this install process easy to follow without back-and-forth:

Directory Dependencies

sudo mkdir -p /usr/local/include
sudo mkdir -p /opt/local/lib

Installing RtAudio

RtAudio is a Microsoft speech-codec. While the guide above lists version 4.0.6 available, 4.0.8 is accessible via their site. Download whichever you prefer (I used 4.0.6 to remain consistent with the original documentation), and run the following from inside the unzipped and untarred directory:

./configure
make CFLAGS=-m32
sudo cp librtaudio.a /usr/local/lib
sudo cp RtAudio.hRtError.h /usr/local/include

Installing Poco

Poco are a set of libraries and frameworks that allow for network based C++ applications to be run on the desktop. I downloaded the OSX Basic Edition and followed the following directions.

Unzip/tar the downloaded package, and from within the directory, edit the file:

./build/config/Darwin

Change the CXXFlags value to the following:

CXXFLAGS = -Wall -Wno-sign-compare -m32

Then to compile Poco, run the following:

./configure --no-tests --no-samples Darwin
export POCO_BASE=$PWD

for i in CppUnit Foundation XML Net Util; do
    (cd $i ; make static_release)
done

This will run for a while.

Now lets install poco:

for i in Foundation XML Net Util; do
    sudo cp -rf $i/include/* /usr/local/include/
done

This is where a slight divergence from the tutorial originally found takes place. Lib files are said to be copied with the following:

sudo cp lib/Darwin/i386/lib*.a /usr/local/lib

This wouldn't run though, as the OSX I'm running isn't an i386 chipset, but rather x86_64; therefore, run the following:

sudo cp lib/Darwin/x86_64/lib*.a /usr/local/lib

Installing FreeImage

FreeImage is an image library for the more popular image file-types (eg. PNG, BMP, etc.). Download it, unzip it. This is where another divergence from the original openFrameworks tutorial takes place. It lists changing some of the values of the Makefile.osx file. The problem is the tutorial was written, presumably, making use of an i386 chip. Following the tutorial results in the following errors when trying to make the file:

Undefined symbols:
    "_fopen$UNIX2003", referenced from:
    _FreeImage_GetFileType in GetType.o-ppc
    _FreeImage_Load in Plugin.o-ppc
    _FreeImage_Save in Plugin.o-ppc
    CacheFile::open()in CacheFile.o-ppc
    _FreeImage_OpenMultiBitmap in MultiPage.o-ppc
    _FreeImage_CloseMultiBitmap in MultiPage.o-ppc
    LosslessTransform(tagFilenameIO const*, FREE_IMAGE_JPEG_OPERATION, char
const*, int)in JPEGTransform.o-ppc
    LosslessTransform(tagFilenameIO const*, FREE_IMAGE_JPEG_OPERATION, char
const*, int)in JPEGTransform.o-ppc
    LibRaw::bad_pixels(char const*)in dcraw_fileio.o-ppc
    LibRaw::subtract(char const*)in dcraw_fileio.o-ppc
    LibRaw::dcraw_thumb_writer(char const*)in libraw_cxx.o-ppc
    LibRaw::dcraw_ppm_tiff_writer(char const*)in libraw_cxx.o-ppc
    LibRaw_bigfile_datastream::subfile_open(char const*)in libraw_cxx.o-ppc
    LibRaw_bigfile_datastream::LibRaw_bigfile_datastream(char const*)in
libraw_cxx.o-ppc
ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make[1]: *** [libfreeimage-3.15.0.dylib-ppc] Error 1
    make: *** [default] Error 2

I was able to find a sample Makefile.osx file that worked well for compiling here: https://gist.github.com/181015
I simply copy-and-pasted the file into my Makefile.osx file and ran:

make
sudo cp Source/FreeImage.h /usr/local/include/
sudo cp libfreeimage.a /usr/local/lib/libFreeImage.a

Installing fmodx

fmod is an audio-library that is able to process many different audio-types. Download the OSX installer. No manual-compiling required here. Simply download the dmg, (I downloaded and installed the stable 4.34.02 version), install it via the DMG, and then run the following:

cd /Developer/FMOD Programmers API Mac/
sudo cp api/inc/* /usr/local/include
sudo cp api/lib/* /usr/local/lib

Installing GLee

GLee is a cross-platform OpenGL extension loading library. To install it, download the latest (I was able to grab 5.4.0 at the time of writing this).

Before unzipping and tarring it, make the temporary directory GLee somewhere as the file's aren't nicely layered inside their own folder and they'll dirty it up if you don't do so. So try the following from within the zip-file location:

mkdir GLee
cd GLee
tar zxvf ../GLee-5.4.0-src.tar.gz
./configure CXXFLAGS="-m32 -framework CoreFoundation -framework OpenGL"
make
sudo cp GLee.h /usr/local/include
sudo cp libGLee.so /usr/local/lib

Installing git

Obviously you can skip this step if you already have git installed on your OSX, but if not, grab the latest git for OSX (x86_64 version since that's what this tutorial is for).

This is a DMG, so install it like you would a normal DMG.
That's it. When you restart your terminal, git will be available via command-line.

Installing cmake

Macports provides a port of the cmake app. cmake provides a cross-platform way to define a build process/flow, which you need to install with the following:

sudo port install cmake

Installing openFrameworks

Finally.. openFrameworks installation! Let's do this:

git clone git://github.com/dopuskh3/openFrameworks.git
cd openFrameworks
cmake libs/openFrameworks -DCMAKE_CXX_FLAGS=-m32
-DCMAKE_INSTALL_PREFIX=/usr/local
make
sudo make install

As mentioned above, when trying to cmake the binary, I get the following:

CMake Error at /Users/onassar/Temp/openFrameworks/cmake/OpenFrameworks.cmake:198
(message):
    Cannot find quicktime library
Call Stack (most recent call first):
    CMakeLists.txt:8 (include)
-- Configuring incomplete, errors occurred!

I'll update when I find out how to fix this.