C++ Frontend Tales

All | Boost | General | Loki
Main | Boost 1.33.1 »

20060126 Thursday January 26, 2006

Boost 1.32.0 Mini HOWTO Boost 1.32.0 Mini HOWTO

1 Boost Version

This HOWTO describes Boost - 1.32.0. This version with applied patch is supported by Sun Studio C++ compiler so I recommend to use it now. I do not plan to make a patch for Boost 1.33.1 because upcoming Boost 1.34 works with Sun C++ well out of the box. Please note, Sun Microsystems does not support Boost library, i.e. we do not and we will not fix bugs in it. Please ask Boost developers.

2 Patch Boost

This file contains all necessary fixes to Boost 1.32.0. You should use gnu patch.

     tar xfj boost_1_32_0.tar.bz2
     cd boost_1_32_0
     gpatch -p1 < ../boost_1_32_0.patch

3 Build Bjam

The Boost build system uses BJam, an extension of the Perforce Jam portable make replacement. Unfortunately there is no prebuilded binary version of bjam for Solaris. But we are professionals, aren't we? So let's build bjam. Suppose BOOST is the Boost's root folder. If you gonna use a compiler, which isn't in the /opt/SUNWspro folder you have to point to it by setting BOOST_JAM_TOOLSET_ROOT. It should point to the directory that contains folders like bin, lib, prod. For example for Studio Express export BOOST_JAM_TOOLSET_ROOT=/opt/SPROexpress/opt/SUNWspro/. Note trailing slash is important. All preparations are done. Let's make the rest few steps:

     cd $BOOST/tools/jam/src
     ./build.sh sunpro
     ln -s bin.solaris bin # to run regression tests later

4 Build Boost

Have you builded the bjam? Let's continue. Now you are almost ready to build the Boost. Suppose BOOST is the Boost's root folder and jam is on your path. You can start building the Boost.

If your compiler is installed in the standard folder just run:

     cd $BOOST
     bjam -sTOOLS=sunpro stage

If you need to setup compiler options, point to non-standard compiler installation folder run the following extended version of build command:

     cd $BOOST
     bjam -sTOOLS=sunpro \
          -sSUNPRO_ROOT_DIRECTORY="/opt/SPROexpress/opt/SUNWspro/" \
          -sSUNPRO_CXX="CC <options>" \
          -j8 -d2 stage
SUNPRO_ROOT_DIRECTORY
The directory where Sun C++ is installed.
SUNPRO_CXX
The name by which CC is invoked with options. See below for the list of options.
-jn
This option allows bjam use up to `n' processors.
-d2
Set this option if you want to see running command parameters during building.
stage
Build target. Also You can use `clean' and `install'.

5 Test Boost

Boost uses bjam to build and run tests and two additional programs to parse log and produce html formatted results. Let's run tests. As usually suppose BOOST is the Boost's root folder and bjam is on your path. Note if you want to produce html formatted log you cannot use -jn.

     cd $BOOST/status
     bjam -sTOOLS=sunpro --dump-tests &> test_log

If you want to work with html formatted results instead of raw data from test_log you need to build two additional utilities and run them.

     cd $BOOST/tools/regression/build
     bjam -sTOOLS=sunpro -sBUILD=release run

You've got two utilites process_jam_log and compiler_status in the $BOOST/tools/regression/build/run. To produce formatted log run them one by one. Important note: $BOOST should start with a domain name.

     cd $BOOST/status
     cat test_log | process_jam_log
     compiler_status $BOOST log.html log-links.html

Test results are in the log.html and log-links.html. That's all.

6 Work with Boost

When you work with Boost you should use the following command line options: -library=stlport4 -features=tmplife -features=tmplrefstatic. Also you may use -Qoption ccfe -complextmplexp. But C++ compiler from Sun Studio 11 does not fully support complex expression in template arguments so this option sometimes might lead to incorrect mangling names. Full support of complex template expression has been implemented in the development version of Sun C++.
Permalink Comments [6]

Trackback URL: http://blogs.sun.com/sga/entry/boost_mini_howto
Comments:

The link to the boost.patch file (http://blogs.sun.com/roller/resources/sga/boost.patch) under Step 2 seems to be broken. I tried to use the file available from the link on the right of the page (http://blogs.sun.com/roller/resources/sga/boost_1_32_0.patch) but both Solaris and GNU patch ask me for the name of a file to be patched as soon as I run it instead of figuring it out from the .patch file. Hope this helps.

Posted by 216.254.74.245 on August 24, 2006 at 01:15 PM MSD #

I had the same problem with the patch, however if you put the patch in the directory above $BOOST then cd to $BOOST and use gpatch rather than patch it seems to work fine.

Posted by 204.57.116.62 on August 25, 2006 at 09:30 PM MSD #

Hi, "Full support of latest Boost version is upcoming task. We do not support other version of Boost library now." Is there a roadmap for that? Thanks, Guy

Posted by Guy Peleg on November 30, 2006 at 01:10 PM MSK #

I think word 'support' is inaccurate here. I've modified my post. I use Boost library just like test suite to catch bugs in the compiler and fix them. Now Sun C++ works quite well and Boost developers do not plan to exclude it from the list of supported compilers. I will continue to fix bugs in the compiler but I do not have a time and I do not see any sense in bug fixing in the Boost code, Bjam files etc. That's job for Boost team.

Posted by Simon Atanasyan on November 30, 2006 at 05:12 PM MSK #

I have been trying to build boost for Solaris 10 x64 and the studio12 compilers and I fail to apply the options. Although I have faithfully carried out the instructions listed above, the command line given in the text is not propagating the options.
So I get errors during the compilation and I have no idea how to make bjam see the options which are necessary for this setup.
I am trying to build 1.34.x

Posted by lydia heck on March 03, 2008 at 07:45 PM MSK #

Have you tried following instructions?
http://blogs.sun.com/sga/entry/boost_and_sun_studio_12
What errors do you get?

Posted by 194.8.176.164 on March 03, 2008 at 09:55 PM MSK #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed