llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-driver
Author: Rainer Orth (rorth)
<details>
<summary>Changes</summary>
`clang++` defaults to `-stdlib=libc++` on NetBSD. When building with both
`clang` and `libcxx` included, the freshly built `clang++` fails to find
`<__config_site>`:
```
In file included from /usr/include/strings.h:68:
In file included from bin/../include/c++/v1/string.h:57:
bin/../include/c++/v1/__config:13:10: fatal
error: '__config_site' file not found
13 | #include <__config_site>
| ^~~~~~~~~~~~~~~
```
The file is present in `include/<triplet>/c++/v1`, but that isn't
searched by default. NetBSD has its own version of addLibCxxIncludePaths which
misses that directory.
Rather than replicating yet another part of the generic version in `Gnu.cpp`,
this patch just calls `Generic_GCC::addLibCxxIncludePaths` from there. It
keeps to also include `/usr/include/c++`, although this directory only contains
empty directories in my installation.
Tested on `amd64-pc-netbsd10.1`.
I know that this patch also needs testcases (currently there are none that are
affected by this change), but I'd like to get this into the system first to
check that the approach is sound.
---
Full diff: https://github.com/llvm/llvm-project/pull/212716.diff
1 Files Affected:
- (modified) clang/lib/Driver/ToolChains/NetBSD.cpp (+8-16)
``````````diff
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp
b/clang/lib/Driver/ToolChains/NetBSD.cpp
index 31a5723c17c2f..186a34143da37 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "Gnu.h"
#include "NetBSD.h"
#include "Arch/ARM.h"
#include "Arch/Mips.h"
@@ -497,23 +498,14 @@ void NetBSD::AddClangSystemIncludeArgs(
void NetBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const {
- const std::string Candidates[] = {
- // directory relative to build tree
- concat(getDriver().Dir, "/../include/c++/v1"),
- // system install with full upstream path
- concat(getDriver().SysRoot, "/usr/include/c++/v1"),
- // system install from src
- concat(getDriver().SysRoot, "/usr/include/c++"),
- };
-
- for (const auto &IncludePath : Candidates) {
- if (!getVFS().exists(IncludePath + "/__config"))
- continue;
-
- // Use the first candidate that looks valid.
+ Generic_GCC::addLibCxxIncludePaths(DriverArgs, CC1Args);
+
+ // system install from src
+ const std::string IncludePath =
+ concat(getDriver().SysRoot, "/usr/include/c++");
+
+ if (getVFS().exists(IncludePath + "/__config"))
addSystemInclude(DriverArgs, CC1Args, IncludePath);
- return;
- }
}
void NetBSD::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
``````````
</details>
https://github.com/llvm/llvm-project/pull/212716
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits