forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#125411 - onur-ozkan:sanity-check-libstdc++,…
… r=Mark-Simulacrum check host's libstdc++ version when using ci llvm If the host's libstdc++ version is too old using ci-llvm may result in an ABI mismatch between the local libstdc++ and libLLVM.so. This PR adds a sanity check to immediately fail at the beginning of the bootstrap before starting the actual build. I am not sure if '8' is the best threshold, but it should be a good start and we can increase it anytime if needed. Fixes rust-lang#123037
- Loading branch information
Showing
5 changed files
with
118 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Detecting the standard library version manually using a bunch of shell commands is very | ||
// complicated and fragile across different platforms. This program provides the major version | ||
// of the standard library on any target platform without requiring any messy work. | ||
// | ||
// It's nothing more than specifying the name of the standard library implementation (either libstdc++ or libc++) | ||
// and its major version. | ||
|
||
#include <iostream> | ||
|
||
int main() { | ||
#ifdef _GLIBCXX_RELEASE | ||
std::cout << "libstdc++ version: " << _GLIBCXX_RELEASE << std::endl; | ||
#elif defined(_LIBCPP_VERSION) | ||
// _LIBCPP_VERSION follows "XXYYZZ" format (e.g., 170001 for 17.0.1). | ||
// ref: https://github.com/llvm/llvm-project/blob/f64732195c1030ee2627ff4e4142038e01df1d26/libcxx/include/__config#L51-L54 | ||
// | ||
// Since we use the major version from _GLIBCXX_RELEASE, we need to extract only the first 2 characters of _LIBCPP_VERSION | ||
// to provide the major version for consistency. | ||
std::cout << "libc++ version: " << std::to_string(_LIBCPP_VERSION).substr(0, 2) << std::endl; | ||
#else | ||
std::cerr << "Coudln't recognize the standard library version." << std::endl; | ||
return 1; | ||
#endif | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters