Yesterday I successfully built and tested Threading Building Blocks on my AMD Athlon 64 X2 system, running Gentoo Linux. I had switched to that machine after having some problems with building TBB on my Intel quad-core processor machine (which is running Windows XP).
I had experimented with both the UWIN and Cygwin Unix/Linux emulators (see my "Preparing Your Windows System for OS TBB Development" Part 1 and Part 2 posts). A major snag emerged as I followed the TBB build instruction that specifies the need for GNU make and a Bourne or BASH shell. Vladimir Polin has posted comments to my "Preparing Your Windows System" blogs, saying that a Unix/Linux shell shouldn't be needed to build Threading Building Blocks on Windows. It looks to me like he is correct -- though the TBB installation method I'm about to describe does use a Cygwin installation.
Getting GNU Make onto Windows
Vladimir pointed out that when you download and uncompress the GNU make source, there is a batch file named build_w32.bat that can be run from a Windows Command Prompt (cmd.exe) window. I was able to get this to work, and gnumake.exe files were created in the WinRel and WinDebug subdirectories. However, any time I tried to run gnumake.exe from my TBB directory, a win32 exception occurred in the gnumake.exe execution. I tried the debug version of gnumake.exe, and saw a nice trail of calls -- but nothing stood out. A search for gnumake.exe throwing an exception turned up some links, but no solution.
But my objective was to build TBB, not debug my gnumake.exe problem. In "Preparing Your Windows System for OS TBB Development, Part 2" I documented the process by which I had installed Cygwin with GNU make being an included package. So, I decided to try using the Cygwin make. Within Cygwin's environment, make is found in the /usr/bin directory (enter
which make at the Cygwin prompt to see this). Within the Windows environment, the Cygwin make.exe file is located in the bin directory beneath your Cygwin installation directory. In my case, Cygwin's make.exe is located in Windows directory
C:\cygwin\bin. This instance of GNU make worked when I applied it to my TBB download!
Building TBB within a Visual Studio Command Prompt
I'm sure that a standard Windows Command Prompt can be used to build TBB; but I chose to launch the Command Prompt from within Visual Studio 2005 (Tools -> Visual Studio 2005 Command Prompt). This way you have all the environment variables (especially PATH) set to enable invocation of the VS command line compiler (cl) and the linker, etc.
So, in my Visual Studio 2005 Command Prompt, I navigated to the top level directory of my unpacked TBB download. I'm working with the Commercial Aligned Release, version tbb20_010oss. In that top level directory, I entered the command to execute my Cygwin-installed GNU make:
The build proceeded, successfully running all the test programs as well. Just as had happened when I built TBB on my Gentoo Linux system!
A Look at the TBB build Directory
The build actually happens within the TBB build subdirectory. During my earlier, unsuccessful attempts to build TBB, a subdirectory named
windows_unknown_cl_unknown_release had been created -- suggesting to me that I had a problem with my environment. That was one of the things that led me to trying my build using the Visual Studio Command Prompt.
After my successful TBB build, I had two new directories beneath
The release directory has three DLLs (tbb.dll, tbbmalloc.dll, and test_model_plugin.dll); the debug directory has debug equivalents. Then, each directory contains all the TBB test executables (31 programs in all), and all the object and other files that were part of the build process. There are also *.bat, *.sh, and *.csh versions of the tbbvars file. These files set environment variables used during the build process.
I've now built and tested the open source version of Threading Building Blocks 2.0 on my Intel quad-core Windows XP system. A mysterious problem with building an executable GNU make necessitated a work-around: using the GNU make binary file that is installed as a Cygwin package. The actual build of TBB was performed in a Visual Studio 2005 Command Prompt, by executing the Cygwin GNU make executable.