C++ Frontend Tales

All | Boost | General | Loki
Main | Next day (Jan 26, 2006) »

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]