Ubuntu – Installing boost 1.48 on ubuntu 14.04

14.04boostdowngrade

Is there a way that I could Install boost 1.48 instead of the latest version on my Ubuntu 14? As when I issued the following command:

sudo apt-get install libboost-all-dev

It installed the latest 1.54 version but I required 1.48 available here:

I would be grateful for any help as I have been trying to accomplish this for quite some time now.

Update

When I downloaded .deb link from:

and used Software Center the message came up as 'dependency NOT satisfiable'.

Best Answer

Boost is a reasonably complex beast and I would be wary of actually replacing the system installation. Best solution IMHO is to compile the required older version and install to a location such as /opt and then when compiling point your application to the older Boost include and lib directories with something like the following:

CPPFLAGS="-I/opt/boost/include/boost"
LDFLAGS="-L/opt/boost/lib"

Or indeed seeing if there is a specific ./configure flag in the source you are compiling to point to the older Boost libraries. This has been my practice and it has worked well. A few steps are required:

1. Activate Sources

Follow this trail:

Dash > Software & Updates > Ubuntu Software > Downloadable from The Internet > Source Code

Check the 'Source Code' box and then allow the repositories to reload when prompted. Then load the build dependencies:

sudo apt-get build-dep libboost-dev

2. Build Boost

To download, compile and install Boost use the following single command by copying and pasting the entire command into a Terminal window:

mkdir ~/Desktop/boost_build && cd ~/Desktop/boost_build && \
wget http://sourceforge.net/projects/boost/files/boost/1.48.0/boost_1_48_0.tar.gz && \
tar xvf boost_1_48_0.tar.gz && cd boost_1_48_0 && \
sed -i_bak -e 's#PREFIX=/usr/local#PREFIX=/opt#' -e 's#LIBDIR=#LIBDIR=/opt/boost/lib#' \
-e 's#INCLUDEDIR=#INCLUDEDIR=/opt/boost/include#' bootstrap.sh && \
./bootstrap.sh && ./b2 && \
sudo ./bjam install

Be aware that there will be somewhat of a delay following the final install command, have patience as the libraries are installed.

This is a fairly generic boost build and doubtless could be fine tuned but I suspect will be enough for you as it is...

Optional Removal

To remove the compiled and installed Boost libraries simply run the following:

sudo rm -rfv /opt/boost

And your system is clean again...

Related Question