I'm trying to use the Boost library in my C++ project on Windows using CLion and MinGWMSVC. I downloaded the precompiled binaries here and extracted everything to C:\local\boost_1_69_0_b1_rc3. I setup the following CMakeLists.txt:
cmake_minimum_required(VERSION 3.11.4)
project(BoostTesting)
set(CMAKE_CXX_STANDARD 17)
set(BOOST_ROOT "C:/local/boost_1_69_0_b1_rc3")
set(BOOST_LIBRARYDIR "C:/local/boost_1_69_0_b1_rc3/lib64-msvc-14.1")
set(BOOST_INCLUDEDIR "C:/local/boost_1_69_0_b1_rc3/boost")
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(Boost_DEBUG ON)
set(Boost_DETAILED_FAILURE_MSG ON)
set(Boost_COMPILER "-vc141")
set(Boost_ARCHITECTURE "-x64")
find_package(Boost 1.69.0 COMPONENTS filesystem REQUIRED)
if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(BoostTesting main.cpp)
target_link_libraries(BoostTesting ${Boost_LIBRARIES})
endif ()
Using CMake's FindBoost debug mode (Boost_DEBUG) I got the following output:
C:\Users\User\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\183.4284.104\bin\cmake\win\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_MAKE_PROGRAM=C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/mingw32-make.exe" "-DCMAKE_C_COMPILER=C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-gcc.exe" "-DCMAKE_CXX_COMPILER=C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-g++.exe" -G "CodeBlocks - MinGW Makefiles" D:\Cpp\BoostTesting
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-gcc.exe
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-g++.exe
-- Check for working CXX compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at CMakeLists.txt:18 (find_package):
Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Environment variable Boost_ROOT is set to:
C:\local\boost_1_68_0\boost
For compatibility, CMake is ignoring the variable.
This warning is for project developers. Use -Wno-dev to suppress it.
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1125 ] _boost_TEST_VERSIONS =
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1127 ] Boost_USE_MULTITHREADED = ON
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1129 ] Boost_USE_STATIC_LIBS = ON
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1131 ] Boost_USE_STATIC_RUNTIME = OFF
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1133 ] Boost_ADDITIONAL_VERSIONS =
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1135 ] Boost_NO_SYSTEM_PATHS =
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1203 ] Declared as CMake or Environmental Variables:
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1205 ] BOOST_ROOT = C:/local/boost_1_69_0_b1_rc3
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1207 ] BOOST_INCLUDEDIR = C:/local/boost_1_69_0_b1_rc3/boost
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1209 ] BOOST_LIBRARYDIR = C:/local/boost_1_69_0_b1_rc3/lib64-msvc-14.1
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1211 ] _boost_TEST_VERSIONS =
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1286 ] Include debugging info:
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1288 ] _boost_INCLUDE_SEARCH_DIRS = C:/local/boost_1_69_0_b1_rc3/boost;C:/local/boost_1_69_0_b1_rc3/include;C:/local/boost_1_69_0_b1_rc3;PATHS;C:/boost/include;C:/boost;/sw/local/include
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1290 ] _boost_PATH_SUFFIXES =
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1310 ] location of version.hpp: C:/local/boost_1_69_0_b1_rc3/boost/version.hpp
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1334 ] version.hpp reveals boost 1.69.0
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1410 ] using user-specified Boost_COMPILER = -vc141
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1430 ] _boost_MULTITHREADED = -mt
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1506 ] _boost_RELEASE_ABI_TAG = -
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1508 ] _boost_DEBUG_ABI_TAG = -d
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1571 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/local/boost_1_69_0_b1_rc3/lib64-msvc-14.1;C:/local/boost_1_69_0_b1_rc3/lib;C:/local/boost_1_69_0_b1_rc3/stage/lib;C:/local/boost_1_69_0_b1_rc3/lib;C:/local/boost_1_69_0_b1_rc3/../lib;C:/local/boost_1_69_0_b1_rc3/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib_boost_LIBRARY_SEARCH_DIRS_DEBUG = C:/local/boost_1_69_0_b1_rc3/lib64-msvc-14.1;C:/local/boost_1_69_0_b1_rc3/lib;C:/local/boost_1_69_0_b1_rc3/stage/lib;C:/local/boost_1_69_0_b1_rc3/lib;C:/local/boost_1_69_0_b1_rc3/../lib;C:/local/boost_1_69_0_b1_rc3/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
CMake Warning at C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:18 (find_package)
CMake Warning at C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:847 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:963 (_Boost_COMPONENT_DEPENDENCIES)
C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1622 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:18 (find_package)
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1760 ] Searching for FILESYSTEM_LIBRARY_RELEASE: libboost_filesystem-vc141-mt-1_69;libboost_filesystem-vc141-mt;libboost_filesystem-mt-1_69;libboost_filesystem-mt;libboost_filesystem
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1813 ] Searching for FILESYSTEM_LIBRARY_DEBUG: libboost_filesystem-vc141-mt-d-1_69;libboost_filesystem-vc141-mt-d;libboost_filesystem-mt-d-1_69;libboost_filesystem-mt-d;libboost_filesystem-mt;libboost_filesystem
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1760 ] Searching for SYSTEM_LIBRARY_RELEASE: libboost_system-vc141-mt-1_69;libboost_system-vc141-mt;libboost_system-mt-1_69;libboost_system-mt;libboost_system
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1813 ] Searching for SYSTEM_LIBRARY_DEBUG: libboost_system-vc141-mt-d-1_69;libboost_system-vc141-mt-d;libboost_system-mt-d-1_69;libboost_system-mt-d;libboost_system-mt;libboost_system
-- [ C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:1887 ] Boost_FOUND = 1
CMake Error at C:/Users/User/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/183.4284.104/bin/cmake/win/share/cmake-3.12/Modules/FindBoost.cmake:2048 (message):
Unable to find the requested Boost libraries.
Boost version: 1.69.0
Boost include path: C:/local/boost_1_69_0_b1_rc3
Could not find the following static Boost libraries:
boost_filesystem
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.
Call Stack (most recent call first):
CMakeLists.txt:18 (find_package)
-- Configuring incomplete, errors occurred!
See also "D:/Cpp/BoostTesting/cmake-build-debug/CMakeFiles/CMakeOutput.log".
[Failed to reload]
CMake is looking for those specific files but I noticed that the -x64 indication is not part of the searched file names. My directory only contains 64-bit libraries:
Why is the Boost_ARCHITECTURE environment variable ignored? I expect it to add the missing -x64 to the searched file names. If I manually rename the libboost_filesystem-vc141-mt*.lib files they can be found by CMake. However, if I compile and link my simple main.cpp I'm getting a linker error:
====================[ Build | BoostTesting | Debug ]============================
C:\Users\User\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\183.4284.104\bin\cmake\win\bin\cmake.exe --build D:\Cpp\BoostTesting\cmake-build-debug --target BoostTesting -- -j 4
Scanning dependencies of target BoostTesting
[ 50%] Building CXX object CMakeFiles/BoostTesting.dir/main.cpp.obj
[100%] Linking CXX executable BoostTesting.exe
CMakeFiles\BoostTesting.dir/objects.a(main.cpp.obj): In function `boost::filesystem::path_traits::convert(char const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)':
C:/local/boost_1_69_0_b1_rc3/boost/filesystem/path.hpp:997: undefined reference to `boost::filesystem::path::codecvt()'
C:/local/boost_1_69_0_b1_rc3/boost/filesystem/path.hpp:997: undefined reference to `boost::filesystem::path_traits::convert(char const*, char const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, int> const&)'
CMakeFiles\BoostTesting.dir/objects.a(main.cpp.obj): In function `boost::filesystem::file_size(boost::filesystem::path const&)':
C:/local/boost_1_69_0_b1_rc3/boost/filesystem/operations.hpp:616: undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [CMakeFiles\BoostTesting.dir\build.make:88: BoostTesting.exe] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:72: CMakeFiles/BoostTesting.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:84: CMakeFiles/BoostTesting.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:117: BoostTesting] Error 2
main.cpp source code:
#include <iostream>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
int main(int argc, char *argv[]) {
if (argc < 2) {
std::cout << "Usage: tut1 path\n";
return 1;
}
std::cout << argv[1] << " " << file_size(argv[1]) << '\n';
return 0;
}
I'm pretty sure renaming the files is not the proper way of doing it. But even this way it doesn't work. What am I doing wrong and how do you properly use Boost in a simple C++ project like this one?
I believe find_package(Boost ...) has failed in your case as it won't be able to find the REQUIRED filesystem library for 64-bit GCC.
Make sure you have the GCC build of Boost available as well, because now you're only showing the V++ libraries.
You got CMake warning
New Boost version may have incorrect or missing dependencies and imported targets
because that CMake version does not prepared for boost 1.69 (Maybe latest CMake does...).
So CMake tries its best to recognize that version, so it still may work (see point 3 below).
#Felix Natter correctly pointed out above that Boost_ARCHITECTURE is handled only from CMake 3.13.
You can make it work without manual renaming, without GCC or MINGW, if you rebuild your boost with one of the file naming "layouts", your CMake recognizes.
(From your debug log these ones:
libboost_<module name>-<toolset>[-mt]-<ABI tag>-<boost version>
libboost_<module name>-<toolset>[-mt]-<ABI tag>
libboost_<module name>[-mt]-<ABI tag>-<boost version>
libboost_<module name>[-mt]
libboost_<module name>)
Unfortunately only the system layout matches, which means you need to separate Debug and Release builds in different "lib" folders. For explanation about the "layout" parameter see here.
So rebuild boost by specifying the --layout=system parameter, and also decide the variant by specifying variant=debug or variant=release.
As a starting point, on SF you can find the build log file:
https://sourceforge.net/projects/boost/files/boost-binaries/1.69.0/boost_1_69_0-64bitlog.txt/download
The last build "entry" in the file is for vc141, which is your version:
b2 -j%NUMBER_OF_PROCESSORS% --without-mpi --build-type=complete toolset=msvc-14.1 address-model=64 architecture=x86 --prefix=.\ --libdir=lib64-msvc-14.1 --includedir=garbage_headers install
Go to your boost source root and do > bootstrap first.
Make sure msvc-14.1 was detected.
Now build:
> b2 -a -j%NUMBER_OF_PROCESSORS% --without-mpi --with-filesystem toolset=msvc-14.1 address-model=64 architecture=x86 variant=debug --layout=system --prefix=C:\boost_build\debug
Do it for Release in a different target directory.
Change --prefix according to your needs. You may also specify --libdir and --includedir if the default is not good for you.
Of course, probably you need to modify your CMakeList file so that it can use both the Debug and Release variants...
So the best is to use a CMake version, which recognizes boost ver 1.69, and/or get a CMake-based version of boost, which includes 1.69.
set(Boost_ARCHITECTURE "-x64")
only works with cmake >= 3.13 [1] [2]. If you cannot upgrade to cmake 3.13+,
you can work around with:
set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID, "x64")
(not sure under what conditions this is set automatically)
[1] https://cmake.org/cmake/help/v3.12/module/FindBoost.html
[2] https://cmake.org/cmake/help/v3.13/module/FindBoost.html
It turns out it works when using the MinGW distribution with built-in Boost.
CMakeLists.txt:
cmake_minimum_required(VERSION 3.11.4)
project(BoostTesting)
set(CMAKE_CXX_STANDARD 17)
if(WIN32)
set(BOOST_ROOT "C:/MinGW")
endif ()
find_package(Boost 1.67.0 COMPONENTS filesystem REQUIRED)
if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(BoostTesting main.cpp)
target_link_libraries(BoostTesting ${Boost_LIBRARIES})
endif ()
main.cpp output:
D:\Cpp\BoostTesting\cmake-build-debug\BoostTesting.exe
Usage: tut1 path
Process finished with exit code 1
It compiled and linked successfully.
Related
So I'm trying to get my cmake to work with conan/boost. For this I have a simple conan file:
from conans import ConanFile
class Boost_Conan_Cmake_MinimalConfig(ConanFile):
name = "Boost_Conan_Cmake_MinimalConfig"
generators = "cmake"
options = {"shared": [True, False], "st": [True, False]}
default_options = {"shared": False, "st": True}
def requirements(self):
self.requires("boost/1.69.0#_/_")
self.options["boost"].shared = False
I call this via conan install . --build=missing. This runs perfectly fine and installs boost without problems. When investigating into the folder you can also find all the boost libraries etc.
Next comes my CMakeList.txt. It's pretty straight forward:
cmake_minimum_required(VERSION 3.0)
# CHANGE PROJECT NAME, SOURCES AND DEPENDANT TARGETS
project(boost-conan CXX)
include(conanbuildinfo.cmake)
conan_basic_setup()
set(TARGET_NAME ${PROJECT_NAME})
set(${TARGET_NAME}_SRC src/main.cpp)
find_package(Boost 1.69.0 REQUIRED COMPONENTS filesystem)
add_executable(test "src/main.cpp")
target_include_directories(test PUBLIC $(Boost_INCLUDE_DIRS))
target_link_libraries(test Boost::filesystem)
However, when I try to run this CMake file I get an error:
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041.
-- The CXX compiler identification is MSVC 19.26.28805.0
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: D:/boost-conan
-- WARN: CONAN_COMPILER variable not set, please make sure yourself that your compiler and version
matches your declared settings
CMake Error at C:/Program Files/CMake/share/cmake-
3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find Boost (missing: filesystem) (found suitable version
"1.69.0", minimum required is "1.69.0")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393(_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.16/Modules/FindBoost.cmake:2179 (find_package_handle_standard_args)
CMakeLists.txt:11 (find_package)
-- Configuring incomplete, errors occurred!
See also "D:/boost-conan/CMakeFiles/CMakeOutput.log".
Does anyone have an idea how to fix this? Or does anyone have an idea why this error occurs? The Error message alone doesn't really help...
Thanks in advance!
I have downloaded and build Boost as described in the Getting Started on Windows Documentation.
Now i want to link a sample program to that Version of Boost via CMake.
This is my current Folder Structure:
cmake-boost
- boost_1_73_0/ (Boost folder)
- build/
- CMakeLists.txt
- cmake-boost.cpp
This is the content of my CMakeLists.txt File:
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(cmake-boost LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(BOOST_ROOT "boost_1_73_0")
set(BOOST_LIBRARYDIR "boost_1_73_0/stage/lib")
find_package(Boost REQUIRED COMPONENTS regex)
if(Boost_FOUND)
message(STATUS "Success!")
endif()
add_executable(cmake-boost cmake-boost.cpp)
target_link_libraries(cmake-boost
PUBLIC
Boost::regex
)
If i run cmake .. from inside the build Folder all i get is the following Message saying it could not find the requested Library.
CMake Warning at C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:896 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1018 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1694 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:12 (find_package)
CMake Error at C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:2124 (message):
Unable to find the requested Boost libraries.
Boost version: 1.73.0
Boost include path:
C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0
Could not find the following Boost libraries:
boost_regex
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.
Call Stack (most recent call first):
CMakeLists.txt:12 (find_package)
-- Configuring incomplete, errors occurred!
What is wrong with my CMakeFile?
UPDATE:
Here is the output of cmake -DBoost_DEBUG=ON ..
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.17763.
-- The CXX compiler identification is MSVC 19.26.28806.0
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1181 ] _boost_TEST_VERSIONS = 1.70.0;1.70;1.69.0;1.69
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1183 ] Boost_USE_MULTITHREADED = TRUE
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1185 ] Boost_USE_STATIC_LIBS =
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1187 ] Boost_USE_STATIC_RUNTIME =
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1189 ] Boost_ADDITIONAL_VERSIONS =
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1191 ] Boost_NO_SYSTEM_PATHS =
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1259 ] Declared as CMake or Environmental Variables:
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1261 ] BOOST_ROOT = boost_1_73_0
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1263 ] BOOST_INCLUDEDIR =
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1265 ] BOOST_LIBRARYDIR = boost_1_73_0/stage/lib
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1267 ] _boost_TEST_VERSIONS = 1.70.0;1.70;1.69.0;1.69
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1342 ] Include debugging info:
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1344 ] _boost_INCLUDE_SEARCH_DIRS = boost_1_73_0/include;boost_1_73_0;PATHS;C:/local/boost_1_70_0;PATHS;C:/local/boost_1_70;PATHS;C:/local/boost_1_69_0;PATHS;C:/local/boost_1_69;PATHS;C:/boost/include;C:/boost;/sw/local/include
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1346 ] _boost_PATH_SUFFIXES = boost-1_70_0;boost_1_70_0;boost/boost-1_70_0;boost/boost_1_70_0;boost-1_70;boost_1_70;boost/boost-1_70;boost/boost_1_70;boost-1_69_0;boost_1_69_0;boost/boost-1_69_0;boost/boost_1_69_0;boost-1_69;boost_1_69;boost/boost-1_69;boost/boost_1_69
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1366 ] location of version.hpp: C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/boost/version.hpp
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1391 ] version.hpp reveals boost 1.73.0
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1447 ] Boost_LIB_PREFIX =
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1449 ] Boost_NAMESPACE = boost
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1484 ] guessed _boost_COMPILER = -vc141;-vc140
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1494 ] _boost_MULTITHREADED = -mt
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1578 ] _boost_RELEASE_ABI_TAG = -
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1580 ] _boost_DEBUG_ABI_TAG = -gd
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1643 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = boost_1_73_0/stage/lib;boost_1_73_0/lib;boost_1_73_0/stage/lib;boost_1_73_0/lib64-msvc-14.1;boost_1_73_0/lib64-msvc-14.0;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/lib;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/../lib;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/stage/lib;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/../lib64-msvc-14.1;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/../lib64-msvc-14.0;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/lib64-msvc-14.1;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/lib64-msvc-14.0;C:/local/boost_1_70_0/lib64-msvc-14.1;C:/local/boost_1_70_0/lib64-msvc-14.0;C:/local/boost_1_70/lib64-msvc-14.1;C:/local/boost_1_70/lib64-msvc-14.0;C:/local/boost_1_69_0/lib64-msvc-14.1;C:/local/boost_1_69_0/lib64-msvc-14.0;C:/local/boost_1_69/lib64-msvc-14.1;C:/local/boost_1_69/lib64-msvc-14.0;C:/boost/lib64-msvc-14.1;C:/boost/lib64-msvc-14.0;PATHS;C:/boost/lib;C:/boost;/sw/local/lib_boost_LIBRARY_SEARCH_DIRS_DEBUG = boost_1_73_0/stage/lib;boost_1_73_0/lib;boost_1_73_0/stage/lib;boost_1_73_0/lib64-msvc-14.1;boost_1_73_0/lib64-msvc-14.0;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/lib;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/../lib;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/stage/lib;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/../lib64-msvc-14.1;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/../lib64-msvc-14.0;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/lib64-msvc-14.1;C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0/lib64-msvc-14.0;C:/local/boost_1_70_0/lib64-msvc-14.1;C:/local/boost_1_70_0/lib64-msvc-14.0;C:/local/boost_1_70/lib64-msvc-14.1;C:/local/boost_1_70/lib64-msvc-14.0;C:/local/boost_1_69_0/lib64-msvc-14.1;C:/local/boost_1_69_0/lib64-msvc-14.0;C:/local/boost_1_69/lib64-msvc-14.1;C:/local/boost_1_69/lib64-msvc-14.0;C:/boost/lib64-msvc-14.1;C:/boost/lib64-msvc-14.0;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
CMake Warning at C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:896 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1018 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1694 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:12 (find_package)
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1833 ] Searching for REGEX_LIBRARY_RELEASE: boost_regex-vc141-mt-x64-1_73;boost_regex-vc141-mt;boost_regex-vc140-mt-x64-1_73;boost_regex-vc140-mt;boost_regex-mt-x64-1_73;boost_regex-mt;boost_regex-mt;boost_regex
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1886 ] Searching for REGEX_LIBRARY_DEBUG: boost_regex-vc141-mt-gd-x64-1_73;boost_regex-vc141-mt-gd;boost_regex-vc140-mt-gd-x64-1_73;boost_regex-vc140-mt-gd;boost_regex-mt-gd-x64-1_73;boost_regex-mt-gd;boost_regex-mt;boost_regex
-- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1960 ] Boost_FOUND = 1
CMake Error at C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:2124 (message):
Unable to find the requested Boost libraries.
Boost version: 1.73.0
Boost include path:
C:/Users/djc3ho/Documents/Programming/cpp/_Testing/cmake_boost/boost_1_73_0
Could not find the following Boost libraries:
boost_regex
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.
Call Stack (most recent call first):
CMakeLists.txt:12 (find_package)
I have noticed two things which are possible wrong:
This line -- [ C:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:1484 ] guessed _boost_COMPILER = -vc141;-vc140 but if i look at the .lib Files generated during the build of boost, they have the -vc142 in their name
It seems that cmake searching the right folder but with the wrong name of the library file. It uses the name boost_regex-vc141-mt-x64-1_73 but the lib files from my boost build startet with lib like libboost_regex-vc142-mt-x64-1_73.lib
I solved the first issue by adding -DBoost_COMPILER=-v142 to the cmake command. But i could not set the Boost_LIB_PREFIX with -DBoost_LIB_PREFIX=lib
I have found a solution.
As mentioned in the last edit I made to my question, the first issue with the compiler could be fixed with the -DBoost_COMPILER=-vc142 option.
The second could be solved by using the -DBoost_USE_STATIC_LIBS=ON.
So the set block in the CMakeLists for boost is now:
set(BOOST_ROOT "boost_1_73_0")
set(Boost_COMPILER "-vc142")
set(Boost_USE_STATIC_LIBS ON)
With these variables set, CMake runs without any problems.
I am trying to cross compile a c++ project on my ubuntu to run in raspberry pi. However, for some reason I cannot get my make file to work.
I have done few things.
I have arm environment setup that I can cross compile simple code (like hello world) on my pc and run in raspberry pi.
I have compiled boost with arm's gcc and g++, with methods found here: https://github.com/Yadoms/yadoms/wiki/Cross-compile-for-raspberry-PI
Basically is
nano ~/user-config.jam
using gcc : arm : arm-linux-gnueabihf-g++ ;
./b2 --with-atomic --with-chrono --with-date_time --with-filesystem --with-regex --with-serialization --with-thread --with-system --no-samples --no-tests toolset=gcc-arm link=static cxxflags=-fPIC
Yet, it always failed during linking
The sample I used is here:
#include <wiringPi.h>
#include <boost/filesystem.hpp>
#include <iostream>
#include <string>
int main (void)
{
boost::filesystem::create_directory("testFolder");
wiringPiSetup() ;
pinMode(0, OUTPUT) ;
for(;;)
{
digitalWrite (0, HIGH) ; delay (500) ;
digitalWrite (0, LOW) ; delay (500) ;
}
std::cout<<"hello world"<<std::endl;
return 0 ;
}
I have tested the wiringPi lib, it is working fine
And the CMakeLists.txt is
cmake_minimum_required(VERSION 3.0.0)
project(ExoController)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -pthread -lwiringPi -o3") #you can set with add_definitions("-Wall -std=c+11, etc")
set(Boost_USE_STATIC_LIBS ON)
set(Boost_INCLUDE_DIR /home/lowlimb/rpi-kernel/boost_1_71_0)
set(Boost_LIBRARY_DIR /home/lowlimb/rpi-kernel/boost_1_71_0/stage/lib)
set(CMAKE_SYSROOT /home/lowlimb/rpi-kernel/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/arm-linux-gnueabihf/sysroot)
set(CMAKE_C_COMPILER /home/lowlimb/rpi-kernel/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER /home/lowlimb/rpi-kernel/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++)
# Search for programs only in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# Search for libraries and headers only in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(Include_DIR include)
find_package(Boost 1.71.0 COMPONENTS serialization date_time filesystem REQUIRED)
if(NOT Boost_FOUND)
message(FATAL_ERROR "boost cannot be found")
endif()
#set(Eigen_INCLUDE_DIR /home/pi/Lib/eigen-eigen-323c052e1731)
#wiringPi library libwiringPi.so
set (WPI_PATH /home/lowlimb/rpi-kernel/WiringPi/wiringPi)
# Actually find the wiringPi library object
find_library(WPI_LIB wiringPi HINTS ${WPI_PATH} NO_CMAKE_FIND_ROOT_PATH)
# Alert the user if we do not find it
if(NOT WPI_LIB)
message(FATAL_ERROR “wiringPi library not found”)
endif()
include_directories(
${Boost_INCLUDE_DIR}
${WPI_PATH}
)
link_directories(${WPI_PATH} ${Boost_LIBRARY_DIR})
enable_testing()
add_executable(exo_o main.cpp)
target_link_libraries(exo_o PRIVATE ${WPI_PATH} ${Boost_LIBRARIES})
The output I got when make is:
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
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
/usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:29 (find_package)
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
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
/usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:29 (find_package)
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
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
/usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:29 (find_package)
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
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
/usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:29 (find_package)
-- Boost version: 1.71.0
-- Found the following Boost libraries:
-- serialization
-- date_time
-- filesystem
-- system
-- Configuring done
WARNING: Target "exo_o" requests linking to directory "/home/lowlimb/rpi-kernel/WiringPi/wiringPi". Targets may link only to libraries. CMake is dropping the item.
-- Generating done
-- Build files have been written to: /home/lowlimb/Documents/testCode/build
Scanning dependencies of target exo_o
[ 50%] Building CXX object CMakeFiles/exo_o.dir/main.cpp.o
[100%] Linking CXX executable exo_o
/home/lowlimb/rpi-kernel/boost_1_71_0/stage/lib/libboost_filesystem.a(operations.o): In function `boost::filesystem::detail::current_path(boost::system::error_code*)':
operations.cpp:(.text+0xbe): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned int, unsigned int, char const*, unsigned int)'
operations.cpp:(.text+0x140): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned int, unsigned int, char const*, unsigned int)'
(I exclude most of the error since they look like a similar error).
I really don't understand why the make file cannot compile boost correctly. It did find the correct version of boost I used (the original version I installed on this computer is 1.6, only the arm's one is 1.71.0), why it still cannot function properly?
Additional Info
I would like to add more info to this question, when I first make the project, something I believe is wrong showed up
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
However, in my CMakeLists.txt I have already assign a different cxx complier, why it still used /usr/bin/c++?
I am working on a project and using CMake to build the project. The project works flawlessly on Windows but I want to make a Linux variant using the same CMakeLists.txt file.
Here is the relevant part of my CMakeLists.txt file:
if(WIN32)
set(BOOST_ROOT "C:\\Boost")
set(BOOST_INCLUDEDIR "C:\\Boost\\include\\boost-1_68")
endif(WIN32)
if(UNIX)
set(Boost_DEBUG ON)
set(Boost_NAMESPACE "libboost")
set(Boost_USE_STATIC_RUNTIME OFF)
endif(UNIX)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_DEBUG_LIBS OFF)
find_package(Boost REQUIRED random filesystem serialization)
include_directories(${Boost_INCLUDE_DIRS})
I installed Boost using the command sudo apt install libboost_all-dev.
I get the errors shown below when I try to configure the project.
CMake Error at /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/
FindBoost.cmake:2044 (message):
Unable to find the requested Boost libraries.
Boost version: 1.65.1
Boost include path: /usr/include
Could not find the following static Boost libraries:
libboost_random
libboost_filesystem
libboost_serialization
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.
Call Stack (most recent call first):
CMakeLists.txt:49 (find_package)
...
Here is the full output.
/opt/clion-2018.2/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/dave/CLionProjects/FNDice-win
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1121 ] _boost_TEST_VERSIONS = 1.68.0;1.68;1.67.0;1.67;1.66.0;1.66;1.65.1;1.65.0;1.65;1.64.0;1.64;1.63.0;1.63;1.62.0;1.62;1.61.0;1.61;1.60.0;1.60;1.59.0;1.59;1.58.0;1.58;1.57.0;1.57;1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;1.50;1.49.0;1.49;1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1123 ] Boost_USE_MULTITHREADED = TRUE
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1125 ] Boost_USE_STATIC_LIBS = ON
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1127 ] Boost_USE_STATIC_RUNTIME = OFF
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1129 ] Boost_ADDITIONAL_VERSIONS =
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1131 ] Boost_NO_SYSTEM_PATHS =
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1199 ] Declared as CMake or Environmental Variables:
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1201 ] BOOST_ROOT =
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1203 ] BOOST_INCLUDEDIR =
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1205 ] BOOST_LIBRARYDIR =
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1207 ] _boost_TEST_VERSIONS = 1.68.0;1.68;1.67.0;1.67;1.66.0;1.66;1.65.1;1.65.0;1.65;1.64.0;1.64;1.63.0;1.63;1.62.0;1.62;1.61.0;1.61;1.60.0;1.60;1.59.0;1.59;1.58.0;1.58;1.57.0;1.57;1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;1.50;1.49.0;1.49;1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1282 ] Include debugging info:
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1284 ] _boost_INCLUDE_SEARCH_DIRS = PATHS;C:/boost/include;C:/boost;/sw/local/include
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1286 ] _boost_PATH_SUFFIXES = boost-1_68_0;boost_1_68_0;boost/boost-1_68_0;boost/boost_1_68_0;boost-1_68;boost_1_68;boost/boost-1_68;boost/boost_1_68;boost-1_67_0;boost_1_67_0;boost/boost-1_67_0;boost/boost_1_67_0;boost-1_67;boost_1_67;boost/boost-1_67;boost/boost_1_67;boost-1_66_0;boost_1_66_0;boost/boost-1_66_0;boost/boost_1_66_0;boost-1_66;boost_1_66;boost/boost-1_66;boost/boost_1_66;boost-1_65_1;boost_1_65_1;boost/boost-1_65_1;boost/boost_1_65_1;boost-1_65_0;boost_1_65_0;boost/boost-1_65_0;boost/boost_1_65_0;boost-1_65;boost_1_65;boost/boost-1_65;boost/boost_1_65;boost-1_64_0;boost_1_64_0;boost/boost-1_64_0;boost/boost_1_64_0;boost-1_64;boost_1_64;boost/boost-1_64;boost/boost_1_64;boost-1_63_0;boost_1_63_0;boost/boost-1_63_0;boost/boost_1_63_0;boost-1_63;boost_1_63;boost/boost-1_63;boost/boost_1_63;boost-1_62_0;boost_1_62_0;boost/boost-1_62_0;boost/boost_1_62_0;boost-1_62;boost_1_62;boost/boost-1_62;boost/boost_1_62;boost-1_61_0;boost_1_61_0;boost/boost-1_61_0;boost/boost_1_61_0;boost-1_61;boost_1_61;boost/boost-1_61;boost/boost_1_61;boost-1_60_0;boost_1_60_0;boost/boost-1_60_0;boost/boost_1_60_0;boost-1_60;boost_1_60;boost/boost-1_60;boost/boost_1_60;boost-1_59_0;boost_1_59_0;boost/boost-1_59_0;boost/boost_1_59_0;boost-1_59;boost_1_59;boost/boost-1_59;boost/boost_1_59;boost-1_58_0;boost_1_58_0;boost/boost-1_58_0;boost/boost_1_58_0;boost-1_58;boost_1_58;boost/boost-1_58;boost/boost_1_58;boost-1_57_0;boost_1_57_0;boost/boost-1_57_0;boost/boost_1_57_0;boost-1_57;boost_1_57;boost/boost-1_57;boost/boost_1_57;boost-1_56_0;boost_1_56_0;boost/boost-1_56_0;boost/boost_1_56_0;boost-1_56;boost_1_56;boost/boost-1_56;boost/boost_1_56;boost-1_55_0;boost_1_55_0;boost/boost-1_55_0;boost/boost_1_55_0;boost-1_55;boost_1_55;boost/boost-1_55;boost/boost_1_55;boost-1_54_0;boost_1_54_0;boost/boost-1_54_0;boost/boost_1_54_0;boost-1_54;boost_1_54;boost/boost-1_54;boost/boost_1_54;boost-1_53_0;boost_1_53_0;boost/boost-1_53_0;boost/boost_1_53_0;boost-1_53;boost_1_53;boost/boost-1_53;boost/boost_1_53;boost-1_52_0;boost_1_52_0;boost/boost-1_52_0;boost/boost_1_52_0;boost-1_52;boost_1_52;boost/boost-1_52;boost/boost_1_52;boost-1_51_0;boost_1_51_0;boost/boost-1_51_0;boost/boost_1_51_0;boost-1_51;boost_1_51;boost/boost-1_51;boost/boost_1_51;boost-1_50_0;boost_1_50_0;boost/boost-1_50_0;boost/boost_1_50_0;boost-1_50;boost_1_50;boost/boost-1_50;boost/boost_1_50;boost-1_49_0;boost_1_49_0;boost/boost-1_49_0;boost/boost_1_49_0;boost-1_49;boost_1_49;boost/boost-1_49;boost/boost_1_49;boost-1_48_0;boost_1_48_0;boost/boost-1_48_0;boost/boost_1_48_0;boost-1_48;boost_1_48;boost/boost-1_48;boost/boost_1_48;boost-1_47_0;boost_1_47_0;boost/boost-1_47_0;boost/boost_1_47_0;boost-1_47;boost_1_47;boost/boost-1_47;boost/boost_1_47;boost-1_46_1;boost_1_46_1;boost/boost-1_46_1;boost/boost_1_46_1;boost-1_46_0;boost_1_46_0;boost/boost-1_46_0;boost/boost_1_46_0;boost-1_46;boost_1_46;boost/boost-1_46;boost/boost_1_46;boost-1_45_0;boost_1_45_0;boost/boost-1_45_0;boost/boost_1_45_0;boost-1_45;boost_1_45;boost/boost-1_45;boost/boost_1_45;boost-1_44_0;boost_1_44_0;boost/boost-1_44_0;boost/boost_1_44_0;boost-1_44;boost_1_44;boost/boost-1_44;boost/boost_1_44;boost-1_43_0;boost_1_43_0;boost/boost-1_43_0;boost/boost_1_43_0;boost-1_43;boost_1_43;boost/boost-1_43;boost/boost_1_43;boost-1_42_0;boost_1_42_0;boost/boost-1_42_0;boost/boost_1_42_0;boost-1_42;boost_1_42;boost/boost-1_42;boost/boost_1_42;boost-1_41_0;boost_1_41_0;boost/boost-1_41_0;boost/boost_1_41_0;boost-1_41;boost_1_41;boost/boost-1_41;boost/boost_1_41;boost-1_40_0;boost_1_40_0;boost/boost-1_40_0;boost/boost_1_40_0;boost-1_40;boost_1_40;boost/boost-1_40;boost/boost_1_40;boost-1_39_0;boost_1_39_0;boost/boost-1_39_0;boost/boost_1_39_0;boost-1_39;boost_1_39;boost/boost-1_39;boost/boost_1_39;boost-1_38_0;boost_1_38_0;boost/boost-1_38_0;boost/boost_1_38_0;boost-1_38;boost_1_38;boost/boost-1_38;boost/boost_1_38;boost-1_37_0;boost_1_37_0;boost/boost-1_37_0;boost/boost_1_37_0;boost-1_37;boost_1_37;boost/boost-1_37;boost/boost_1_37;boost-1_36_1;boost_1_36_1;boost/boost-1_36_1;boost/boost_1_36_1;boost-1_36_0;boost_1_36_0;boost/boost-1_36_0;boost/boost_1_36_0;boost-1_36;boost_1_36;boost/boost-1_36;boost/boost_1_36;boost-1_35_1;boost_1_35_1;boost/boost-1_35_1;boost/boost_1_35_1;boost-1_35_0;boost_1_35_0;boost/boost-1_35_0;boost/boost_1_35_0;boost-1_35;boost_1_35;boost/boost-1_35;boost/boost_1_35;boost-1_34_1;boost_1_34_1;boost/boost-1_34_1;boost/boost_1_34_1;boost-1_34_0;boost_1_34_0;boost/boost-1_34_0;boost/boost_1_34_0;boost-1_34;boost_1_34;boost/boost-1_34;boost/boost_1_34;boost-1_33_1;boost_1_33_1;boost/boost-1_33_1;boost/boost_1_33_1;boost-1_33_0;boost_1_33_0;boost/boost-1_33_0;boost/boost_1_33_0;boost-1_33;boost_1_33;boost/boost-1_33;boost/boost_1_33
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1306 ] location of version.hpp: /usr/include/boost/version.hpp
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1330 ] version.hpp reveals boost 1.65.1
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1416 ] guessed _boost_COMPILER = -gcc73
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1426 ] _boost_MULTITHREADED = -mt
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1502 ] _boost_RELEASE_ABI_TAG = -
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1504 ] _boost_DEBUG_ABI_TAG = -d
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1567 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/include/lib;/usr/include/../lib;/usr/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib_boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/include/lib;/usr/include/../lib;/usr/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1756 ] Searching for RANDOM_LIBRARY_RELEASE: libboost_random-gcc73-mt-1_65_1;libboost_random-gcc73-mt;libboost_random-mt-1_65_1;libboost_random-mt;libboost_random
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1809 ] Searching for RANDOM_LIBRARY_DEBUG: libboost_random-gcc73-mt-d-1_65_1;libboost_random-gcc73-mt-d;libboost_random-mt-d-1_65_1;libboost_random-mt-d;libboost_random-mt;libboost_random
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1756 ] Searching for FILESYSTEM_LIBRARY_RELEASE: libboost_filesystem-gcc73-mt-1_65_1;libboost_filesystem-gcc73-mt;libboost_filesystem-mt-1_65_1;libboost_filesystem-mt;libboost_filesystem
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1809 ] Searching for FILESYSTEM_LIBRARY_DEBUG: libboost_filesystem-gcc73-mt-d-1_65_1;libboost_filesystem-gcc73-mt-d;libboost_filesystem-mt-d-1_65_1;libboost_filesystem-mt-d;libboost_filesystem-mt;libboost_filesystem
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1756 ] Searching for SERIALIZATION_LIBRARY_RELEASE: libboost_serialization-gcc73-mt-1_65_1;libboost_serialization-gcc73-mt;libboost_serialization-mt-1_65_1;libboost_serialization-mt;libboost_serialization
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1809 ] Searching for SERIALIZATION_LIBRARY_DEBUG: libboost_serialization-gcc73-mt-d-1_65_1;libboost_serialization-gcc73-mt-d;libboost_serialization-mt-d-1_65_1;libboost_serialization-mt-d;libboost_serialization-mt;libboost_serialization
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1756 ] Searching for SYSTEM_LIBRARY_RELEASE: libboost_system-gcc73-mt-1_65_1;libboost_system-gcc73-mt;libboost_system-mt-1_65_1;libboost_system-mt;libboost_system
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1809 ] Searching for SYSTEM_LIBRARY_DEBUG: libboost_system-gcc73-mt-d-1_65_1;libboost_system-gcc73-mt-d;libboost_system-mt-d-1_65_1;libboost_system-mt-d;libboost_system-mt;libboost_system
-- [ /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:1883 ] Boost_FOUND = 1
CMake Error at /opt/clion-2018.2/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:2044 (message):
Unable to find the requested Boost libraries.
Boost version: 1.65.1
Boost include path: /usr/include
Could not find the following static Boost libraries:
libboost_random
libboost_filesystem
libboost_serialization
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.
Call Stack (most recent call first):
CMakeLists.txt:49 (find_package)
-- Found wxWidgets: -L/usr/local/lib;-pthread;;;-lwx_baseu_net-3.1;-lwx_gtk3u_gl-3.1;-lwx_gtk3u_core-3.1;-lwx_baseu-3.1;-lwx_gtk3u_webview-3.1;-lwx_gtk3u_adv-3.1 (found version "3.1.1")
-- Configuring incomplete, errors occurred!
See also "/home/dave/CLionProjects/FNDice-win/cmake-build-debug/CMakeFiles/CMakeOutput.log".
[Failed to reload]
Verify that the libraries are in the include path. This may be a bug in your cmake package or your Boost package.
For me, on Fedora, these libraries are in /usr/lib64. On Ubuntu (and from what I could find, Linux Mint) they should be in /usr/lib/x86_64-linux-gnu.
A temporary solution would be to add the directory to the include_directories statement. You might also find this question helpful.
Now that I've looked through other peoples solutions for several hours and could not find quite the right answer for my problem I would like to bring my specific problem to you. :)
I am trying to build vsomeip with CMake. For that I previously built boost 1.55, however, I get the following errors in CMake:
The C compiler identification is MSVC 19.0.24215.1
The CXX compiler identification is MSVC 19.0.24215.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visua Studio 14.0/VC/bin/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Setting build type to 'RelWithDebInfo' as none was specified.
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
CMake Error at C:/Program Files/CMake/share/cmake-3.12/Modules/FindBoost.cmake:2025 (message):
Unable to find the requested Boost libraries.
Boost version: 1.55.0
Boost include path: C:/Program Files/boost/boost_1_55_0
Could not find the following static Boost libraries:
boost_system
boost_thread
boost_log
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.
Call Stack (most recent call first):
CMakeLists.txt:99 (find_package)
Boost was not found!
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Systemd was not found, watchdog disabled!
using MSVC Compiler
Predefined unicast address: 127.0.0.1
Predefined diagnosis address: 0x00
Predefined routing application: vsomeipd
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
CMake Warning at CMakeLists.txt:335 (message):
Doxygen is not installed. Documentation can not be built.
CMake Warning at CMakeLists.txt:374 (message):
asciidoc is not installed. Readme can not be built.
GTEST_ROOT is not defined. For building the tests the variable
GTEST_ROOT has to be defined. Tests can not be built.
Configuring incomplete, errors occurred!
See also "D:/Desktop/BACHELORARBEIT/vsomeip/build/CMakeFiles /CMakeOutput.log".
See also "D:/Desktop/BACHELORARBEIT/vsomeip/build/CMakeFiles/CMakeError.log".
It cannot find the static Boost libraries. Now, I've tried playing around with the CMakeList.txt and here is the part of it that would be supposed to handle the linking:
# Boost
set(BOOST_INCLUDE_DIR C:/Program Files/Boost/boost_1_55_0)
set(BOOST_LIBRARYDIR C:/Program Files/Boost/boost_1_55_0/stage/libs)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
find_package( Boost 1.55 COMPONENTS system thread log REQUIRED )
include_directories( ${Boost_INCLUDE_DIR} )
if(Boost_FOUND)
if(Boost_LIBRARY_DIR)
MESSAGE( STATUS "Boost_LIBRARY_DIR not empty using it: ${Boost_LIBRARY_DIR}" )
else()
if(BOOST_LIBRARYDIR)
MESSAGE( STATUS "Boost_LIBRARY_DIR empty but BOOST_LIBRARYDIR is set setting Boost_LIBRARY_DIR to: ${BOOST_LIBRARYDIR}" )
set(Boost_LIBRARY_DIR ${BOOST_LIBRARYDIR})
endif()
endif()
else()
MESSAGE( STATUS "Boost was not found!")
endif()
I have also tried using a newer boost version (1.67) with same results. Any help will be dearly appreciated!
Check if your compiled libraries are in the following directory:
C:/Program Files/Boost/boost_1_55_0/stage/libs
If not, set your lib folder directory path:
set(BOOST_LIBRARYDIR path_to_lib_directory)
As #Tsyvarev suggested I used set(Boost_DEBUG ON) to trace the exact locations and files that CMake was looking for and the discovered several problems:
1.) Setting the path to "C:/Program Files/Boost/boost_1_55_0"
causes problems, because of the space in the path
2.) It searched for the libraries covering multiple formats like: boost_thread-vc141-mt-gd-x32-1_55.lib.
However, when I built boost with incorrect parameters, so my libs were built like this:
libboost_thread-vc-mt-1_55.lib, which is not of the correct format.
3.) Unfortunately adding other options when building boost, e.g.:
b2 toolset=msvc-14.1 address-model=32 --build-type=complete
caused other errors. Also building boost_1_67_0 manually worked for me at all.
My solution to the problem was to simply take one of the third-party download( https://dl.bintray.com/boostorg/release/1.67.0/binaries/). This way all the libraries were built correctly and I had no trouble linking to them.