2

I needed to install a newer version of Boost (1.67) on my Ubuntu 14.04 but I have probably done it in the wrong way and now everything is broken.

Some background and how my system came to where it is

I have downloaded Boost 1.67 and tried to install it from source, I have done multiple things to do this, but from what I remember:

  • Downloaded Boost 1.67 from the boost website into my Downloads folder.
  • ./bootstrap.sh
  • ./b2 install
  • And then I ran something (not exactly the same with the code below but similar approach, that I cannot recall) sudo echo "$installDir/lib" >> /etc/ld.so.conf.d/boost-1.56.0.conf" and then I ran sudo ldconfig -v.

The initial problem when I installed the new version of Boost it was that I haven't provided the --prefix flag to specify a location to install the new version of boost, and I suspect that this new version of Boost override the system Boost.

After that, and after I realise that I needed to provide the --prefix flag with a path to install Boost where I want, I ran again the installation but providing now the --prefix flag with the path /home/myusername/.boost1_67_0. Now I can see under /home/myusername/.boost1_67_0 Boost 1.67 installed. I even tried to install an older version, Boost 1.64 to /home/myusername/.boost1_64_0.

So from what I understand, my system has Boost 1.64 installed somewhere that I don't know where (because I haven't provided the --prefix flag, suspecting this caused the whole problem), I also have Boost 1.67 and Boost 1.64 installed to /home/myusername/.boost1_67_0 and /home/myusername/.boost1_67_0 respectively. The libboost-all-dev and libboost-dev are also installed from the package manager.

Running:

dpkg -s libboost-dev | grep 'Version'
Version: 1.54.0.1ubuntu1

I see that the libboost-dev version is 1.54 and the system is aware of it.

Running the following C++ code:

#include <boost/version.hpp>
#include <iostream>
#include <iomanip>

int main() {
  std::cout << "Boost version: " << BOOST_VERSION / 100000 << "/" << BOOST_VERSION / 100 % 1000 << "." << BOOST_VERSION % 100 << std::endl;
  return 0;
}

I get an output that Boost version is 1.67.

Things I have tried to resolve the problem myself

  • I tried to delete libboost-all-dev and reinstall and even run sudo apt install --reinstall libboost-all-dev but the problem is not solved.

  • sudo dpkg-reconfigure libboost-all-dev

  • sudo apt-get purge libboost-all-dev && sudo apt-get install libboost-all-dev

I have then tried to see what is going on in /etc/ld.so.conf.d, here are the files in there:

-rw-r--r-- 1 root root  25 Jul 21 11:51 boost.conf
-rw-rw-r-- 1 root root  38 Mar 24  2014 fakeroot-x86_64-linux-gnu.conf
lrwxrwxrwx 1 root root  41 Oct 24  2017 i386-linux-gnu_EGL.conf -> /etc/alternatives/i386-linux-gnu_egl_conf
lrwxrwxrwx 1 root root  40 Oct 24  2017 i386-linux-gnu_GL.conf -> /etc/alternatives/i386-linux-gnu_gl_conf
-rw-r--r-- 1 root root 108 Jan 15  2018 i686-linux-gnu.conf
-rw-r--r-- 1 root root  44 Aug  9  2009 libc.conf
-rw-r--r-- 1 root root   0 Jul 20 10:55 local.conf
-rw-r--r-- 1 root root  68 Apr 12  2014 x86_64-linux-gnu.conf
lrwxrwxrwx 1 root root  43 Oct 24  2017 x86_64-linux-gnu_EGL.conf -> /etc/alternatives/x86_64-linux-gnu_egl_conf
lrwxrwxrwx 1 root root  42 Jun  5 09:02 x86_64-linux-gnu_GL.conf -> /etc/alternatives/x86_64-linux-gnu_gl_conf
lrwxrwxrwx 1 root root  57 Jan 24 13:45 x86_64-linux-gnu_mirclientplatform.conf -> /etc/alternatives/x86_64-linux-gnu_mirclientplatform_conf
-rw-r--r-- 1 root root  56 Jun 16  2017 zz_i386-biarch-compat.conf
-rw-r--r-- 1 root root  58 Jun 16  2017 zz_x32-biarch-compat.conf

I tried to modify the boost.conf file in there, which contained a single line with a path to the Boost directory. I changed the path to Boost 1.64 which is located under /home/myusername/.boost1_64_0 and then I ran sudo ldconfig. I went to compile again the above C++ code to check if the version of Boost changed after this change. Unfortunately is not.

Nothing have changed after trying all these actions, unfortunately.

I would like to restore the system as it was in the sense of having the system boost (libboost-all-dev, version 1.54) as the default unless I provide a path to a newer version. Any ideas on how to do this?

  • 2
    If you didn't specify a --prefix during the original install, it likely went into /usr/local (i.e. headers into /usr/local/include/boost and the - few - actual libs into /usr/local/lib) - look there. – steeldriver Jul 21 '18 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.