-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
[modules] -print-file-name=libc++.modules.json does not work in mac m1 #109895
Comments
@llvm/issue-subscribers-clang-modules Author: Chuanqi Xu (ChuanqiXu9)
I received a private report that `-print-file-name=libc++.modules.json` doesn't work well in mac. Maybe this is related to the installation path of libc++ in MacOS.
Verify needed. |
Also it looks like
but in mac m1, the libc++ modules json file is installed to
then |
@llvm/issue-subscribers-clang-driver Author: Chuanqi Xu (ChuanqiXu9)
I received a private report that `-print-file-name=libc++.modules.json` doesn't work well in mac m1. Maybe this is related to the installation path of libc++ in MacOS.
Verify needed. |
I guess we need help from Apple's people @Bigcheese @jansvoboda11 @ldionne |
Not sure if this helps but: % clang++ -print-file-name=libc++.modules.json clang++ --version |
This seems similar to #98325. @Xazax-hun Any appetite for this one? |
Some additional information about the codes, hope this helps: The
and in |
The following patch seems to work for me: index efe398dd531d..78d06a68bf0d 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -192,8 +192,12 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath) {
P = llvm::sys::path::parent_path(Dir);
// This search path is also created in the COFF driver of lld, so any
// changes here also needs to happen in lld/COFF/Driver.cpp
- llvm::sys::path::append(P, CLANG_INSTALL_LIBDIR_BASENAME, "clang",
- CLANG_VERSION_MAJOR_STRING);
+ llvm::sys::path::append(P, CLANG_INSTALL_LIBDIR_BASENAME);
+ // Darwin and AIX does not use per-target runtime directory.
+ if (!llvm::Triple(llvm::sys::getProcessTriple()).isOSDarwin()) {
+ llvm::sys::path::append(P, "clang",
+ CLANG_VERSION_MAJOR_STRING);
+ }
} |
A minor nit: the comment mentions AIX but the code doesn't. |
Yes, I think the code should be updated to do the same for AIX, this comment was copied from another location. Wanted to make sure this is the right approach before cleaning it up. If this looks good to @ChuanqiXu9 and others, I can make a PR with cleaned up code. |
It looks good to me. But I think we need double check from apple forks or Driver owners @jansvoboda11 @Bigcheese @MaskRay |
Any way to move this along? Should I just create a PR? |
I think that would be the quickest way to ensure this gets addressed, since you already have the patch. |
Yes, +1 |
Oh dear... I created a fork and went to compile and now I am getting a new error. This is from the bootstrapped compiler not being able to find stdbool.h. I think it is some update of xcode that has caused this. Anyone seen this? |
I didn't see it. But I think we didn't force contributors to bootstrap their build as far as I know. So maybe we can workaround that. |
I created an issue: #112151 (comment) |
@ChuanqiXu9 do you know anything about how the default include paths get constructed for the clang that is in the build tree I think I found the issue. See my last comment in the issue I created. |
I think it is |
OK, the patch is what is breaking the build. So, my patch does not work. I think perhaps the location of libc++.modules.json should be changed on the mac to match where it is on linux, so that this works. |
@petrhosek can you look at this? I think it is related to the install location of libc++.modules.json. Using git blame I can see you put this code in: |
OK, I have another possible patch. This one does not break the build.
|
Although it might be a little bit add hoc, it is much better than the existing status. I think you can send a PR after you add a test. For the test, you can take a look at: clang/test/Driver/modules-print-library-module-manifest-path.cpp |
Yeah, it did feel a bit ugly. But I think this is a new place for files like this to be found. There is actually some code right above this that looks in "..", just not "../..". Clearly the test is bad, I will see if I can get a test in there that fails the way it is now. |
I received a private report that
-print-file-name=libc++.modules.json
doesn't work well in mac m1. Maybe this is related to the installation path of libc++ in MacOS.Verify needed.
The text was updated successfully, but these errors were encountered: