CMAKE带有Boost Library Windows 10库未正确找到



像许多其他人一样,我使用Windows的Boost库遇到了问题。在ubuntu 16.04上,它与libboost-all-dev一起运作良好,但是在窗口上我有很多问题。

我尝试构建一个加密型应用程序,我可以在Linux下完全编译该应用程序。但是我还需要Windows二进制文件,因此我采取了步骤来安装以下工具:

  • Visual Studio 2013(VC120)
  • cmake 3.10.1
  • Python 3.6.4
  • Boost 1.58

对于Boost,我做了以下步骤:

  • 从二进制安装boost
  • 运行bootstrap.bat
  • 运行B2安装
  • 运行BJAM安装" - 无元"

什么都没有。加密传说给我带来了一个错误,某些但不是所有库都找不到。

我尝试设置BOOST_ROOT,BOOST_LIBRARY_DIRS,BOOST_INCLUDE_DIRS-> nothing。

我做错了什么?我从cmake获得的错误是:

-- Building for: Visual Studio 12 2013
-- The C compiler identification is MSVC 18.0.31101.0
-- The CXX compiler identification is MSVC 18.0.31101.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.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
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
CMake Error at C:/Program Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1928 (message):
  Unable to find the requested Boost libraries.
  Boost version: 1.58.0
  Boost include path: C:/local/boost_1_58_0
  Could not find the following static Boost libraries:
          boost_system
          boost_filesystem
          boost_thread
          boost_date_time
          boost_chrono
          boost_regex
          boost_serialization
          boost_program_options
  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:113 (find_package)

-- WARNING: Git was not found!
-- Found PythonInterp: C:/Users/chris/AppData/Local/Programs/Python/Python36-32/python.exe (found version "3.6.4")
CMake Warning in CMakeLists.txt:
  CMAKE_SKIP_INSTALL_RULES was enabled even though installation rules have
  been specified

-- Configuring incomplete, errors occurred!
See also "C:/Users/chris/Documents/GitHub/cryptonote/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/chris/Documents/GitHub/cryptonote/build/CMakeFiles/CMakeError.log".

也许有人可以帮助解决此问题?

问候

好的,终于在阅读了许多更多页面后,我找到了一个解决方案。

解决方案真的很简单。下载Boost软件包并安装它(或从源构建)后,您只需要以下两个部分:

  • 打开您的CMD(cmd.exe)
  • 切换到Boost的安装目录(示例C: local boost_1_58_0)

只需运行以下命令:

bootstrap.bat
b2 link=static runtime-link=static release stage

这将创建所有库静态,并使其可用于CMAKE。

此解决方案对我有用,使我能够构建所需的软件包。

感谢所有帮助者

,或者您可以通过添加

来告诉boost使用哪个编译器

toolset = msvc12.0

(对于MS 2013 V12等)

到B2命令行: - )

最新更新