【问题标题】:How can I Install boost in Windows 10 with VS 2019 Preview如何使用 VS 2019 Preview 在 Windows 10 中安装 boost
【发布时间】:2019-11-01 20:19:53
【问题描述】:

我搜索了很多,但没有找到任何有用的分步指南来安装、配置和构建带有 VS 2019 Preview 的 Windows 10 中的 boost。谁能指导我完成这项任务?

我下载了 boost 1.70,但是当我执行 bootstrap.bat 时,它给出了以下消息:

C:\libraries\boost\boost_1_70_0>bootstrap.bat
Building Boost.Build engine

Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.

C:\libraries\boost\boost_1_70_0>

此文件本身包含以下文本:

c:\libraries\boost\boost_1_70_0\tools\build\src\engine>if exist bootstrap rd /S /Q bootstrap 

c:\libraries\boost\boost_1_70_0\tools\build\src\engine>md bootstrap 

c:\libraries\boost\boost_1_70_0\tools\build\src\engine>cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib /Febootstrap\jam0  command.c compile.c constants.c debug.c execcmd.c execnt.c filent.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathnt.c pathsys.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c md5.c class.c cwd.c w32_getreg.c native.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c 
command.c
compile.c
constants.c
debug.c
execcmd.c
execnt.c
filent.c
frames.c
function.c
glob.c
hash.c
hdrmacro.c
headers.c
jam.c
jambase.c
jamgram.c
lists.c
make.c
make1.c
object.c
Generating Code...
Compiling...
option.c
output.c
parse.c
pathnt.c
pathsys.c
regexp.c
rules.c
scan.c
search.c
subst.c
timestamp.c
variable.c
modules.c
strings.c
filesys.c
builtins.c
md5.c
class.c
cwd.c
w32_getreg.c
Generating Code...
Compiling...
native.c
set.c
path.c
regex.c
property-set.c
sequence.c
order.c
Generating Code...

当我尝试 boost 1.68 时,我可以成功运行 bootstrap.bat,但是当我执行 b2.exe 时,它​​给了我以下消息:

warning: Did not find command for MSVC toolset. If you have Visual Studio 2017 installed you will need to specify the full path to the command, set VS150COMNTOOLS for your installation, or build from the 'Visual Studio Command Prompt for VS 2017'.

【问题讨论】:

  • 错误在哪里?
  • 我编辑我的问题。 @TanveerBadar

标签: c++ windows boost


【解决方案1】:

您目前无法使用 Preview 构建 Boost,但您可以使用刚刚发布的常规 2019。我有同样的问题。安装具有所需功能的 2019 常规版大约需要十分钟。您可以同时拥有两者。

为了将来参考,这里是我关于如何在具有 MPI 和 python 支持的 windows 上构建 boost 的笔记。

使用 VS 2019 在 Windows 上构建 Boost

需要 Visual Studio 2019 Non-Preview,任何版本,所有 C++ 和 Windows SDK 的东西。

注意:如果您同时拥有 C++ 和 Windows SDK 的东西,请暂时从 VS Preview 中卸载。理想情况下,系统上只有一个编译器,这样Boost.build 就不会感到困惑。

接下来,假设你已经安装了 git-for-windows,执行

git clone https://github.com/boostorg/boost.git --recursive 

boost 超级项目 repo 到一个名为 /Boost/ 的 UNPROTECTED 文件夹(必须不受保护!)

cd boost

现在你在/Boost/boost。 使用

签出开发者分支(获取最新更新)
git checkout develop -f

其中 -f 强制更新。

使用 Visual Studio 开发者控制台在 boost 文件夹中运行引导程序。要激活此控制台,请使用 Windows 搜索栏“在此处键入以搜索”“开发人员命令提示符”,或打开 Visual Studio 并使用顶部的搜索栏。

注意:如果您遇到访问错误,您必须激活管理 Visual Studio 开发人员控制台。 在管理模式下打开cmd 并运行 VsDevCmd.bat,该文件会激活 Visual Studio 开发者控制台。

bootstrap

如果您尚未这样做,请通过安装适用于最新版本 Microsoft MPI 的两个文件来安装 Microsoft MPI。 它已知与Version 10 一起使用,需要将SDK(一个.msi 文件)和非SDK(一个.exe 文件)文件都安装到默认位置。不要修改这些位置。

然后将/Boost/boost/目录下的project-config.jam修改为如下:

(顺便说一句,每行后面都有空格[一个常规空格],甚至是空行)

# Boost.Build Configuration 
# Automatically generated by bootstrap.bat 
 
import option ; 
 
using msvc ; 
 
option.set keep-going : false ; 
 
using python ; 
 
using mpi ; 

最后两行假设您需要 mpi 和 python 支持。

现在打开 Visual Studio 开发人员控制台并导航 (cd) 到 boost 文件夹 /Boost/boost。由于我们使用的是 VS 2019 的 Visual C++ 编译器,显然我们不需要 b2 install 任何东西(请参阅入门指南中的第 5.1 - 5.2 节)。那么接下来我们唯一需要的就是运行

b2 -j8 --address-model=64

选项包括

  • --toolset=14.xx[指定vs编译器版本14.15等](或toolset没有--,有人告诉我,不确定哪个是正确的请告诉我,对我来说是--
  • -a 全部重建
  • -j8 用于 8 核编译
  • --address-model=64(或address-model,没有--,有人告诉我,不确定哪个是正确的,请告诉我,对我来说是--)用于64位
  • > my_log.txt 最后记录构建过程中大量的文本输出,供以后使用(确保一切正常)。

【讨论】:

    【解决方案2】:

    我怀疑您没有Visual Studio tools Command Prompt 窗口中构建 boost

    查看我在这里给出的答案:How to build 64-bit boost for visual studio on windows using the address-model flag? 和这里How to build Boost 1.64 in 64 bits?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-09
      • 1970-01-01
      • 2022-11-07
      • 2020-09-29
      • 1970-01-01
      • 2010-09-20
      • 2019-05-23
      相关资源
      最近更新 更多