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

About these ads

Actions

Information

8 responses

23 11 2009
Using-Intel-Threading-Building-Blocks-in-a-C-Xcode-Project-under-Mac-OS-X : Sysmaya

[...] http://punchcard.wordpress.com/…building-blocks-in-a-c-xcode-project-under-mac-os-x/ [...]

6 12 2009
Berker

Thanks man everything is great except from step 7 I cant figure out what to do I’m getting that error over and over again. If you could help me about that part I will be very happy

Thanks

13 12 2009
tinnefeld

You basically have to make sure that the TBB dylibs (libtbb.dylib and libtbbmalloc.dylib) are available in your output/debug directory. Therefore, you set up a post-build copy command that copies both files into the same directory where you have the binary file from your program. For starters: try to copy the previously mentioned files into that directory by hand and then run the program.

7 03 2011
Mohsen Mesgarpour

Hi there,

I am trying to set eclipse – Mac OS version – to use TBB and Intel C++ Compiler with no luck. The only instruction I have found is this. I appreciate if you help me out.

Cheers

*Currently, I do parallel programming in Xcode.
*Probably MS Visual Studio is the best IDE for c++ parallel programming).

7 03 2011
20 12 2011
ipaddr

not work for xcode 3.0

20 12 2011
ipaddr

work fine know ^_^

20 12 2011
ipaddr

*now

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.

%d bloggers like this: