-
Notifications
You must be signed in to change notification settings - Fork 103
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
Unwrap clang using clang version #40
Conversation
This PR obtains clang through a given clang wrapper by calling its `--version` and parsing the installation directory. In particular, this should be universal with any "nice" toolchain that mimic Bazel's clang wrapping.
Oh, nice. That's a clever unwrapping trick. Does this work with the Apple wrapper, though? I'd think the wrapper might have already crashed without the environment variables before it even gets to invoke clang with --version? (Haven't gotten a chance to test yet; trying to help get Windows support landed.) If that is a problem, could we solve your case (as in the other PR) by only applying the current unwrapping if the compiler ends in .sh? You still haven't really explained what the original problem you were running into was, but I think it's that you're using a custom compiler on Apple platforms, where you still need the If that's not a problem: We probably shouldn't do it both in _all_platforms_patch and _apple_platform_patch. That seems like double coverage. And clangd can introspect non-crashing wrappers with --query_driver just fine. |
There was some misunderstanding on my end. This does work on the Apple wrapper, but there is that slight problem of double coverage. Considering |
Hey, yeah, so I just tested it, and this doesn't seem to work with the default Apple wrapper. Running the wrapper with
[Note to self: If merged, would need something parallel for Windows.] FWIW there are .sh wrappers, like the grailbio LLVM ones, that work fine, last I checked, at least with --query-driver passed. Wouldn't be upset if they were unwrapped, but we don't need to. Indeed, the only ones I know of that don't work are the Apple default wrappers. My mistake on the apple wrapped_clang and wrapped_clang_pp not having .sh extensions. No double coverage, but it does (at least) break things for a default macOS setup. |
Could you explain a little more to me about what issue we're trying to solve here? Maybe with an example? |
^ Please do still answer, but would just adding
|
The grailio wrappers were not working. I've moved development to containerized Linux, so all of this is not really necessary for me anymore, however it probably makes sense to use the version for unwrapping. |
It would still be great to understand (and fix) whatever the underlying issue was! Both for you and for others. [I just ran a quick test w/ the grailbio toolchain and couldn't coax out an issue--so I need your help. We left the compiler wrapped, but --query-driver (from the README) caused clangd to correctly introspect the default includes.] |
Ah ha! I did not know about the
|
Oh! Great! Glad that solved it for you :) |
All that said, if we ever do want/need to unwrap everything, I'm going straight to your --version based fix--at least outside of the default macOS wrapper. Thanks for a clever solution that'll we'll have in our tool belts if we ever need it. |
This PR obtains clang through a given clang wrapper by calling its
--version
and parsing the installation directory. In particular, this should be universal with any "nice" toolchain that mimic Bazel's clang wrapping.