Note: Updated the post to note the availability of C++ Boost 1.34.1 libraries for Gentoo and (especially) for Ubuntu 7.10(Gutsy Gibbon).

1. C++ Boost on Gentoo:

On the shell prompt, type:

sh# emerge boost

This should install the latest version of boost available for Gentoo. Currently 1.33.1 version of Boost Libraries is available for Gentoo. Synchronise(‘emerge –sync’) with the Gentoo portage if your ‘emerge -p boost’ shows an earlier version. You can install the latest version Boost 1.34.1 by adding the line “dev-libs/boost ~x86″ to “/etc/portage/package.keywords” file.

2. C++ Boost on Debian/Ubuntu:

  • Update2:
    Boost 1.34.1 version is now available. To install the latest version, run the following command(or select these packages from Synaptic Package Manager):

    sh# apt-get   install   libboost-date-time-dev libboost-date-time1.34.1   libboost-dev   libboost-doc   libboost-filesystem-dev   libboost-filesystem1.34.1   libboost-graph-dev   libboost-graph1.34.1   libboost-iostreams-dev   libboost-iostreams1.34.1 libboost-program-options-dev   libboost-program-options1.34.1   libboost-python-dev   libboost-python1.34.1   libboost-regex-dev   libboost-regex1.34.1   libboost-signals-dev   libboost-signals1.34.1   libboost-test-dev   libboost-test1.34.1   libboost-thread-dev   libboost-thread1.34.1  

    Or,

    sh# apt-get install libboost.*-dev libboost-doc libboost.*1.34.1
  • Update1: See the new update above
    Boost 1.33.1 version is now available. To install this version, run the following command(or select these packages from Synaptic Package Manager):

    sh# apt-get   install   libboost-date-time-dev libboost-date-time1.33.1   libboost-dev   libboost-doc   libboost-filesystem-dev   libboost-filesystem1.33.1   libboost-graph-dev   libboost-graph1.33.1   libboost-iostreams-dev   libboost-iostreams1.33.1 libboost-program-options-dev   libboost-program-options1.33.1   libboost-python-dev   libboost-python1.33.1   libboost-regex-dev   libboost-regex1.33.1   libboost-signals-dev   libboost-signals1.33.1   libboost-test-dev   libboost-test1.33.1   libboost-thread-dev   libboost-thread1.33.1  

    Or,

    sh# apt-get install libboost.*-dev libboost-doc libboost.*1.33.1
  • Run the following command(or select these packages from Synaptic Package Manager): See the update above
    sh# apt-get   install   libboost-date-time-dev libboost-date-time1.33.0   libboost-dev   libboost-doc   libboost-filesystem-dev   libboost-filesystem1.33.0   libboost-graph-dev   libboost-graph1.33.0   libboost-iostreams-dev   libboost-iostreams1.33.0 libboost-program-options-dev   libboost-program-options1.33.0   libboost-python-dev   libboost-python1.33.0   libboost-regex-dev   libboost-regex1.33.0   libboost-signals-dev   libboost-signals1.33.0   libboost-test-dev   libboost-test1.33.0   libboost-thread-dev   libboost-thread1.33.0  

    You can use the following simple command to install every library present in Boost that matches the pattern, if you don’t want to be selective about which libraries to install:

    sh# apt-get install libboost.*-dev libboost-doc libboost.*1.33.0

All this mess could be avoided if only Debian/Ubuntu packages could build a meta-package to include all the C++ Boost libraries. One could use the pattern libboost.* but it includes the Boost debug files(libboost-dbg) too.

3. Build C++ Programs Using Boost Libraries

Once the boost package is installed, the C++ programs that make use of boost libraries can be built simply like this:

sh# g++ -o first first.cpp

If the program needs to be linked to a library(for eg: filesystem library), then specify the name of the library using the -l switch:

sh# g++ -o second second.cpp -lboost-filesystem

I will follow this up with the installation procedure for Slackware and RPM based distributions(Done).


Update:Thanks to Jun Zhang for pointing out the missing packages in the Boost installation command for Ubuntu; the command is now updated.