Integrating Python and Threading Building Blocks, Part 3

By Kevin Farnham (108 posts) on January 28, 2008 at 9:30 am

Continuing my effort to create an application that has a Python GUI and a back-end C++ computation engine that is threaded using Threading Building Blocks, I followed the instructions in the "Boost.Python Build and Test HOWTO" about how to relocate my Boost.Python "quickstart" application, so I can modify it as I'd like. The relocation involves copying the entire libs\python\example\quickstart directory to a new location, and modifying the boost-build.jam and Jamroot files appropriately. See Part 2 of this blog series for reference.

To keep things simple and orderly, I created a C:\python_tbb directory and copied the quickstart directory tree from my Boost location into my new directory. In boost-build.jam, the path identified as boost-build must be edited to point to the tools\build\v2 location beneath where you installed boost. So, in my case, my new boost-build.jam file boost-build line becomes:

boost-build "C:\Program Files\boost\boost_1_34_1\tools\build\v2" ;

I put the quotes around the path and switched to backslashes to identify the location using standard Windows notation.

In the Jamroot file, you need to identify the location of your specific boost version. So, in my case (having installed Boost Version 1.34.1 in directory C:\Program Files\boost\boost_1_34_1), my new Jamroot path identification section becomes:

# Specify the path to the Boost project. If you move this project,
# adjust the path to refer to the Boost root directory.
use-project boost
  : "C:\Program Files\boost\boost_1_34_1" ;

user-config.jam: Configuring Boost.Python

At this point, the HOWTO instructions seem a little unclear to me. Many possibilities are mentioned, but I'm not certain which are actually required if your initial objective is simply to run the quickstart example from its new location. One clear point, though, is that I need to make sure I have a user-config.jam file that contains the correct information for configuring Boost.Python. On Unix/Linux systems, the Boost.Python install typically creates this file in the user's home directory. Doing a search on my Windows system, I found user-config.jam files within my Boost installation directory structure, in the tools\release and the tools\build\v2 directories. A quick look showed me that the files are not identical: the one in tools\build\v2 consists almost entirely of comments, while the one in tools\release has several non-comment entries. So, I decided to add the suggested python-related line to the tools\release\user-config.jam file:

import toolset : using ;
using python ;

Farther down in the HOWTO I saw instructions on how to find your home directory on a Windows system: in a command prompt, execute:

ECHO %HOMEDRIVE%%HOMEPATH%

which, in my case, returns:

C:\Documents and Settings\Kevin

So, I copied my edited user-config.jam file into that directory as well.

Ready to run?

Having reached the end of the "Boost.Python Build and Test HOWTO", I clicked into the Boost.Python Tutorial, hoping I'd configured everything properly and was ready to run my relocated quickstart application and move on to creating my own Python/C++ applications.

The tutorial starts with a simple "Hello World" application. This example is included in the libs\python\example\tutorial directory beneath your Boost installation location. My goal, however, is to be able to build and run my Python/C++ application beneath my new C:\python_tbb directory. So I copied the tutorial directory into C:\python_tbb and began working through the tutorial from that location.

Once again, this post has gotten lengthy. I think I'm getting there! I'll write about my further work on the Boost.Python tutorial in my next post.

Kevin Farnham, O'Reilly Media, TBB Open Source Community, Freenode IRC #tbb, TBB Mailing Lists

Download TBB

Categories: Multicore, Open Source, Threading Building Blocks

Comments (4) Comments RSS Feed

By Ray Zed Blog on January 28th, 2008 at 5:54 pm
links from Technoratitcduncan: Continuing my effort to create an application that has a Python GUI and a back-end C++ computation engine that is threaded using Threading Building Blocks, I followed the instructions in the “Boost.Python Build and Test HOWTO

By Software - Information about Software on January 28th, 2008 at 6:11 pm
links from TechnoratiSreelekshmy Syamalakumari (Intel)wrote an interesting post today on Here’s a quick excerpt Continuing my effort to create an application that has a Python GUI and a back-end C++ computation engine that is threaded using Threading Building Blocks, I followed the instructions in the

By Page is loading, please wait! on January 28th, 2008 at 6:49 pm
links from TechnoratiIntegrating Python and Threading Building Blocks, Part 3 January 28th, 2008 at 11:30am Under UncategorizedSreelekshmy Syamalakumari (Intel)wrote an interesting post today on Here’s a quick excerpt Continuing my effort to create an application that has a Python GUI and a back-end C++ computation engine that is threaded using Threading Building Blocks, I followed the instructions in the

By Блоги Intel® Software Network » Top 5 ISN Blogs в январе on January 29th, 2008 at 1:37 pm
[...] Boost.Python как обертку для C++ библиотек. Во второй и третьей частях автор продолжает экспериментировать с Boost.Python, [...]


What do you think?

Name (required)

Email (required; will not be displayed on this page)

Your URL (optional)

Comments (required)