简体   繁体   中英

Cannot find c++ boost header files on Ubuntu 20.04 LTS using apt installation

I have just upgraded my server to ubuntu 20.04 LTS.

I am now trying to various different code packages on it and receiving errors relating to the boost installation.

Rather than building from source, I have installed boost 1.71.0 using apt:

sudo apt-get install libboost-all-dev

However, when I try and compile code I am getting errors such as:

fatal error: boost/algorithm/string/trim.hpp: No such file or directory
   15 | #include <boost/algorithm/string/trim.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
boost/log/sinks/text_ostream_backend.hpp: No such file or directory
    6 | #include <boost/log/sinks/text_ostream_backend.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I have spent the last 3 hours trying to find those hpp files with no success. There is nothing in:

/usr/local/include/
/usr/local/lib/
/usr/lib/
/usr/include/boost *doesn't exist*

Any idea what could be wrong? I'm trying to avoid installing boost from source, rather than the Ubuntu package but do I have to?

Managed to resolve the issue.

Turns out that because I had a previous boost installation from a manual installation (before I upgraded to 20.04 LTS) and had deleted those files manually, further re-installs via apt were not recreating the files in usr/include/ , due to other packages relating to boost still installed in the system.

The recovery was to run apt list --installed '*boost*' and then uninstall any of those linked packages. After doing that running sudo apt install libboost-all-dev recreated the /usr/include/boost directory with all the header files.

This process was listed in the answer on: https://askubuntu.com/questions/1161393/i-deleted-usr-include-boost-installing-libboost-all-dev-wont-bring-headers-ba

Super ! thank you very much ! this solved my issue also !

apt-get purge libboost* apt install libboost-all-dev

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM