【问题标题】:Build boost with msvc 14.1 ( VS2017 RC)使用 msvc 14.1(VS2017 RC)构建提升
【发布时间】:2017-05-18 18:37:03
【问题描述】:

我正在尝试使用最新的 msvc 14.1 和 VS2017 RC 构建 boost 1.63。 所以我做了我通常做的所有事情,我打开了 Development Cmd 然后我运行 bootstrap.bat 并运行命令

b2 -link=static -threading=multi

由于某种原因,我收到了这些错误:

E:/Coding/SDKs/boost_1_63_0/tools/build/src/tools\msvc.jam:834: in generate-setup-cmd
*** argument error
* rule maybe-rewrite-setup ( toolset : setup-script : setup-options : version : rewrite-setup ? )
* called with: ( msvc :  :  : default :  )
* missing argument setup-script
E:/Coding/SDKs/boost_1_63_0/tools/build/src/tools\msvc.jam:746:see definition of rule 'maybe-rewrite-setup' being called
E:/Coding/SDKs/boost_1_63_0/tools/build/src/tools\msvc.jam:1076: in configure-really
E:/Coding/SDKs/boost_1_63_0/tools/build/src/tools\msvc.jam:201: in configure
E:/Coding/SDKs/boost_1_63_0/tools/build/src/tools\msvc.jam:153: in msvc.init
E:/Coding/SDKs/boost_1_63_0/tools/build/src/build\toolset.jam:43: in toolset.using
E:/Coding/SDKs/boost_1_63_0/tools/build/src/build\project.jam:1052: in using
project-config.jam:3: in modules.load
E:/Coding/SDKs/boost_1_63_0/tools/build/src\build-system.jam:249: in load-config
E:/Coding/SDKs/boost_1_63_0/tools/build/src\build-system.jam:412: in load-configuration-files
E:/Coding/SDKs/boost_1_63_0/tools/build/src\build-system.jam:524: in load
E:\Coding\SDKs\boost_1_63_0\tools\build\src/kernel\modules.jam:295: in import
E:\Coding\SDKs\boost_1_63_0\tools\build\src/kernel/bootstrap.jam:139: in boost-build
E:\Coding\SDKs\boost_1_63_0\boost-build.jam:17: in module scope

我对 boost 不熟悉,所以也许你们中的一个可以给我一个提示

【问题讨论】:

  • release notes 没有将此编译器列为用于测试的编译器之一。查看sources of boost build,它似乎不支持此工具集。由于您不熟悉 boost,因此最好从受支持和测试的编译器开始。
  • 这不是问题,我在几个版本的 Visual Studio 中都遇到了同样的问题——尽管它似乎只影响我的 64 位构建。我将在 boost tracker 上发布一张票,如果他们回复,我会在此处更新。
  • 我遇到了这个确切的问题,KindDragon 的回答为我解决了这个问题。我建议将其用作您的“已接受”答案,以便其他有此问题的人知道这是解决他们当前问题的方法。我想它并没有解决根本问题(因此必须“欺骗” b2 而不是这是默认行为),但暂时就足够了。
  • 您也可以使用 vcpkg 来获得提升。

标签: visual-studio visual-c++ boost


【解决方案1】:

基于 KindDragons 和 CPlusPlus OOA 和 D 答案,我编译了 Boost 1.63。对于 64 位。 运行“x64 Native Tools Command Prompt for VS 2017”命令提示符:

1) 运行:bootstrap.bat

2) 打开project-config.jam。这是我的:

import option ; 

using msvc : 14.0 : "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\cl.exe"; 

option.set keep-going : false ;

部件:14.10.25017 会随着 Windows SDK 的更新而不断变化。所以相应地更新它。

3) 运行b2 toolset=msvc-14.0 address-model=64

【讨论】:

  • 如果我能两次投票就好了...我几乎为此创建了第二个帐户..
  • 在 Visual Studio 2017 更新 2 中,只有 x64 本机工具提示符才能正确找到 ml64.exe 汇编程序可执行文件(例如,用于 x86 的 ml.exe 和用于 x64 的 ml64.exe)。对于 x64,每次我使用 Developer Tools 提示时,都会得到响应,"'ml64' is not recognized as an internal or external command, operable program or batch file." 但是,请注意 x64 Boost 输出文件正确出现在 x64 Native Tools 提示 . x86 aka Win32 Boost 输出文件正确出现在 2017 Developer Tools 提示符下。只有一个开发者工具提示快捷方式存在(例如 x86)。
  • 只有我,还是在 boost 1.67.0 中不再适用?
  • 1.67.0 支持 VS2017 没有上面的恶作剧。在 KindDragon 答案中查看以下内容:运行适当的命令提示符(x86 或 x64 本机工具命令提示符),然后 bootstrap.bat,然后:32 位:b2 toolset=msvc-14.1 --build-dir=.x86 --stagedir=stage_x86或 64 位:b2 toolset=msvc-14.1 address-model=64 --build-dir=.x64 --stagedir=stage_x64
  • 你是冠军!
【解决方案2】:

Boost 1.63 不完全支持 VS2017,但你可以欺骗它找到 VC++2017 编译器:

  1. 在 boost 目录中运行 bootstrap.bat
  2. 更新 project-config.jam 以包括: using msvc : 14.0 : <path to x86 or x64 cl.exe>。应该类似于"c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24911\bin\HostX64\x64\cl.exe"
  3. 从 Windows 开始菜单运行“VS 2017 RC 的开发人员命令提示符”,以从使用 x86 vcvars 或 x64 vcvars 配置的 shell 进行引导。
  4. 在该命令提示符下运行b2 toolset=msvc-14.0。对于 x64 版本,将 address-model=64 添加到 b2 命令行。

更新:Boost 1.64 应该支持 VS2017

从“开始”菜单运行“x86 Native Tools Command Prompt for VS 2017”或“x64 Native Tools Command Prompt for VS 2017”,而不是在命令提示符内运行b2

32 位:b2 toolset=msvc-14.1 --build-dir=.x86 --stagedir=stage_x86

64 位:b2 toolset=msvc-14.1 address-model=64 --build-dir=.x64 --stagedir=stage_x64

添加link=shared 构建共享库

【讨论】:

  • 这对我来说非常有用!我确实必须将 (2) 更改为如下所示:using msvc : 14.0 : "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\cl.exe" 否则会出现错误 error: msvc initialization: parameter 'version' inconsistent
  • 对我来说,当我使用不带引号的 cl.exe 路径时,此解决方案有效。我正在尝试使用 VS2019 来提升 1.62。 using msvc : 14.2 : C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64\cl.exe ;
【解决方案3】:

我在以下 github 存储库中创建了一个构建 32 位和 64 位二进制文​​件的批处理脚本:https://github.com/manuelgustavo/boost_build

秘诀在于使用 Visual Studio 2017 的开发人员命令提示符。 它根据需要设置所有环境变量。

然后,您可以执行以下操作:

对于 32 位:

b2.exe --toolset=msvc-14.0 architecture=x86 address-model=32 --stagedir=".\stage32" threading=multi --build-type=complete stage

对于 64 位:

b2.exe --toolset=msvc-14.0 architecture=x86 address-model=64 --stagedir=".\stage64" threading=multi --build-type=complete stage

或者,如果您愿意,只需转到 https://github.com/manuelgustavo/boost_build 并按照那里的步骤操作。

【讨论】:

  • 可爱!!!您应该将信息添加到需要从 vs 命令提示符启动的脚本中
  • 你也可以只运行“C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars(32/64).bat”来设置环境标准 cmd 的变量。
  • 为什么我们有architecture=x86,即使是64位构建?
【解决方案4】:

在我的案例中使用 Visual Studio 2017 构建的另一个提示。如果您已经使用旧版本的 Visual Studio 构建了 Boost,请删除由位于用户 TEMP 文件夹中的 Boost 引导脚本生成的临时批处理文件,例如:

C:\Users\MYUSER~1\AppData\Local\Temp\b2_msvc_14.1_vcvarsx86_amd64_.cmd

解决办法来自这个帖子:http://boost.2283326.n4.nabble.com/Building-boost-fails-with-VS2017-v15-5-2-td4700909.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-08
    • 2017-04-27
    • 1970-01-01
    • 1970-01-01
    • 2023-03-08
    • 1970-01-01
    • 2018-09-12
    相关资源
    最近更新 更多