增强版1.65.0:找不到vcvarsall.bat [英] Building boost 1.65.0: vcvarsall.bat not found

查看:47
本文介绍了增强版1.65.0:找不到vcvarsall.bat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Visual Studio 2017 x64和Windows 10构建boost 1.65.0.

I tried to build boost 1.65.0 using Visual Studio 2017 x64 and Windows 10.

这是我的Power Shell构建脚本的样子:

This is how my power shell build script looks like:

. ".\Invoke-CmdScript.ps1"

# We expect PowerShell Version 5
if(-Not $PSVersionTable.PSVersion.Major -eq 5) {
    Write-Host "Expecting PowerShell Version 5"
    return
}

# Now download boost 1.65.0
Invoke-WebRequest http://dl.bintray.com/boostorg/release/1.65.0/source/boost_1_65_0.zip -OutFile C:\thirdparty\vs2017\x64\boost_1_65_0.zip

# Check file hash
$value = Get-FileHash C:\thirdparty\vs2017\x64\boost_1_65_0.zip -Algorithm SHA256

if($value.Hash -ne "f3f5c37be45eb6516c95cd147d8aa4abb9b52121fc3eccc1fc65c4af0cf48592") {
    Write-Host "boost archive seems to be corrupted"
    return
}

# Extract file
$strFileName="$env:ProgramFiles\7-Zip\7z.exe"
If (Test-Path $strFileName){
    # Use 7-zip
    if (-not (test-path "$env:ProgramFiles\7-Zip\7z.exe")) {throw "$env:ProgramFiles\7-Zip\7z.exe needed"} 
    set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"  
    sz x C:\thirdparty\vs2017\x64\boost_1_65_0.zip -oC:\thirdparty\vs2017\x64
} Else {
    # use slow Windows stuff
    Expand-Archive C:\thirdparty\vs2017\x64\boost_1_65_0.zip -DestinationPath C:\thirdparty\vs2017\x64\boost_1_65_0
}

# Removed downloaded zip archive
Remove-Item C:\thirdparty\vs2017\x64\boost_1_65_0.zip

# Setup VS2017 x64 environment
Invoke-CmdScript -script "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" -parameters amd64

# Build
cd C:\thirdparty\vs2017\x64\boost_1_65_0
Invoke-CmdScript -script "bootstrap.bat"

$cpuInfo = Get-CimInstance -ClassName 'Win32_Processor' `
    | Select-Object -Property 'DeviceID', 'Name', 'NumberOfCores', 'NumberOfLogicalProcessors';

Write-Host $cpuInfo.NumberOfLogicalProcessors

.\b2.exe --toolset=msvc-14.1 address-model=64 --build-type=complete stage -j $cpuInfo.NumberOfLogicalProcessors

将其煮沸–它很简单:

  1. bootstrap.bat
  2. b2.exe --toolset=msvc-14.1 address-model=64 --build-type=complete stage –j 8
  1. bootstrap.bat
  2. b2.exe --toolset=msvc-14.1 address-model=64 --build-type=complete stage –j 8

执行bootstrap.bat似乎可以工作.但是b2会产生一些错误-找不到vcvarsall.bat:

Execution bootstrap.bat seems to work. But b2 yields some errors – vcvarsall.bat not found:

尽管如此,看来一切都很好:

Nevertheless, it seems that everything is build fine:

忽略这些错误消息是否安全? 有人可以重现这些错误吗?

Is it safe to ignore those error messages? Can someone reproduce those errors?

推荐答案

要更新(并更正!)我先前关于构建增强的答案,这是我在Windows上针对Visual Studio和<两者构建boost的最新说明. c4>.

To update (and correct!) my previous answers on building boost, here are my latest notes for building boost on Windows for both Visual Studio and MinGw.

Windows不直接支持boost,因此您可以下载它并将其放置在所需的任何位置.
boost用户指南建议使用boost的位置创建一个BOOST_ROOT environment变量.

Windows does not directly support boost, so you can download it and put it wherever you want.
The boost user guide recommends creating a BOOST_ROOTenvironment variable with the location of boost.

在Visual Studio工具命令提示符中:

In a Visual Studio tools Command Prompt:

cd boost_1_xx_0
call bootstrap.bat

对于64位静态库(建议用于Windows):

For 64 bit static libraries (recommended for Windows):

b2 -j8 toolset=msvc address-model=64 link=static threading=multi runtime-link=shared --build-type=complete stage
2>&1 | tee msvc_static_build.txt

注意:boost thread库必须使用动态链接构建,请参见: https://studiofreya.com/2015/05/20/the-simplest-way -of-build-boost-1-58对于32位和64位体系结构与visual-studio/

Note: the boost thread library must be built with dynamic linking see: https://studiofreya.com/2015/05/20/the-simplest-way-of-building-boost-1-58-for-32-bit-and-64-bit-architectures-with-visual-studio/

对于64位动态库(仅线程):

For 64 bit dynamic library (thread only):

b2 -j8 toolset=msvc address-model=64 link=shared threading=multi runtime-link=shared --with-thread --build-type=minimal stage
2>&1 | tee msvc_thread_build.txt

如果您安装了Visual Studio的多个版本,并且想要针对特定​​版本进行构建,请使用:

If you have multiple versions of Visual Studio installed and want to build for a specific version then use:

  • Visual Studio 2017:toolset=msvc-14.1
  • Visual Studio 2015:toolset=msvc-14.0
  • Visual Studio 2013:toolset=msvc-12.0
  • Visual Studio 2012:toolset=msvc-11.0
  • Visual Studio 2010:toolset=msvc-10.0
  • Visual Studio 2017: toolset=msvc-14.1
  • Visual Studio 2015: toolset=msvc-14.0
  • Visual Studio 2013: toolset=msvc-12.0
  • Visual Studio 2012: toolset=msvc-11.0
  • Visual Studio 2010: toolset=msvc-10.0

注意:当我为64位二进制文​​件的Visual Studio 2017构建boost 1.65.0时,b2输出正在构建32位:true",但是它构建了64位库...

Note: when I built boost 1.65.0 for Visual Studio 2017 for 64 bit binaries, b2 output "building 32 bit: true", but it built 64 bit libraries...

还请注意:在Visual Studio 2017中编译boost 1.65.0包含文件时,您可能会看到警告:

Also note: whilst compiling a boost 1.65.0 include file in Visual Studio 2017 you may see the warning:

未知的编译器版本-请运行配置测试并报告结果

Unknown compiler version - please run the configure tests and report the results

这是因为最新版本的Visual Studio 2017_MSC_VER定义为1911,而boost\config\compilier\visualc.hpp包含:

This is because the latest version of Visual Studio 2017 defines _MSC_VER as 1911 whilst boost\config\compilier\visualc.hpp contains:

// last known and checked version is 19.10.25017 (VC++ 2017):
#if (_MSC_VER > 1910)
#  if defined(BOOST_ASSERT_CONFIG)
#     error "Unknown compiler version - please run the configure tests and report the results"
#  else
#     pragma message("Unknown compiler version - please run the configure tests and report the results")
#  endif
#endif

要删除警告,请将visualc.hpp的第325行更改为:

To remove the warning, change line 325 of visualc.hpp to:

#if (_MSC_VER > 1911)

为MinGw建造

确保mingwgcc在路径中,例如:C:\Qt\Tools\mingw491_32\bin

Building for MinGw

Ensure that mingw or gcc is in the path, e.g.: C:\Qt\Tools\mingw491_32\bin

cd boost_1_xx_0
call bootstrap.bat gcc

b2 toolset=gcc link=shared threading=multi --build-type=complete stage
2>&1 | tee mingw_build.txt

注意:对于增强版 1.61之前的版本,将bootstrap.bat gcc更改为bootstrap.bat mingw

Note: for boost versions prior to 1.61 change bootstrap.bat gcc to bootstrap.bat mingw

还请注意:2>&1 | tee name.txt不是必需的,但保留日志非常有用...

Also note: 2>&1 | tee name.txt isn't necessary, but it's useful to keep a log...

这篇关于增强版1.65.0:找不到vcvarsall.bat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆