Installing C++ Boost on Slackware/Zenwalk

C++ Boost 1.33.1 on Slackware/Zenwalk:

Download bjam slackware package(tgz) and boost-1_33_1 source package(tar.gz) from the website:
bjam for slackware
c++ boost source package

Save these two files in the home directory and then cd into it:

$ cd $HOME

Install bjam(as root):

$ installpkg boost-jam-3.1.11-1-linuxx86.tgz
$ export PATH=$PATH:/boost-jam-3.1.11-1-linuxx86/

Compile and install boost(as root):

$ tar xjvf boost_1_33_1.tar.bz2
$ cd boost_1_33_1
$ bjam "-sTOOLS=gcc" install

C++ Boost is now installed. this procedure doesn't install the files in the default library paths, so compilation commands are slightly longer than they are for gentoo and debian/ubuntu:

$ g++ -o first first.cpp -I/usr/local/include/boost-1_33_1
$ g++ -o second second.cpp -I/usr/local/include/boost-1_33_1 -L/usr/local/lib -lboost_filesystem-gcc

you can simplify this by adding the paths of boost folders to gcc environment variables:

$ export CPLUS_INCLUDE_PATH=/usr/local/include/boost-1_33_1
$ export LIBRARY_PATH=/usr/local/lib

the compilation can now be performed using the following simple commands:

$ g++ -o first first.cpp
$ g++ -o second second.cpp -lboost_filesystem-gcc

the two 'export' commands can be added at the end of the profile file(/etc/profile or $HOME/.bash_profile) to avoid having to type them everytime a new shell is opened. other way to simplify the process would be to create symbolic links to boost library paths in the Slackware standard include paths, so that gcc can find them directly.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: