Thursday, August 26, 2010

Compiling boost C++ development libraries in OSX

Compiling boost c++ libraries and development headers for Mac OSX



Hi Everyone,

So I am starting to play with OpenCL. And as you all know I do love python. I have been playing with pyOpenCL package for awhile and wanted to get it set up on my Mac using OSX.

It depends on an installation of Boost C++ Libraries http://www.boost.org/

first we set up a directory, and in a terminal we need to download the boost files:


wget http://downloads.sourceforge.net/project/boost/boost/1.44.0/boost_1_44_0.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F1.44.0%2F

bzip2 -d boost_1_44_0.tar.bz2

tar -xvf boost_1_44_0.tar

cd boost_1_44_0


Configuration and Compilation



Great now we have extracted it, lets attempt to configure, compile, and install this package. Since I have build many applications on my MacOSX, I already have lots of build tools/libraries installed (eg. gcc, xorg, wine).

I was able to compile by typing at the console:


sh bootstrap.sh

./bjam


And then I waited... Its a shame there is no configure and make so I could use "make -j 4" and utilize all 4 of my cores for compiling. Maybe bjam has that option, I am not sure and too lazy to look into the documentation. Also I believe that is a bit out of the scope of this post for now.

After waiting for it to finish, we install the libraries by typing


sudo ./bjam install


And then we wait some more...

Finally after it is installed we can continue to try and install pyOpenCL.

Note: openCL unfortunately is not supported on my mac (Mac OS X 10.5.8 Leopard) and no amount of wishing will make it so :( However hopefully you are able to install this package (pyOpenCL) using Linux or Windows, or even Snow Leopard. Good luck!