Installing C++ Boost 1.34.1 on Slackware/Zenwalk
NOTE: This post is an update of my earlier post Installing C++ Boost 1.33.1 on Slackware/Zenwalk, to now use the new version of C++ Boost libraries - 1.34.1. What follows below is the traditional way of downloading and installing C++ Boost 1.34.1 on any Slackware based distribution such as Zenwalk and Absolute; for a simpler way of installing it using SlackBuild build script, go to the bottom of the post. .
C++ Boost 1.34.1 on Slackware : Traditional Method
- Download bjam(tgz) and boost-1_34_1(tar.bz2) source packages from the sourceforge.net website:
bjam for Slackware
C++ Boost source package
(or Google for the latest versions of these two packages) - Save these two files in the home directory and then cd to it:
sh# cd $HOME
- Install bjam(as root):
sh# installpkg boost-jam-3.1.14-1-linuxx86.tgz
sh# export PATH=$PATH:/boost-jam-3.1.14-1-linuxx86/ - Compile and install boost(as root)*:
sh# tar xjvf boost_1_34_1.tar.bz2
sh# cd boost_1_34_1
sh# bjam ––toolset=gcc
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 distributions like Gentoo and Debian/Ubuntu:
sh# g++ -o second second.cpp -I/usr/local/include/boost-1_34_1 -L/usr/local/lib -lboost_filesystem-gcc
You can simplify this by adding the paths of boost folders to gcc library environment variables:
sh# export LIBRARY_PATH=/usr/local/lib
The compilation can now be performed using the following simple commands:
sh# 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 or something like that) to avoid having to type them every time 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.
*Thanks to kerrigangster for reminding me about the new syntax to build C++ Boost libraries using bjam build tool.
C++ Boost 1.34.1 on Slackware - SlackBuild Method
kerrigangster also pointed out a neat way of installing packages on Slackware using the SlackBuild build scripts, so if you don’t want to download the required files manually, you can automate the download and installation process of Boost libraries using the C++ Boost SlackBuild script:
- Download(Right-click -> Save As…) the following two files and save them in your home directory:
boost.SlackBuild script
C++ Boost slack-desc
(please email me if any of the above two links stop working) - Run the downloaded boost.SlackBuild script(as root):
sh# sh boost.SlackBuild ––cleanup
You need to be connected to Internet for the above script to run successfully. Alternatively you can manually download the C++ Boost source package and store it in the same directory as boost.Slackbuild before running the script.
- The installation package will be created in /tmp. Build from there:
sh# ls /tmp/boost*
sh# installpkg /tmp/boost-1.34.1-i486-1.tgzYou can delete all the temporary files now if you want. Files from /tmp may be deleted automatically by the operating system at the next reboot. You can test the installation as explained in the first section.
Too easy, right? :)