Skip to content

Commit 020b596

Browse files
authored
Merge pull request #14552 from ethereum/bump-cmake-and-boost-to-work-with-vs-2022
Work around differences in `lexically_normal()` on Boost 1.78+ and bump cmake and boost versions
2 parents 5a5e0b5 + 70cf104 commit 020b596

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

docs/installing-solidity.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ The following are dependencies for all builds of Solidity:
323323
| `CMake`_ (version 3.21.3+ on | Cross-platform build file generator. |
324324
| Windows, 3.13+ otherwise) | |
325325
+-----------------------------------+-------------------------------------------------------+
326-
| `Boost`_ (version 1.77 on | C++ libraries. |
326+
| `Boost`_ (version 1.77+ on | C++ libraries. |
327327
| Windows, 1.65+ otherwise) | |
328328
+-----------------------------------+-------------------------------------------------------+
329329
| `Git`_ | Command-line tool for retrieving source code. |
@@ -410,7 +410,7 @@ You need to install the following dependencies for Windows builds of Solidity:
410410
+-----------------------------------+-------------------------------------------------------+
411411
| `Visual Studio 2019`_ (Optional) | C++ compiler and dev environment. |
412412
+-----------------------------------+-------------------------------------------------------+
413-
| `Boost`_ (version 1.77) | C++ libraries. |
413+
| `Boost`_ (version 1.77+) | C++ libraries. |
414414
+-----------------------------------+-------------------------------------------------------+
415415

416416
If you already have one IDE and only need the compiler and libraries,

libsolidity/interface/FileReader.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,10 @@ bool FileReader::isPathPrefix(boost::filesystem::path const& _prefix, boost::fil
325325
// NOTE: On Windows paths starting with a slash (rather than a drive letter) are considered relative by boost.
326326
solAssert(_prefix.is_absolute() || isUNCPath(_prefix) || _prefix.root_path() == "/", "");
327327
solAssert(_path.is_absolute() || isUNCPath(_path) || _path.root_path() == "/", "");
328-
solAssert(_prefix == _prefix.lexically_normal() && _path == _path.lexically_normal(), "");
328+
// NOTE: On Windows before Boost 1.78 lexically_normal() would not replace the `//` UNC prefix with `\\\\`.
329+
// Later versions do. Use generic_path() to normalize all slashes to `/` and ignore that difference.
330+
// This does not make the assert weaker because == ignores slash type anyway.
331+
solAssert(_prefix == _prefix.lexically_normal().generic_string() && _path == _path.lexically_normal().generic_string(), "");
329332
solAssert(!hasDotDotSegments(_prefix) && !hasDotDotSegments(_path), "");
330333

331334
boost::filesystem::path strippedPath = _path.lexically_relative(

scripts/install_deps.ps1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,26 @@ $progressPreference = "silentlyContinue"
66
if ( -not (Test-Path "$PSScriptRoot\..\deps\boost") ) {
77
New-Item -ItemType Directory -Force -Path "$PSScriptRoot\..\deps"
88

9-
Invoke-WebRequest -URI "https://github.com/Kitware/CMake/releases/download/v3.18.2/cmake-3.18.2-win64-x64.zip" -OutFile cmake.zip
10-
if ((Get-FileHash cmake.zip).Hash -ne "5f4ec834fbd9b62fbf73bc48ed459fa2ea6a86c403106c90fedc2ac76d51612d") {
9+
Invoke-WebRequest -URI "https://github.com/Kitware/CMake/releases/download/v3.27.4/cmake-3.27.4-windows-x86_64.zip" -OutFile cmake.zip
10+
if ((Get-FileHash cmake.zip).Hash -ne "e5e060756444d0b2070328a8821c1ceb62bd6d267aae61bfff06f96c7ec943a6") {
1111
throw 'Downloaded CMake source package has wrong checksum.'
1212
}
1313
tar -xf cmake.zip
14-
mv cmake-3.18.2-win64-x64 "$PSScriptRoot\..\deps\cmake"
14+
mv cmake-3.27.4-windows-x86_64 "$PSScriptRoot\..\deps\cmake"
15+
Remove-Item cmake.zip
1516

1617
# FIXME: The default user agent results in Artifactory treating Invoke-WebRequest as a browser
1718
# and serving it a page that requires JavaScript.
18-
Invoke-WebRequest -URI "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.zip" -OutFile boost.zip -UserAgent ""
19-
if ((Get-FileHash boost.zip).Hash -ne "d2886ceff60c35fc6dc9120e8faa960c1e9535f2d7ce447469eae9836110ea77") {
19+
Invoke-WebRequest -URI "https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.zip" -OutFile boost.zip -UserAgent ""
20+
if ((Get-FileHash boost.zip).Hash -ne "c86bd9d9eef795b4b0d3802279419fde5221922805b073b9bd822edecb1ca28e") {
2021
throw 'Downloaded Boost source package has wrong checksum.'
2122
}
2223
tar -xf boost.zip
23-
cd boost_1_77_0
24+
Remove-Item boost.zip
25+
cd boost_1_83_0
2426
.\bootstrap.bat
2527
.\b2 -j4 -d0 link=static runtime-link=static variant=release threading=multi address-model=64 --with-filesystem --with-system --with-program_options --with-test --prefix="$PSScriptRoot\..\deps\boost" install
2628
if ( -not $? ) { throw "Error building boost." }
2729
cd ..
30+
Remove-Item -LiteralPath .\boost_1_83_0 -Force -Recurse
2831
}

0 commit comments

Comments
 (0)