Every Flavour Beans

“The time has come…to talk of many [technologies].” –Lewis Carroll(’The Walrus and the Carpenter’)
Development Tools. Web Frameworks. GNU/Linux. Nokia N800. Video Encoding.

September 17, 2007

Installing C++ Boost 1.34.1 on Slackware/Zenwalk

Filed under: C++ Boost, GNU/Linux — tabrez @ 8:43 pm

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

  1. 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)
  2. Save these two files in the home directory and then cd to it:
    sh# cd $HOME
  3. 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/
  4. 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 first first.cpp -I/usr/local/include/boost-1_34_1
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 CPLUS_INCLUDE_PATH=/usr/local/include/boost-1_34_1
sh# export LIBRARY_PATH=/usr/local/lib

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

sh# g++ -o first first.cpp
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:

  1. 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)
  2. 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.

  3. The installation package will be created in /tmp. Build from there:
    sh# ls /tmp/boost*
    sh# installpkg /tmp/boost-1.34.1-i486-1.tgz

    You 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? :)


If you want to receive future posts by email, enter your email address here:

Related Posts:

  • Installing C++ Boost on Slackware/Zenwalk
  • Installing C++ Boost on SuSE and Fedora
  • C++ Boost Filesystem Library(Part III): Example Programs
  • How to Test C++ Boost Installation
  • C++ Boost Filesystem Library(Part II): Example Programs
  • Boost Filesystem Library: Writing Portable C++ Programs to Acess The Filesystem
  • Setting the Stage for C++ Boost

  • Readers who viewed this page, also viewed:


    No Comments »

    No comments yet.

    RSS feed for comments on this post. TrackBack URI

    Leave a comment

    Subscribe without commenting


    Copyright (c) 2006, 2007 Tabrez Iqbal.
    Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. A copy of the license is included in the section entitled "GNU Free Documentation License".


    Powered by WordPress
    This website is hosted by Dreamhost