[英]Unable to find the requested Boost libraries Windows Cmake
I'm trying to build Bytecoin source on Windows and I'm running into issues with CMake and Boost libraries. 我正在尝试在Windows上构建Bytecoin源代码,而我遇到了CMake和Boost库的问题。 First I tried grabbing the Boost 1.55 and compiling it myself.
首先,我尝试抓住Boost 1.55并自行编译。 One or two of the libs near the end did not compile for some reason but I thought that CMake would at least identify the compiled libraries.
接近结尾的一个或两个lib由于某种原因没有编译,但我认为CMake至少会识别已编译的库。 Instead, I get this error when trying to load the CMake project:
相反,我在尝试加载CMake项目时遇到此错误:
Error:Unable to find the requested Boost libraries.
错误:无法找到请求的Boost库。 Boost version: 1.55.0 Boost include path: C:/Program Files/boost/boost_1_55_0 Could not find the following Boost libraries: boost_system boost_filesystem boost_thread boost_date_time boost_chrono boost_regex
Boost版本:1.55.0 Boost包含路径:C:/ Program Files / boost / boost_1_55_0找不到以下Boost库:boost_system boost_filesystem boost_thread boost_date_time boost_chrono boost_regex
boost_serialization boost_program_options No Boost libraries were found.boost_serialization boost_program_options找不到Boost库。 You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.
您可能需要将BOOST_LIBRARYDIR设置为包含Boost库的目录或BOOST_ROOT到Boost的位置。
Then I tried adding a HINT to the find_package(). 然后我尝试在find_package()中添加一个HINT。 It tried to parse a weird path, not sure where it's doing this:
它试图解析一个奇怪的路径,不知道它在做什么:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:273 (if): Syntax error in cmake code at
C:/ Program Files的CMake错误(x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:273(if):cmake代码中的语法错误
C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:273
when parsing string
解析字符串时
${Boost_C:/PROGRAM FILES/BOOST/BOOST_1_55_0_LIBRARY_RELEASE}
Reading some of the SO answers on the matter I added environment variables: 阅读有关此问题的一些SO答案,我添加了环境变量:
C:\\Users\\Misha>set
C:\\ Users \\用户米莎>集
BOOST_INCLUDEDIR=C:\\local\\boost_1_55_0 BOOST_LIBRARYDIR=C:\\local\\boost_1_55_0\\lib32-msvc-12.0 BOOST_ROOT=C:\\local\\boost_1_55_0\\boost
BOOST_INCLUDEDIR = C:\\ local \\ boost_1_55_0 BOOST_LIBRARYDIR = C:\\ local \\ boost_1_55_0 \\ lib32-msvc-12.0 BOOST_ROOT = C:\\ local \\ boost_1_55_0 \\ boost
At this point I tried using the precompiled libs , nothing. 此时我尝试使用预编译的libs ,没有。
CMkeLists.txt CMkeLists.txt
find_package(Boost 1.55 REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options)
#find_package(Boost 1.55 REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options HINT "C:/Program Files/boost/boost_1_55_0")
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if (MINGW)
set(Boost_LIBRARIES "${Boost_LIBRARIES};ws2_32;mswsock")
elseif (APPLE)
set(Boost_LIBRARIES "${Boost_LIBRARIES}")
elseif (NOT MSVC)
set(Boost_LIBRARIES "${Boost_LIBRARIES};rt")
endif ()
I'm not familiar with CMake, so it is likely a simple fix. 我不熟悉CMake,所以这可能是一个简单的修复。 I just can't see it.
我只是看不到它。
I was facing the same error, but resolved it. 我面临同样的错误,但解决了它。 My BOOST Library was build using Gcc 6.3 on windows 7 (64 Bit).
我的BOOST库是在Windows 7(64位)上使用Gcc 6.3构建的。
I set Boost_DEBUG on
in CMakeLists.txt
and found 我在
CMakeLists.txt
设置了Boost_DEBUG on
并找到了
-- [ C:/Program Files/CMake/share/cmake-3.9/Modules/FindBoost.cmake:1620 ] Searching for SYSTEM_LIBRARY_RELEASE: libboost_system-mgw63-mt-1_67;libboost_system-mgw63-mt;libboost_system-mt-1_67;libboost_system-mt;libboost_system
- [C:/ Program Files / CMake / share / cmake-3.9 / Modules / FindBoost.cmake:1620]搜索SYSTEM_LIBRARY_RELEASE:libboost_system-mgw63-mt-1_67; libboost_system-mgw63-mt; libboost_system-mt-1_67; libboost_system -mt; libboost_system
That means FindPackage(Boost)
is searching for libboost_system-mgw63-mt-1_67
but my library name was libboost_system-mgw63-mt-x64-1_67
. 这意味着
FindPackage(Boost)
正在搜索libboost_system-mgw63-mt-1_67
但我的库名是libboost_system-mgw63-mt-x64-1_67
。
So I removed X64
from all libray names and now it is working properly. 所以我从所有的libray名称中删除了
X64
,现在它正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.