-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Try to find the Windows resource compiler on the PATH first #146689
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
Conversation
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
This comment has been minimized.
This comment has been minimized.
e057d3e
to
0817a30
Compare
Going to try to understand #146693 a bit more before calling it fixed |
In some situations `cc::windows_registry::find_msvc_tool("link.exe")` returns a `Tool` with an empty environment (without the Windows SDK tools in the PATH). This happens if link.exe itself was found on the PATH, for example if you're in a VS Developer Command Prompt. Update the `find_resource_compiler` to more closely follow how `cc::windows_registry` does it: first try to find "rc.exe" on the PATH and only if that fails (and also if "link.exe" isn't on the PATH), try to locate it indirectly via `find_msvc_tool("link.exe")`
0817a30
to
9b1c5d4
Compare
Ok, AFAICT in local testing this should fix #146693. Once rust-lang/cc-rs#1553 is in a released crate and we pick it up, all of this will get much simpler. But this will at least unblock downstream folks |
rust-lang/cc-rs#1553 has released |
Closing in favor of #146784 |
In some situations
cc::windows_registry::find_msvc_tool("link.exe")
returns aTool
with an empty environment (without the Windows SDK tools in the PATH). This happens if link.exe itself was found on the PATH, for example if you're in a VS Developer Command Prompt.Update the
find_resource_compiler
to more closely follow howcc::windows_registry
does it: first try to find "rc.exe" on the PATH and only if that fails (and also if "link.exe" isn't on the PATH), try to locate it indirectly viafind_msvc_tool("link.exe")
There's also the related PR: #46663 which provides a way for bootstrap to override the resource compiler that will be used. This PR does not conflict with that one - if bootstrap provides a resource compiler, that one will be used, otherwise we land in the logic in this PR
Ideally we could update
cc
(or rather use itsfind-msvc-tools
crate) to a version that can findrc.exe
itself - that is possible in rust-lang/cc-rs#1553 which is not released yetAddresses #146018 (comment)
Fixes: #146693