Why did I report an error as soon as I introduced libTorch, I tried it many times, please help me to see what's going on. Thank you
I tried debug version and Release version based on CPU, this error always exists;
My CmakeLists.txt:
cmake_minimum_required(VERSION 3.19)
project(Demo3)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_PREFIX_PATH "K:/Qt/Qt5.12.10/5.12.10/msvc2017_64")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(QT_VERSION 5)
set(REQUIRED_LIBS Core Gui Widgets)
set(REQUIRED_LIBS_QUALIFIED Qt5::Core Qt5::Gui Qt5::Widgets)
############ add libTorch ####################
set(Torch_DIR K:\\pytorchModel\\libtorch\\share\\cmake\\Torch)
find_package(Torch REQUIRED)
include_directories(K:\\pytorchModel\\libtorch\\include K:\\pytorchModel\\libtorch\\include\\torch\\csrc\\api\\include\\torch)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(Demo3 "${TORCH_LIBRARIES}")
if (NOT CMAKE_PREFIX_PATH)
message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it "
"(-DCMAKE_PREFIX_PATH=\"path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)")
endif ()
find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED)
target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED})
if (WIN32)
set(DEBUG_SUFFIX)
if (CMAKE_BUILD_TYPE MATCHES "Debug")
set(DEBUG_SUFFIX "d")
endif ()
set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}")
if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..")
if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..")
endif ()
endif ()
if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
endif ()
foreach (QT_LIB ${REQUIRED_LIBS})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${QT_INSTALL_PATH}/bin/Qt${QT_VERSION}${QT_LIB}${DEBUG_SUFFIX}.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>")
endforeach (QT_LIB)
endif ()
The error after I run:
main.cpp
K:\pytorchModel\libtorch\include\c10/macros/Macros.h(189): warning C4067: 预处理器指令后有意外标记 - 应输入换行符
K:\pytorchModel\libtorch\include\c10/util/Optional.h(181): warning C4624: “c10::constexpr_storage_t<T>”: 已将析构函数隐式定义为“已删除”
with
[
T=at::Tensor
]
K:\pytorchModel\libtorch\include\c10/util/Optional.h(361): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t<T>”的引用
with
[
T=at::Tensor
]
K:\pytorchModel\libtorch\include\c10/util/Optional.h(418): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base<T>”的引用
with
[
T=std::vector<std::vector<torch::autograd::profiler::LegacyEvent,std::allocator<torch::autograd::profiler::LegacyEvent>>,std::allocator<std::vector<torch::autograd::profiler::LegacyEvent,std::allocator<torch::autograd::profiler::LegacyEvent>>>>
]
K:\pytorchModel\libtorch\include\c10/util/Optional.h(361): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t<T>”的引用
with
[
T=std::vector<std::vector<torch::autograd::profiler::LegacyEvent,std::allocator<torch::autograd::profiler::LegacyEvent>>,std::allocator<std::vector<torch::autograd::profiler::LegacyEvent,std::allocator<torch::autograd::profiler::LegacyEvent>>>>
]
K:\pytorchModel\libtorch\include\c10/util/Optional.h(418): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base<T>”的引用
with
[
T=std::vector<std::vector<torch::autograd::profiler::LegacyEvent,std::allocator<torch::autograd::profiler::LegacyEvent>>,std::allocator<std::vector<torch::autograd::profiler::LegacyEvent,std::allocator<torch::autograd::profiler::LegacyEvent>>>>
]
K:\pytorchModel\libtorch\include\c10/util/Optional.h(418): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase<std::vector<std::vector<torch::autograd::profiler::LegacyEvent,std::allocator<torch::autograd::profiler::LegacyEvent>>,std::allocator<std::vector<torch::autograd::profiler::LegacyEvent,std::allocator<torch::autograd::profiler::LegacyEvent>>>>>”的引用
K:\pytorchModel\libtorch\include\torch/csrc/autograd/profiler_legacy.h(562): note: 查看对正在编译的 类 模板 实例化“c10::optional<std::vector<std::vector<torch::autograd::profiler::LegacyEvent,std::allocator<torch::autograd::profiler::LegacyEvent>>,std::allocator<std::vector<torch::autograd::profiler::LegacyEvent,std::allocator<torch::autograd::profiler::LegacyEvent>>>>>”的引用
K:\pytorchModel\libtorch\include\c10/util/Optional.h(387): warning C4624: “c10::trivially_copyable_optimization_optional_base<T>”: 已将析构函数隐式定义为“已删除”
with
[
T=std::vector<std::vector<torch::autograd::profiler::LegacyEvent,std::allocator<torch::autograd::profiler::LegacyEvent>>,std::allocator<std::vector<torch::autograd::profiler::LegacyEvent,std::allocator<torch::autograd::profiler::LegacyEvent>>>>
]
K:\pytorchModel\libtorch\include\c10/util/Optional.h(181): warning C4624: “c10::constexpr_storage_t<T>”: 已将析构函数隐式定义为“已删除”
with
[
T=std::vector<at::Tensor,std::allocator<at::Tensor>>
]
K:\pytorchModel\libtorch\include\c10/util/Optional.h(361): note: 查看对正在编译的 类 模板 实例化“c10::constexpr_storage_t<T>”的引用
with
[
T=std::vector<at::Tensor,std::allocator<at::Tensor>>
]
K:\pytorchModel\libtorch\include\c10/util/Optional.h(418): note: 查看对正在编译的 类 模板 实例化“c10::trivially_copyable_optimization_optional_base<T>”的引用
with
[
T=std::vector<at::Tensor,std::allocator<at::Tensor>>
]
K:\pytorchModel\libtorch\include\c10/util/Optional.h(418): note: 查看对正在编译的 别名 模板 实例化“c10::OptionalBase<std::vector<at::Tensor,std::allocator<at::Tensor>>>”的引用
K:\pytorchModel\libtorch\include\torch\csrc\api\include\torch/optim/lbfgs.h(44): note: 查看对正在编译的 类 模板 实例化“c10::optional<std::vector<at::Tensor,std::allocator<at::Tensor>>>”的引用
K:\pytorchModel\libtorch\include\c10/util/Optional.h(387): warning C4624: “c10::trivially_copyable_optimization_optional_base<T>”: 已将析构函数隐式定义为“已删除”
with
[
T=std::vector<at::Tensor,std::allocator<at::Tensor>>
]
NMAKE : fatal error U1077: “"D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29910\bin\Hostx64\x64\cl.exe"”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\nmake.exe"”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\nmake.exe"”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\nmake.exe"”: 返回代码“0x2”
Stop.
why is that? Is there a problem with my CmakeLists.txt configuration?
Related
While using the Unix Makefiles generator I have added the following to a CMakeLists.txt file:
add_custom_target(maintainer-clean
# The current directory is CMAKE_CURRENT_BINARY_DIR.
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cwm4/scripts/cmake_maintainer_clean.sh $(MAKE) \"${GITACHE_PACKAGES}\"
)
This cmake_maintainer_clean.sh script is make specific, and it needs to use $(MAKE) in the generated Makefile when calling the script.
However, when switching to the generator Ninja this custom command is put as-is in the build.ninja file, causing the $ of the $(MAKE) to cause problems (ninja refuses to run any target, failing to parse build.ninja).
Therefore, I wish to make this generator-specific. How can I use $(MAKE) as first argument to the script when the generator is Unix Makefiles and something else, without a $ - e.g. "ninja" - when the generator is Ninja?
Can I do something like:
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cwm4/scripts/cmake_maintainer_clean.sh $<UNIX:$(MAKE),ninja> \"${GITACHE_PACKAGES}\"
?
I would make separate presets for each generator, so you can associate a particular environment variable with it. Here is how the CMakePresets.json file may look like:
{
"version": 2,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20,
"patch": 0
},
"configurePresets": [
{
"name": "base",
"binaryDir": "${sourceDir}/build",
"hidden": true
},
{
"name": "Ninja",
"inherits": "base",
"displayName": "Ninja Config",
"generator": "Ninja",
"environment": {
"SCRIPT_ARG": "Ninja"
}
},
{
"name": "Make",
"inherits": "base",
"displayName": "Make Config",
"generator": "Unix Makefiles",
"environment": {
"SCRIPT_ARG": "Make"
}
}
]
}
Where the SCRIPT_ARG can be read later inside of the CMakeLists.txt configuration:
cmake_minimum_required(VERSION 3.20)
project(Hello)
add_executable(Hello main.cpp)
add_custom_target(my-script
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/script.sh $ENV{SCRIPT_ARG}
)
add_dependencies(Hello my-script)
Providing script.sh is as simple as this:
#!/bin/sh
echo "Hello from script, $1!"
You will end up with the following output during build phase:
% cmake --preset Make
...
% cmake --build build
Hello from script, Make!
[ 0%] Built target my-script
...
Corresponding output for Ninja generator would be:
% cmake --preset Ninja
...
% cmake --build build
Hello from script, Ninja!
[ 0%] Built target my-script
...
If you need something more complex than an environment variable, you can introduce condition statement based on value of CMAKE_GENERATOR:
cmake_minimum_required(VERSION 3.20)
project(Hello)
add_executable(Hello main.cpp)
if(CMAKE_GENERATOR STREQUAL Ninja)
add_custom_target(my-script COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/script.sh $ENV{SCRIPT_ARG})
elseif(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
add_custom_target(my-script COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/another_script.sh)
endif()
add_dependencies(Hello my-script)
The provided solutions work at build step, and for the part whether it's possible to distinguish between generators during build system generation phase (e.g. with use of generator expressions) i don't think it's possible, because the configuration is generator-agnostic at this point.
I'm currently working on a project and I'm trying to convert a jamroot script into a CMake script. Unfortunately, I'm facing some difficulties and I'm wondering if someone could help me.
in my jamroot I have the following:
import os ;
import common ;
local APVERSION = [ os.environ APVERSION ] ;
if ( --veracode in [ modules.peek : ARGV ] ) {
.gccflags = -gdwarf-2 -g3 -O0 -fno-builtin ;
}
project myProject
: requirements
<include>inc
<cxxflags>"-fPIC"
<define>QUICK_SUN=1
;
#library
use-project /system : $(G_ROOT)/system ;
alias tbb :/used_tbb//tbb/<link>shared/<optimization>speed ;
and this is what I did in my CMakeLists.txt file:
cmake_minimum_required (VERSION 2.8.11)
#Local Variables
set(APVERSION, [ os.environ APVERSION ]) #I don't know how to import os in CMake?
IF ( --veracode in [ modules.peek : ARGV ] )
.gccflags = -gdwarf-2 -g3 -O0 -fno-builtin
ENDIF()
project(myProject)
include_directories(inc)
IF(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} #[[-Wall -Wextra]] -fno-strict-aliasing -fPIC -speed ${.gccflags}")
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -speed")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
add_definitions(-DQUICK_SUN=1)
link_libraries(${G_ROOT}/system)
#for alias tbb, I can't figure out how to do it
can someone help me?
thank you
Within a CMakeLists.txt file, you can write something like:
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
but what if I want to "prime" that variable before the invocation of CMake? Using the environment, perhaps? Is this possible?
The documentation says it is empty by default, but I was hoping to diverge from this default.
CMAKE_MODULE_PATH is not an "cmake-env-variable". It won't read same name environment variable to initialize it automatically. As an example, CMAKE_EXPORT_COMPILE_COMMANDS can be initialized from env var (ref).
An alternative for your situation:
if(DEFINED ENV{CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "$ENV{CMAKE_MODULE_PATH}")
else()
message(WARNING "CMAKE_MODULE_PATH env var not defined, using the default empty one")
endif()
My preferred option would be to pass this to cmake at the time of configuration.
Using command line options
cmake -D "CMAKE_MODULE_PATH:STRING=${CMAKE_MODULE_PATH}" -S ...
or
Using a cache configuration script
# initialCache.cmake
set(CMAKE_MODULE_PATH $ENV{CMAKE_MODULE_PATH} CACHE STRING "path to look for cmake modules")
cmake -C initialCache.cmake -S ...
or
Using a preset
CMakePresets.json
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 19,
"patch": 0
},
"configurePresets": [
{
"name": "mypreset",
"displayName": "My preset",
"description": "Preset using the environment variable to set CMAKE_MODULE_PATH",
"cacheVariables": {
"CMAKE_MODULE_PATH": {
"type": "STRING",
"value": "$env{CMAKE_MODULE_PATH}"
}
}
}
]
}
cmake --preset mypreset -S ...
I have built bullet3-3.08 on Windows using cmake (commands have been executed from the build folder created in the bullet3-3.08 directory):
cmake -G "Visual Studio 15 2017" -A x64 -D "CMAKE_INSTALL_PREFIX:PATH=C:/MyLibs/bullet3-3.08" -D "USE_MSVC_RUNTIME_LIBRARY_DLL=ON" -D "INSTALL_LIBS=ON" ..
cmake --build . --config Release --parallel 8 --target install
I have an application which uses MD/MDd runtime library so I have built Bullet with the following option: USE_MSVC_RUNTIME_LIBRARY_DLL=ON. Bullet is built as a static library by default. I use Visual Studio 2017 and build my application using cmake. When I link to Bullet I get many linker errors (LNK2019, LNK2001), for example:
error LNK2019: unresolved external symbol "public: __cdecl btCollisionDispatcher::btCollisionDispatcher(class btCollisionConfiguration *)" (??0btCollisionDispatcher##QEAA#PEAVbtCollisionConfiguration###Z) referenced in function main
error LNK2001: unresolved external symbol "public: virtual void __cdecl btCollisionShape::getBoundingSphere(class btVector3 &,float &)const " (?getBoundingSphere#btCollisionShape##UEBAXAEAVbtVector3##AEAM#Z)
I use direct library paths in CMakeLists.txt:
target_link_libraries(${executableName} "C:/MyLibs/bullet3-3.08/lib/Bullet3Collision.lib"
"C:/MyLibs/bullet3-3.08/lib/Bullet3Dynamics.lib"
"C:/MyLibs/bullet3-3.08/lib/LinearMath.lib")
Here is CMakeSettings.json:
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [
"msvc_x64_x64"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "Release",
"inheritEnvironments": [
"msvc_x64_x64"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
}
]
}
What is wrong ?
As Bullet provides a BulletConfig.cmake file it is quite simple to link against Bullet.
First you need to install Bullet (if not done so) and add -DCMAKE_PREFIX_PATH=C:/MyLibs/bullet3-3.08 (or the appropriate installation directory) to your cmake command line.
Then in your CMakeLists.txt file you need to add
find_package(Bullet REQUIRED)
# your add_executable call follows here
add_executable(${executableName} .......)
target_compile_definitions(${executableName} PRIVATE ${BULLET_DEFINITIONS})
target_include_directories(${executableName} PRIVATE ${BULLET_INCLUDE_DIRS})
target_link_libraries(${executableName} PRIVATE ${BULLET_LIBRARIES})
This should be the steps necessary to link to Bullet.
I'm trying to install something (emulationstation modified on a Raspberry 2), which require at some point to use a CMake command that need the Boost library to execute properly.
Here is the debug of my command line:
root#retropie:/home/pi/recalbox-emulationstation# sudo make
Looking for bcm_host.h
bcm_host.h found
Looking for libMali.so
libMali.so not found
-- Looking for FreeImage...
-- checking for module 'freeimage'
-- package 'freeimage' not found
-- Found FreeImage: optimized;/usr/lib/libfreeimage.so;debug;/usr/lib/libfreeimage.so
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:566 ] _boost_TEST_VERSIONS = 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
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:568 ] Boost_USE_MULTITHREADED = TRUE
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:570 ] Boost_USE_STATIC_LIBS =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:572 ] Boost_USE_STATIC_RUNTIME =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:574 ] Boost_ADDITIONAL_VERSIONS =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:576 ] Boost_NO_SYSTEM_PATHS =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:644 ] Declared as CMake or Environmental Variables:
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:646 ] BOOST_ROOT = /usr/include/boost
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:648 ] BOOST_INCLUDEDIR =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:650 ] BOOST_LIBRARYDIR = /usr/include/boost/regex/v4
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:652 ] _boost_TEST_VERSIONS = 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
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:734 ] location of version.hpp: /usr/include/boost/version.hpp
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:753 ] version.hpp reveals boost 1.49.0
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:785 ] guessed _boost_COMPILER = -gcc47
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:795 ] _boost_MULTITHREADED = -mt
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:838 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:840 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:883 ] _boost_LIBRARY_SEARCH_DIRS = /usr/include/boost/regex/v4;/usr/include/boost/lib;/usr/include/boost/stage/lib;/usr/include/lib;/usr/include/../lib;/usr/include/stage/lib;C:/boost/lib;C:/boost;/boost/boost_1_49_0/lib;/boost/boost_1_49/lib;/boost/lib;/boost;/sw/local/lib
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:961 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-gcc47-mt-1_49;boost_system-gcc47-mt;boost_system-mt-1_49;boost_system-mt;boost_system
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:993 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-gcc47-mt-d-1_49;boost_system-gcc47-mt-d;boost_system-mt-d-1_49;boost_system-mt-d;boost_system-mt;boost_system
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:961 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-gcc47-mt-1_49;boost_filesystem-gcc47-mt;boost_filesystem-mt-1_49;boost_filesystem-mt;boost_filesystem
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:993 ] Searching for FILESYSTEM_LIBRARY_DEBUG: boost_filesystem-gcc47-mt-d-1_49;boost_filesystem-gcc47-mt-d;boost_filesystem-mt-d-1_49;boost_filesystem-mt-d;boost_filesystem-mt;boost_filesystem
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:961 ] Searching for DATE_TIME_LIBRARY_RELEASE: boost_date_time-gcc47-mt-1_49;boost_date_time-gcc47-mt;boost_date_time-mt-1_49;boost_date_time-mt;boost_date_time
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:993 ] Searching for DATE_TIME_LIBRARY_DEBUG: boost_date_time-gcc47-mt-d-1_49;boost_date_time-gcc47-mt-d;boost_date_time-mt-d-1_49;boost_date_time-mt-d;boost_date_time-mt;boost_date_time
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:961 ] Searching for REGEX_LIBRARY_RELEASE: boost_regex-gcc47-mt-1_49;boost_regex-gcc47-mt;boost_regex-mt-1_49;boost_regex-mt;boost_regex
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:993 ] Searching for REGEX_LIBRARY_DEBUG: boost_regex-gcc47-mt-d-1_49;boost_regex-gcc47-mt-d;boost_regex-mt-d-1_49;boost_regex-mt-d;boost_regex-mt;boost_regex
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:961 ] Searching for LOCALE_LIBRARY_RELEASE: boost_locale-gcc47-mt-1_49;boost_locale-gcc47-mt;boost_locale-mt-1_49;boost_locale-mt;boost_locale
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:993 ] Searching for LOCALE_LIBRARY_DEBUG: boost_locale-gcc47-mt-d-1_49;boost_locale-gcc47-mt-d;boost_locale-mt-d-1_49;boost_locale-mt-d;boost_locale-mt;boost_locale
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:961 ] Searching for THREAD_LIBRARY_RELEASE: boost_thread-gcc47-mt-1_49;boost_thread-gcc47-mt;boost_thread-mt-1_49;boost_thread-mt;boost_thread
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:993 ] Searching for THREAD_LIBRARY_DEBUG: boost_thread-gcc47-mt-d-1_49;boost_thread-gcc47-mt-d;boost_thread-mt-d-1_49;boost_thread-mt-d;boost_thread-mt;boost_thread
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1107 ] Boost_FOUND = FALSE
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1194 (message):
Unable to find the requested Boost libraries.
Boost version: 1.49.0
Boost include path: /usr/include
The following Boost libraries could not be found:
boost_regex
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:56 (find_package)
-- Configuring incomplete, errors occurred!
Makefile:237: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
I don't get why it's not working i tried to set variables on my CMakeLists.txt (where the boost library seems to be installed)
set(BOOST_ROOT /usr/include/boost/)
set(BOOST_LIBRARYDIR /usr/include/boost/regex/)
I even tried to look how was working the /usr/share/cmake-2.8/Modules/FindBoost.cmake file, but i didn't learn much. So i'm trying to post a distress call here, if someone could enlighten me a little bit !
The thing i don't get is why it seems to find the other libraries but not the regex one, despite everything being in /usr/include/boost
The boost version is 1.49 (i looked inside the version.hpp file), but on boost documentation, they don't speak about regex library in this version? I'm a bit lost.
You have to install the headers of the Boost library, too. CMake checks for both the libraries and the headers.
Most Linux distributions provide the headers as a -devel package. In your case something like boost_regex-1.49-devel.