【发布时间】:2019-10-29 09:50:40
【问题描述】:
我正在尝试使用以下说明在 Visual Studio 的 x64 终端上构建 boost:https://www.boost.org/doc/libs/1_62_0/more/getting_started/windows.html#get-boost
我愿意:
boostrap
然后
.\b2 address-model=64
但它总是说:
C:\boost_1_70_0>.\b2 address-model=64
Performing configuration checks
- default address-model : 32-bit
- default architecture : x86
Building the Boost C++ Libraries.
...
然后继续构建所有内容的 32 位版本。我知道这一点,因为当我尝试将 boost 用于 CMake 之类的东西时,它抱怨它的 32 位:
C:\src\SimpleAmqpClient\simpleamqpclient-build>cmake -DBOOST_ROOT=C:\boost_1_70_0 -DBOOST_LIBRARYDIR=C:\boost_1_70_0\stage\lib ..
-- Found Boost 1.70.0 at C:/Program Files/boost/lib/cmake/Boost-1.70.0
-- Requested configuration: QUIET REQUIRED COMPONENTS chrono;system
-- Found boost_headers 1.70.0 at C:/Program Files/boost/lib/cmake/boost_headers-1.70.0
-- Found boost_chrono 1.70.0 at C:/Program Files/boost/lib/cmake/boost_chrono-1.70.0
-- No suitable boost_chrono variant has been identified!
-- libboost_chrono-mgw82-mt-d-x32-1_70.a (32 bit, need 64)
-- libboost_chrono-mgw82-mt-x32-1_70.a (32 bit, need 64)
CMake Error at C:/Program Files/boost/lib/cmake/Boost-1.70.0/BoostConfig.cmake:95 (find_package):
Found package configuration file:
C:/Program Files/boost/lib/cmake/boost_chrono-1.70.0/boost_chrono-config.cmake
but it set boost_chrono_FOUND to FALSE so package "boost_chrono" is
considered to be NOT FOUND. Reason given by package:
No suitable build variant has been found.
Call Stack (most recent call first):
C:/Program Files/boost/lib/cmake/Boost-1.70.0/BoostConfig.cmake:124 (boost_find_dependency)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindBoost.cmake:273 (find_package)
CMakeLists.txt:35 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
See also "C:/src/SimpleAmqpClient/simpleamqpclient-build/CMakeFiles/CMakeOutput.log".
是的,我如何构建 64 位?
【问题讨论】:
-
您确定它使用的是 64 位终端吗?您可能还必须通过运行
vcvars64.bat之类的东西来启用 64 位构建环境。 See here. -
您也可以尝试从常规的
cmd命令行构建:.\b2 toolset=msvc-15.0 address-model=64 --stagedir=stage link=shared您可以在此处指定toolset,以及是否使用static或shared构建库link选项。 Full reference -
@squareskittles vcvars64.bat 文件在哪里?我无法运行它。此外, .\b2 toolset=msvc-15.0 address-model=64 --stagedir=stage link=shared 似乎也适用于 32 位 - 与我原来的问题中的输出相同
-
您使用的是什么版本的 Visual Studio?
-
Visual Studio 2019
标签: c++ visual-studio boost cmake b2