Monday, March 31, 2008

Building Boost 1.35.0

Seems I always have troubles building Boost.

To start I followed the big 'Get Boost' button on the right side of; thinking, 'That sure is obvious'. That link takes you to a download page with boost version 1.35.0 right at the top. It shows the new libs with 'Detail' and 'Download'. I took a few seconds to read the new libs section and clicked on download. This took me to where they have the source code only release. Well, I knew that Boost Consulting has maintained an installer for Windows assuming you are using boost with Visual Studio. So I jumped over to their boost installer site, only to find that they don't have one yet for 1.35.0.

No problem, I'll just go back and grab the source code from and follow the instructions in the getting started document. I kicked off the download and started looking for the getting started document. After a while, I figure I must be crazy, because I can't find it. I finally do a google search in order to find it. Still thinking I must have just missed it, I went back and followed every link on the right of the the main boost site. It is not under 'Introduction' or any other of the sections. I finally did locate it, it is on the main page on the left under 'GETTING STARTED'. Funny how you can look right past something like that.

So now I figure all I have to do is follow the getting started guide to build boost.

Step 1. Get Boost. I already did that. My download had already completed from I unziped it (actually un-7zed it) to c:\boost\boost_1_35_0\.

Step 2. Explain Boost Distribution. Ok, nothing new here.

Step 3. Header only libs. Right, header only libs are nice. Just compile and go. However, Boost.Thread among others need to be compiled.

Step 4. Build with a header only lib. Been there done that many times. There are sub-steps for building with Visual Studio. I always use MPC, so this is not useful to me. I plan to create a separate post or two about building boost applications with MPC. When you see how easy it is to use MPC with Boost, I doubt that you will use anything else.

Step 5. Building Boost libraries. Alright, here we go.

Step 5.1. Install Boost libraries. Yeah, thats what I wanted to do to start with. However, Boost Consulting has not yet put out an installer for 1.35.0.

Step 5.2. Build from source.

Step 5.2.1. Get bjam. I put the executable in c:\boost\boost_1_35_0\.

Step 5.2.2. Identify toolset. I want: msvc.

Step 5.2.3. Select a build directory. It says this is not necessary.

Step 5.2.4. Invoke bjam. This is where I got in trouble. I tried various combinations of commands/arguments to bjam. I must have tried to build 3-4 times. Finally I settled on the following after looking at bjam --help.
cd c:\boost\boost_1_35_0
bjam --build-type=complete --prefix="c:\boost\boost_1_35_0" install
Seems like I should have included --toolset=msvc, but I forgot and it picked msvc-8.0 anyway.

This worked for me creating a c:\boost\boost_1_35_0\lib directory as the rest of the getting started document assumes. Actually the getting started doc has it under C:\Program Files\boost\boost_1_35_0\lib, but I like c:\boost\boost_1_35_0\lib better.

After the build you can delete the c:\boost\boost_1_35_0\bin.v2 directory to free up space.

No comments: