Using Intel Threading Building Blocks in a C++ Xcode Project under Mac OS X

18 11 2009

This tutorial should explain briefly how to include and use the Intel Threading Building Blocks (TBB) in a C++ Xcode Project in OSX. Intel has put together an excellent tutorial that explains the basics, but it assumes that you have the libraries already included in your project.

1) Download the source code from a stable TBB release (e.g. tbb22_20090809oss_src.tgz).

2) Unpack it and run “make”.

3) Create a new project in Xcode, e.g. Command Line Tool from type C++ stdc++. The project in this example is called “tbbWorkbench”.

4) Open Finder and copy the tbb folder into your project’s folder:

5) Go back into Xcode and link the libraries “libtbb.dylib” and “libtbbmalloc.dylib” from the tbb22_20090809oss/build/macos_intel64_gcc_cc4.2.1_os10.6.2_release/ folder that is inside your project folder to your target.

6) Add the “Header Search Path” (tbb22_20090809oss/include) and make sure that you always search user paths.

7) Now, add a “New Copy Files Build Phase” where you copy the both TBB .dylib files to your “Products Directory”. This is needed as otherwise the libraries won’t be found during runtime and you’ll face a “Error from Debugger: Cannot access memory at address 0x0”.

8 ) As a final step, you can now e.g. insert the first sample code from the Intel Tutorial and you’re ready to go ! 🙂

– Christian

Advertisements