I've installed the boost libraries on Linux Mint 12 using the command sudo apt-get install libboost-dev libboost-doc
, which installs the default version available in the repositories. However, the project I have to do needs the 1.44 version of boost. How do I uninstall the default (current) version 1.46 and install 1.44?
I couldn't find the documentation on the boost website to install boost from the .tar.gz
package.
On the command line, go to the root of the unpacked tree. Run either .\bootstrap.bat (on Windows), or ./bootstrap.sh (on other operating systems). where PREFIX is a directory where you want Boost.Build to be installed. Optionally, add PREFIX/bin to your PATH environment variable.
./b2 install --prefix= PREFIX where PREFIX is a directory where you want Boost.Build to be installed. Optionally, add PREFIX/bin to your PATH environment variable. If you are not using a Boost.Build package, but rather the version bundled with the Boost C++ Libraries, the above commands should be run in the tools/build/v2 directory.
The libboost-all-dev and libboost-dev are also installed from the package manager. I see that the libboost-dev version is 1.54 and the system is aware of it.
Boost can installed by two ways
In some case we might have installed by both type which can cause version error. Lets see how to uninstall both.
sudo apt-get update # to uninstall deb version sudo apt-get -y --purge remove libboost-all-dev libboost-doc libboost-dev # to uninstall the version which we installed from source sudo rm -f /usr/lib/libboost_*
Then we need to install other dependencies if they are not met
sudo apt-get -y install build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev
Lets download the boost version which we need from the link. I am downloading the 1.54 version. Then untar and install it.
# go to home folder cd wget http://downloads.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.tar.gz tar -zxvf boost_1_54_0.tar.gz cd boost_1_54_0 # get the no of cpucores to make faster cpuCores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}'` echo "Available CPU cores: "$cpuCores ./bootstrap.sh # this will generate ./b2 sudo ./b2 --with=all -j $cpuCores install
Now let's check the installed version
cat /usr/local/include/boost/version.hpp | grep "BOOST_LIB_VERSION"
You will see something like below
// BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION #define BOOST_LIB_VERSION "1_54"
Version 1.54 of boost is installed
That's it, it worked for me. Let me know if you face any issues.
You can uninstall with
apt-get --purge remove libboost-dev libboost-doc
Download the package you need from boost website, extract and follow "getting started" instructions found inside index.html in the extracted directory.
Tested working Ubuntu 20.04 Use my script to uninstall your older version of boost in ubuntu 20.04 and follow rams instructions above
#!/bin/bash
sudo apt-get -y --purge remove libboost-all-dev libboost-doc libboost-dev
echo "clear boost dir"
sudo rm -r /usr/local/lib/libboost*
sudo rm -r /usr/local/include/boost
sudo rm -f /usr/lib/libboost_*
sudo rm -r /usr/include/boost
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With