[CMake] CMake Can't Find Boost.Filesystem in Docker Container

Roger Leigh rleigh at codelibre.net
Sun Oct 28 08:11:48 EDT 2018


On 28/10/2018 10:26, Osman Zakir wrote:
> I'm creating a new email thread for this because the other thread's 
> problem was already solved.
> 
> In the Dockerfile for my project, the build process can't go any farther 
> from the point where I'm trying to build the Jinja2Cpp library.  CMake 
> isn't able to find Boost.Filesystem, but it's still able to build the 
> library and write the files to "/usr/local/Jinja2Cpp/build" just fine.  
> But the Docker build process exits with a return code of 1 at that point 
> due to the two CMake errors generated.  I've attached the text file I'd 
> written documenting the CMake errors in question.
> 
> Should I delete the Docker images and containers created from previous 
> attempts of building this Docker image, just in case there might be some 
> problem there?  I did try deleting all Docker images and containers I 
> had locally before trying to build the Dockerfile again, but had the 
> same problem.

You will need to investigate why Boost.Filesystem was not found.  If you 
take a look at the various builds in this example repository: 
https://gitlab.com/codelibre/ome-common-cpp/pipelines/34467308
you will see FindBoost tested on a range of compilers and platforms, 
including three different Linux distributions in docker containers. 
It's working in all cases.

Firstly, check that the filesystem library is installed, both runtime 
and development packages.  FindBoost checks for the presence of both the 
headers and the library itself; both are required for it to be 
considered "found".

CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:801 
(message):
   New Boost version may have incorrect or missing dependencies and imported
   targets

This warning can be a minor warning if you have a slightly newer version 
of Boost which CMake isn't yet aware of explicitly.  Should be totally 
fine for an older component like Boost.Filesystem.  But it might also 
indicate a deeper problem.  You could also download and try the most 
recent stable release of CMake, which would likely have better support 
for newer Boost releases.

Are you using the Boost provided by the distribution (which distribution 
version and Boost version)?  Or a newer or custom build of Boost?

As suggested, run with -DBoost_DEBUG=ON and look through the search 
paths.  See why Boost isn't being picked up.  Also look at the CMake 
error log.


Regards,
Roger


More information about the CMake mailing list