[英]How to build 64-bit boost for visual studio on windows using the address-model flag?
我正在尝试使用以下说明在 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 位版本。 我知道这一点,因为当我尝试对 CMake 之类的东西使用 boost 时,它抱怨它的 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 位?
请参阅我在这里给出的答案: How to build Boost 1.64 in 64 bits?
如果要明确指定工具集,则Visual Studio 2019
为toolset=msvc-14.2
注意:确保从Visual Studio tools Command Prompt
构建它
并忽略控制台上的- default address-model : 32-bit
输出,它构建 64 位二进制文件。
我刚刚遇到了这个问题。 尽管我在命令行中指定了address-model=64
并且 32 位工具不在我的PATH
而 64 位工具在,但 Jam 使用了 32 位工具。 它甚至不知道自己在这样做:它将x64
放在它使用 32 位工具创建的 32 位库的名称中,它已经竭尽全力寻找和调用这些工具。 我喜欢“智能”构建系统。
我不知道为什么会这样,但我通过编辑bin.v2\\standalone\\msvc\\msvc-{version}\\address-model-64\\architecture-x86\\msvc-setup.bat
并移动...\\bin\\Hostx64\\x64
在SET PATH=...
行中...\\bin\\HostX86\\x86
之前。
如另一个答案中所述,即使正确构建 64 位二进制文件,它仍会报告“默认地址模型:32 位”。
我的指南有详细的说明,可能对如何在支持 python 和 mpi 的 Visual Studio 2019 中在 Windows 10 上构建 64 位 boost 有用。 我写了笔记,以防万一我需要再做一次。
我认为这可能与遗漏有关--
b2 --address-model=64
但有人告诉我这是不正确的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.