Glam Prestige Journal

Bright entertainment trends with youth appeal.

My problem is:

I installed boost from source, everything works fine. CMake finds the library. Then I realized that I need bjam, installed it with apt-get for Ubuntu. This creates a version mismatch. I tried to uninstall the manually installed boost and installed a system package. Big chaos. Cmake can no longer find Boost, I don't understand how to configure it to fix this problem.

Question:

  • How do I explicitly tell Cmake to look for the system package boost ?
  • Alternative: How do I remove all traces from that manual installation (see below, last paragraph)

Details:

I followed this tutorial to install boost from source:

I followed the easy build instructions : downloaded and extracted the latest source, then ran bootstrap without additional arguments (install dir = default = usr/local) and used sudo b2 install

The sample program (with the regex) ran without problems. Then I hooked up CMake and tested if FindBoost worked. This question shows how to do this:

Worked like a charm, I didn't have to configure the lib and include paths, just used the code from the accepted answer.

Unfortunately I need Boost.Python which has an additional dependency: bjam. While looking for installation instructions for bjam, I realized that I could just install the Ubuntu package libboost1.58-tools-dev, it contains bjam . I installed this package and ran the quickstart test example from the downloaded boost source. The test complained that there was a version mismatch. That's right, I installed 1.61 (latest version) from source. But my system package is 1.58 (that's the bjam version).

Now I tried to delete boost. Apparently you have to do that manually by removing everything boost related from /usr/local. Then I installed the system package libboost1.58-dev as counterpart to libboost1.58-tools-dev. This creates a new problem: Cmake can no longer find boost. It complains that the expected version is 1.5, but the given version is 0.0.0

This question (How to link C++ program with Boost using CMake) describes how to configure an alternative path for boost libraries (not the accepted answer). I tried to do the same.

I used this Where does apt-get install libqt4? to find where apt-get put my system boost package. But it only tells me that some files are in usr/include. I can't find the lib files.

SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} /usr/include/boost")
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "/.../boost/lib") <---- this path needs to be set

Also interesting:

I installed Eigen3 as a system package with apt-get, and cmake can find it without any additional configuration.

Therefore I think that there are still traces of that first installation from source. I believe, if I had just installed the Ubuntu boost package from the beginning, I wouldn't have this problem. Is that possible ?

6 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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