Using Boost on the CS Linux Machines

Current configurations for our classroom/lab machines include multiple versions of the Boost libraries:

The default version of these libraries should be available without any user action. The simplest way to access the most recent non-default version is to use the command

module load boost-latest

The command module avail may show you additional choices. (See my notes on the ``Modules package'' for more about the module command.) If you use a non-default version it is probably safest to also use the latest compilers, as described in my notes on the GNU compilers.)

Note: If you compile with a non-default version, you should be sure that when you run your programs they can find the associated libraries. Again the simplest way to do this is with the above-described module load command.

Compiling and running programs using Boost

If you are using the default version of everything (compiler(s) and Boost libraries), then everything should ``just work'' if you remember to include the appropriate #include directive(s) in your source code and link with any needed libraries (-l flag(s) to g++). The project Web site (link below) should have more information about specifics.

If you are using a non-default versions (and remember that you should probably be using non-default version of g++ as well), you will also need to pass to g++ the following flags:

-I $(BOOSTROOT)/include -L $(BOOSTROOT)/lib

($BOOSTROOT is an environment variable set by that module load command.) You may also need the flag -lboost_thread-mt.

The non-default version is also configured with support for the MPI-related Boost functions/libraries. To use this feature, you will also need to set up to use a more-recent-than-default version of MPI, as described in my notes on MPI. If at runtime you encounter errors that seem to indicate that the program cannot find the needed libraries, it may help to compile with the following additional flags:

-Wl,-rpath=$(BOOSTROOT)/lib

Useful links



Berna Massingill
2015-10-10