-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Driver] Fix detection of libc++ with empty sysroot. #66947
Conversation
b1e3cd1 dropped the leading slash here, presumably unintentionally. (I don't understand Driver well enough to know how/where this is supposed to be tested, but it broke clangd on any project that uses the system-installed -stdlib=libc++ on a standard debian install)
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-driver Changesb1e3cd1 dropped the leading slash here, (I don't understand Driver well enough to know how/where this is supposed Full diff: https://github.com/llvm/llvm-project/pull/66947.diff 1 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index e909549d20708fe..f2fd85021a777b4 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -3139,11 +3139,11 @@ Generic_GCC::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
// not be found at ../include/c++ but it likely to be found at
// one of the following two locations:
SmallString<128> UsrLocalIncludeDir(SysRoot);
- llvm::sys::path::append(UsrLocalIncludeDir, "usr", "local", "include");
+ llvm::sys::path::append(UsrLocalIncludeDir, "/usr", "local", "include");
if (AddIncludePath(UsrLocalIncludeDir))
return;
SmallString<128> UsrIncludeDir(SysRoot);
- llvm::sys::path::append(UsrIncludeDir, "usr", "include");
+ llvm::sys::path::append(UsrIncludeDir, "/usr", "include");
if (AddIncludePath(UsrIncludeDir))
return;
}
|
Sorry about the breakage. The This is tricky to test because it requires no sysroot to be passed, but we might be able to do so with a VFS overlay. I'm okay adding the test afterwards though so we get the breakage fixed first, and I can also look into the test myself if you'd like. |
Thanks for the quick response!
That sounds sensible to me in principle, but not trivial: presumably the overrides of
I can try to add something to the unittest. Looks like in the current form I also need to change the lit test back to hard-coding |
I just meant to change llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp Line 3102 in 5eaa531
It's a local fix, but all the code here is pretty inconsistent anyway, so I don't feel too bad about it. |
Oops, of course. Done & I worked out the testing. |
LGTM, thanks! |
@sam-mccall ,
The problem remains for more than 3 days already. Would you fix it as soon as it possible or revert your changes? |
Sorry, there were no notifications, I guess the bot was already red. I'm not really sure what to do other than disable the test on these bots - I don't know why it would fail on win/arm (it seems to pass on win/x86), and I don't have access to such a machine. |
... and as soon as I said that, I found something: looks like these are maybe building with I'll see if I can override with edit: hopefully good after 5aa3338 |
@sam-mccall As far as I can see, the bot was green before this change: https://lab.llvm.org/buildbot/#/builders/119/builds/15229 And your commit was the only one in the set of 19 commits that were build that was relevant to this testcase. Have you not received email from the buildbot? |
the test has been passed locally on the builder with this commit. Thank you for the fix. |
b1e3cd1 dropped the leading slash here,
presumably unintentionally.
(I don't understand Driver well enough to know how/where this is supposed
to be tested, but it broke clangd on any project that uses the
system-installed -stdlib=libc++ on a standard debian install)