I have just updated my MSYS2 and received a new version of boost library 1.69.0. But after this update CMake 3.13.1 that must support this boost version says to me:
CMake Error at C:/Program Files/JetBrains/CLion 2018.2.6/bin/cmake/win/share/cmake-3.13/Modules/FindBoost.cmake:2100 (message):
Unable to find the requested Boost libraries.
Boost version: 1.69.0
Boost include path: D:/msys64/mingw64/include
Could not find the following Boost libraries:
boost_chrono
boost_filesystem
boost_system
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
Boost.
As i see CMake found boost 1.69.0 but not found Boost libraries. Why? With Boost 1.68.0 all works perfect.
PROBLEM SOLVED:
Today i cheked updates in MSYS and received an updated package
mingw-w64-x86_64-boost-1.69.0-2
After that CMake found all Boost 1.69.0 libraries succesfuly
Related
I'm using the filesystem library from Boost in this project (https://github.com/marcomedrano1999/files_in_directory.git) and it works fine when I link the boost root to the proyect (I'm using Visual Studio), but I need it to be cross-platform so I implement the following in my CMakeLists.txt:
cmake_minimum_required(VERSION "3.18.3")
project("listdir")
find_package(Boost 1.73.0 REQUIRED filesystem)
include_directories("${Boost_INCLUDE_DIRS}")
link_directories("${Boost_LIBRARY_DIRS}")
add_executable("${PROJECT_NAME}" "Main.cpp")
target_link_libraries("${PROJECT_NAME}" ${Boost_LIBRARIES})
but when I tried to configure it in CMake the following error displayed:
CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
Could NOT find Boost (missing: filesystem) (found suitable version
"1.73.0", minimum required is "1.73.0")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458(_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.18/Modules/FindBoost.cmake:2177(find_package_handle_standard_args)
CMakeLists.txt:5 (find_package)
I'd tried several ways for this (as shown in the documentation page) but any of them have worked. Can someone tell me if I made something wrong?
If you have installed Boost library in a non-standard location, then you can specify the Boost Installation directory via BOOST_ROOT:
cmake -DBOOST_ROOT=<path to the boost installation directory> <... the rest of cmake options ...>
Also make sure that the filesystem part of boost is really installed (filesystem is a compiled library in contrast to other header only libraries).
I am trying to deploy some libraries on embedded SPARC-like machine for project in which I involved. I successfully built bleeding-edge Boost library on this machine and installed it into /util directory. Then I tried to write simple tester script for CMake. Here is the beginning of this script:
cmake_minimum_required(VERSION 2.8.3)
project(cpp_boost_test)
find_package(Boost REQUIRED COMPONENTS system thread)
find_package(console_bridge REQUIRED)
message(STATUS "Boost Includes: ${Boost_INCLUDE_DIRS}")
message(STATUS "Boost Libraries: ${Boost_LIBRARIES}")
While running I receive the following error message:
-- Found Boost 1.70.0 at /util/lib/cmake/Boost-1.70.0
-- Requested configuration: QUIET REQUIRED COMPONENTS
system;thread
-- Found boost_headers 1.70.0 at /util/lib/cmake/boost_headers-1.70.0
-- Found boost_system 1.70.0 at /util/lib/cmake/boost_system-1.70.0
-- No suitable boost_system variant has been identified!
-- libboost_system.so.1.70.0 (shared, BUILD_SHARED_LIBS not ON, set Boost_USE_STATIC_LIBS=OFF to override)
CMake Error at /util/lib/cmake/Boost-1.70.0/BoostConfig.cmake:60 (find_package):
Found package configuration file:
/util/lib/cmake/boost_system-1.70.0/boost_system-config.cmake
but it set boost_system_FOUND to FALSE so package "boost_system" is considered to be NOT FOUND.
Reason given by package:
No suitable build variant has been found.
Call Stack (most recent call first):
/util/lib/cmake/Boost-1.70.0/BoostConfig.cmake:89 (boost_find_dependency)
/util/share/cmake-3.7/Modules/FindBoost.cmake:229 (find_package)
CMakeLists.txt:4 (find_package)
I tried to set Boost_USE_STATIC_LIBS option but the error still remains.
Can this be a version conflict in Boost.System or not? What should I do to avoid this error? It is not possible to remove Boost from project, so I can not accept an answer about such removal...
I investigated the history of changes in Boost, so the answer is that building dependencies in projects linking Boost should be manually included into CMake (see answers here: CMake finds Boost but the imported targets not available for Boost version for details). Thus it is mandatory to use Boost version that is slightly older than CMake version you use. I solved my problem with rollback to Boost 1.61 (according to peculiarities of my embedded platform I can not compile CMake version above 3.7.0).
Check the version of your current cmake installation by using cmake --version.
It's highly likely greater than 3.0. Since there is an incompatibility between old cmake and modern cmake (>3.0), you can try to fix it by change the VERSION to your current cmake's version or any number >= 3.0.
qtcreator supports both qmake and cmake for cross platform development and
qmake works fine for both msvc and MinGW builds on Windows. However, I'd prefer to support just one tool: cmake.
The CMakeLists.txt at via-httplib works fine on linux and when using cmake to build msvc on Windows.
However, when using cmake to build MinGW on Windows, I get the following error:
CMake Error at C:/Program
Files/CMake/share/cmake-3.13/Modules/FindBoost.cmake:2100 (message):
Unable to find the requested Boost libraries.
Boost version: 1.69.0
Boost include path: D:/DevLibraries/boost/boost_1_69_0
Could not find the following Boost libraries:
boost_system
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 Boost.
Both the BOOST_LIBRARYDIR and BOOST_ROOT environment variables are set and are found when using the Visual Studio 15 2017 Win64 generator and default native compilers
The error message indicates that when using the MinGW Makefiles and default native compilers, cmake finds the BOOST_ROOT environment variable but not BOOST_LIBRARYDIR. So it does not seem to be the same problem described here: Cmake doesn't find Boost
Is this a bug in FindBoost.cmake? Is there a "work around"?
It is an issue with the _boost_ARCHITECTURE_TAG in FindBoost.cmake, described on line 1518.
The tag was added to handle Boost 1.66.0 and later versions.
It is not setting the _boost_ARCHITECTURE_TAG for MinGW to -x64, so it is searching for boost library names like:
libboost_system-mgw73-mt-d-1_69.a
instead of:
libboost_system-mgw73-mt-d-x64-1_69.a
There is a workaround: set the cmake variable: Boost_ARCHITECTURE to -x64.
Note: setting Boost_ARCHITECTURE as an environment variable does not work, as FindBoost.cmake does not read Boost_ARCHITECTURE as an environment variable.
I've install boost 1.63.0 on Windows and I am trying to build with CMake (using Visual Studio 2017 as a generator). I'm having trouble getting find_package() to find my boost libraries and I can't figure out why.
CMakeLists.txt:
find_package(Boost REQUIRED COMPONENTS system filesystem thread)
Output:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.8/Modules/FindBoost.cm
ake:1813 (message):
Unable to find the requested Boost libraries.
Boost version: 1.63.0
Boost include path: C:/Program Files (x86)/boost/boost_1_63_0
Could not find the following Boost libraries:
boost_system
boost_filesystem
boost_thread
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Boost finds the includes, but not the libraries. Headers are located at:
%BOOST_ROOT%. Libraries are located at %BOOST_ROOT%/stage/lib. When I look at _boost_LIBRARY_SEARCH_DIRS_RELEASE, the first place it looks is the correct location. I've also tried hard-coding BOOST_LIBRARYDIR to that path just to be sure.
To install boost I extracted the downloaded archive to %BOOST_ROOT%, then ran bootstrap and .\b2 link=static,shared threading=single,multi. This should give me all versions of the libraries. In the case of boost:system, I have the following binaries in %BOOST_ROOT%/stage/lib%:
boost_system-vc100-mt-1_63.dll
boost_system-vc100-mt-1_63.lib
boost_system-vc100-mt-gd-1_63.dll
boost_system-vc100-mt-gd-1_63.lib
libboost_system-vc100-mt-1_63.lib
libboost_system-vc100-mt-gd-1_63.lib
I've tried enabling and disabling the following, but to no avail:
set( Boost_USE_STATIC_LIBS ON )
set( Boost_USE_MULTITHREADED OFF )
set( Boost_DEBUG ON )
Here is an interesting part. The Boost_DEBUG parameter spits out this line:
Searching for SYSTEM_LIBRARY_RELEASE: boost_system-vc141-mt-1_63;boost_system-vc141-mt;boost_system-mt-1_63;boost_system-mt;boost_system
Note the vc141 versus vc100. I think .\b2 built something for vc100. That's strange because I was running it from the Dev Command Prompt for VS 2017. I've taken a wild guess and tried to build boost with ./b2 toolset=msvc-14.1 but I get an error: *** argument error * rule maybe-rewrite-setup ( toolset : setup-script : setup-options : version : rewrite-setup ? )".
How can I ensure that I compile boost with VS2017 or MSVC141?
This thread seems related:
Version numbers for Visual Studio 2017, Boost and CMake
Check the FindBoost.cmake script that is being used. Depending on the version of CMake you use, this version of Boost may not be handled. The dependencies between libraries is set depending on the version of Boost found.
For example the latest version of the script in CMake sources on GitHub handles version 1.63. I had the problem with CMake v3.6.2 which does not handle it.
Regarding the version mismatch for MSVC I don't know, sorry.
I compiled boost, and am compiling the linking application with the same toolset. Therefore I decided that it was safe to simply rename all compiled libs from *-vc100-* to *-vc141-*. While normally I would discourage that (you could get subtle differences in the ABI), in this case I was certain that it was the same compiler and so it's clear that either cmake or b2 had a bug which created(or searched) a file with the wrong name.
After doing that, cmake not only found boost, but linked successfully.
I am fairly new to using boost along with C++. I have just installed Boost 1.59.0 and I want to use the geometry library.
If I include FIND_PACKAGE( Boost 1.47 REQUIRED ) it finds boost and no problems arises. If I then include FIND_PACKAGE( Boost 1.47 COMPONENTS geometry REQUIRED ) I get the following error:
Unable to find the requested Boost libraries.
Boost version: 1.59.0
Boost include path: /usr/include
Could not find the following Boost libraries:
boost_geometry
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
Boost.
If I run the following [ -f /usr/include/boost/geometry/geometry.hpp ] && echo "Found" || echo "Not found" in the CLI I get Found as a result. So it seems that it's there, but CMake tells me it's not.
What am I misunderstanding?
COMPONENTS is required only for built libraries. Geometry is an header-only library so it's not needed. You need only to find the boost headers location.