【发布时间】:2017-08-23 11:40:17
【问题描述】:
我尝试使用 Visual Studio 2017 x64 和 Windows 10 构建 boost 1.65.0。
This 是我的 power shell 构建脚本的样子:
. ".\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
归结为:很简单:
bootstrap.batb2.exe --toolset=msvc-14.1 address-model=64 --build-type=complete stage –j 8
执行 bootstrap.bat 似乎有效。但是 b2 会产生一些错误——找不到 vcvarsall.bat:
尽管如此,似乎一切都很好:
忽略这些错误消息是否安全? 有人可以重现这些错误吗?
【问题讨论】:
-
注意:
b2的正确工具集是toolset=msvc-14.1不是toolset=msvc-15.0。如果您被我的旧答案 here 误导,我很抱歉 -
好的,很好,解决了这个问题 - 你能从你的评论中回答,以便我接受你的回答吗?
-
我很高兴它对你有用 @Vertexwahn,我已经发布了 MSVC 和 MinGw 的完整答案,谢谢。
标签: boost build visual-studio-2017