Rosanswers logo

I'm trying to get the Boost library working with catkin and CMake on Linux (Ubuntu 14.04). CMake can successfully find Boost, but can't find the libraries, instead failing to when running catkin_make with this error:

CMake Error at /usr/share/cmake-3.2/Modules/FindBoost.cmake:1201 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.54.0

  Boost include path: /usr/include

  Could not find the following Boost libraries:


  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of

I've made the necessary edits to my CMakeLists.txt file, as per the wiki page. And I've also searched other ROS/StackOverflow questions here, here and here, however none of these solutions have worked for me.

Boost is definitely installed in the /usr/include/boost folder, and all the libraries are there so I'm not sure why CMake isn't finding them. I've also tried using set() to change BOOST_LIBRARYDIR and BOOST_ROOT in the CMakeList.txt file, but if that's the solution then I haven't found the right filepath to set them to.

When I add set(Boost_DEBUG 1) the compiler spits out more information, including this:

-- [ /usr/share/cmake-3.2/Modules/FindBoost.cmake:1104 ] Boost_FOUND = 1
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   thread
--   date_time
--   iostreams
--   serialization
--   chrono

So it seems that Boost is being found, but it only detects a few libraries. However there are definitely more libraries than those few present in the /usr/include/boost folder, so I'm not sure why only these ones are being found.

My CMakeList.txt file is:

cmake_minimum_required(VERSION 2.8.3)

find_package( PCL REQUIRED)
find_package( catkin REQUIRED COMPONENTS

find_package( Boost REQUIRED COMPONENTS


include_directories( include 

# All the "add_executable" and "link_target_libraries" commands for my .cpp files.

If anyone has any advice or suggestions on how to resolve this problem, I'd be very appreciative.


  1. There are actually two versions of boost installed on my system. v1.54.0 in /usr/include/boost/version.hpp and v1.65.1 in /usr/lib/boost_1_65_1/boost/version.hpp

  2. In response to @gvdhoorn's comment, the output of dpkg -l | grep boost is here: output of grep boost.txt. Note that grep doesn't return anything about v1.65.1

  3. I've noticed that my code will compile and run if I only use v1.54.0 and don't include <boost/core/demangle.hpp> as it seems that v1.54.0 does have the other two files I'm including (<boost/foreach.hpp> and <boost/algorithm/string.hpp>) but not this one.

  4. In response to @gvdhoorn's answer: I added the following lines to my CMakeLists.txt file, to try to force CMake to use version 1.65.1:

    set(BOOST_ROOT /usr/lib/boost_1_65_1)
    set(BOOST_INCLUDEDIR /usr/lib/boost_1_65_1)
    set(BOOST_LIBRARYDIR /usr/lib/boost_1_65_1/stage/lib)
    find_package(Boost REQUIRED 1.65.1 COMPONENTS algorithm core)

However this still fails to compile with the same error message, but with version "1.65.1" instead of "1.54.0" I suspect that either my 1.65 installation is incorrect or otherwise I'm not directing CMake to the right library filepath. In which case it would probably make more sense to somehow force version 1.54.0 to upgrade, rather than having two separate installations (which is even more preferable given the warnings about mixing versions).

Originally posted by M@t on ROS Answers with karma: 2327 on 2017-12-06

Post score: 0

Original comments

Comment by gvdhoorn on 2017-12-07:
/usr/include/boost implies that this is a user-built install of Boost, not one maintained by the package manager / distributed with your OS. Is that correct?

Comment by M@t on 2017-12-07:
I'm not entirely sure sorry, since I've somewhat mindlessly installed so many different packages through the command-line. There are definitely two versions though - 1.54.0 in /usr/include/boost and 1.65.1 in /usr/lib/. 1.65.1 I manually installed, and I can't remember where 1.54.0 came from.

Comment by gvdhoorn on 2017-12-07:
Which OS is this? And I would expect Boost files in both /usr/include/boost as well as /usr/lib: the former are the headers, while the latter are the libraries.

Assuming a debian OS: what is the output of dpkg -l | grep boost?

Comment by M@t on 2017-12-07:
Oops, yes sorry I should have mentioned I'm using Ubuntu 14.04. I'll update my question momentarily. Thanks for your help as always.


1 Answer 1


Rosanswers logo

Note that grep doesn't return anything about v1.65.1

Seeing as you're running Ubuntu Trusty (14.04), I'm pretty certain that the 1.65.x install of Boost was compiled from sources (or came from a PPA, or somewhere else, but not from the official pkgs). Trusty comes with Boost 1.54.

The fact that your code compiles with 1.54 when you don't use demangle.hpp probably makes sense, as that was only introduced in 1.56 (before that it could have been demangled_name.hpp (from here)).

So to summarise:

I believe that CMake is finding Boost alright, but that you're trying to use files that don't exist in the Boost version that CMake finds (ie: 1.54).

If you really want to use the newer Boost, you could try something like find_package(Boost REQUIRED 1.65 COMPONENTS ..). Provided all required files are on CMake's search path, it should ignore 1.54 and go with the newer one.

Note that mixing Boost versions is not recommended at all. There are plenty of questions about that on ROS Answers, so you could take a look at those to read about some potential consequences.

Originally posted by gvdhoorn with karma: 86574 on 2017-12-08

This answer was ACCEPTED on the original site

Post score: 4


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.