fix(toolchain): do not pass the compiler's implicit include dirs
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Successful in 3m58s
VoidBuildSystem CI / 1 · Requirements (push) Successful in 7s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 3m28s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 5m13s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m4s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Successful in 6m7s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Successful in 6m2s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m19s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m38s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m11s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 16s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 17s
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Failing after 1m33s
VoidBuildSystem CI / 5 · Release (push) Failing after 9s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Successful in 3m58s
VoidBuildSystem CI / 1 · Requirements (push) Successful in 7s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 3m28s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 5m13s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m4s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Successful in 6m7s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Successful in 6m2s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m19s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m38s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m11s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 16s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 17s
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Failing after 1m33s
VoidBuildSystem CI / 5 · Release (push) Failing after 9s
VoidLibrary's dependency detection exports /usr/include as a system
include directory; passing it as -isystem makes GCC drop its implicit
entry for that path, so libstdc++'s '#include_next <stdlib.h>' fails
('stdlib.h: No such file or directory'). This broke the self-hosted
install only in environments where the dependency finds Boost/OpenSSL.
Probe the implicit include search list for GCC as well as Clang and
skip those directories when lowering compile commands. Also log the
executed command at debug level.
Verified: 'vbs install' (self-hosted) now succeeds inside an Arch
container matching the CI image.
This commit is contained in:
1 parent
00e14bae98
commit
b2c869961a
3 files changed
+52
-1
No files matched your search
@@ -466,7 +466,13 @@ discover_and_probe(const ProfileContext &context,
|
||||
if (cap.family == CompilerFamily::Clang) {
|
||||
cap.module_scanner = Platform::resolve_executable("clang-scan-deps");
|
||||
cap.supports_p1689_scan = cap.module_scanner.has_value();
|
||||
}
|
||||
|
||||
// Record the compiler's implicit include search list (GCC and Clang both
|
||||
// print it for `-E -v`): explicitly passing those directories, e.g. as
|
||||
// `-isystem /usr/include`, makes GCC drop its implicit entry and breaks the
|
||||
// `#include_next` chain in libstdc++.
|
||||
{
|
||||
Platform::ProcessRequest ireq;
|
||||
ireq.executable = cap.cxx_compiler;
|
||||
ireq.arguments = {"-x", "c++", "-E", "-v"};
|
||||
@@ -757,7 +763,22 @@ lower_compile_command(const ToolchainCapabilities &toolchain, const CompileReque
|
||||
if (toolchain.family == CompilerFamily::Gcc && !request.nondeterministic) {
|
||||
args.push_back("-frandom-seed=" + request.output_object.filename().string());
|
||||
}
|
||||
// Directories the compiler already searches implicitly are skipped: passing
|
||||
// them explicitly (especially as -isystem) makes GCC drop its own entry and
|
||||
// breaks #include_next in the standard library headers.
|
||||
const auto is_implicit_include = [&](const std::filesystem::path &dir) {
|
||||
const auto normalized = dir.lexically_normal();
|
||||
for (const auto &implicit : toolchain.default_include_dirs) {
|
||||
if (std::filesystem::path{implicit}.lexically_normal() == normalized) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
for (const auto &[inc, is_system] : request.include_dirs) {
|
||||
if (is_implicit_include(inc)) {
|
||||
continue;
|
||||
}
|
||||
args.push_back(is_system ? "-isystem" : "-I");
|
||||
args.push_back(inc.string());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user