-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
rustbuild: detect cxx for all targets #61765
Conversation
Replaces rust-lang#61544 Fixes rust-lang#59917 We need CXX to build llvm-libunwind which can be enabled for all targets. As we needed it for all hosts anyways, just move the detection so that it is ran for all targets (which contains all hosts) instead. Signed-off-by: Marc-Antoine Perennou <[email protected]>
(rust_highfive has picked a reviewer for you, use r? to override) |
I don't think this is quite right because it seems like it will cause a failure for any cross-compiled target which doesn't have a C++ compiler configure (which was the original intention). If one is configured the configuration should propagate through, otherwise we should continue to ignore unconfigured C++ compilers for just the standard library. |
I'll do some further testing removing cxx from the i686 configuration to see how things go |
Current master, cxx unset for i686, i686 in targets but not hosts:
Current master, cxx unset for i686, i686 in targets and hosts:
So the current code doesn't make anything fail if cxx is not defined, it just uses the fallback value of Now with this patch, i686 in target but not in hosts, cxx still unset:
It indeed produces a different result, as it uses the same value as Making it behave the same is easy though, fixing right now |
Signed-off-by: Marc-Antoine Perennou <[email protected]>
With this new patch added, we get the same behaviour as before this merge request when cxx is not set in config.toml:
|
I don't think I understand why the patch preserves the original behavior? All fallible locations have switched to being infallible, so where's the failure case handled of the compiler not being available? |
Before these changes, After these changes, |
Signed-off-by: Marc-Antoine Perennou <[email protected]>
With this last patch, it is only set for targets for which it has been configured, restoring the fallible locations |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Signed-off-by: Marc-Antoine Perennou <[email protected]>
@alexcrichton with this last commit, we should be back to the same behaviour as before, but cxx gets properly detected for targets for which it's configured. I wonder though if instead of setting |
Should I squash everything? |
src/bootstrap/cc_detect.rs
Outdated
} | ||
let alternative = format!("e{}", gnu_compiler); | ||
if Command::new(&alternative).output().is_ok() { | ||
cfg.compiler(alternative); | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the return true
here and eslewehre in this function may not be what we want? This all seems largely about auto-inference of what gcc should be used, but it doesn't imply that it was configured this way in particular. Notably I think that we should only actually probe for a C++ compiler if it's explicitly configured.
Note though that the C++ compiler can be configured not only via config.toml
but also the standard CXX_...
variables that cc
supports. In that sense I don't think the return value from this function is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was to behave exactly as before for hosts, but I'm 100% fine with dropping that.
We at least need to set it to the default 'c++' for the build hosts though otherwise the build fails on CI (or we need to explicitely configure cxx in the ci)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For hosts, yes, but this logic seems like if you configure a target for one of these targets and you're missing the inferred C++ compiler it will fail, right?
Signed-off-by: Marc-Antoine Perennou <[email protected]>
@alexcrichton is it clearer now? |
@bors: r+ Sure, we can go with this for now. |
📌 Commit 870f13a has been approved by |
⌛ Testing commit 870f13a with merge 08bd23c5c32b753a7ff0700a5d7deb03feeace6d... |
💔 Test failed - checks-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
If I understand correctly, the failing ones are because the build host is not in hosts? |
Even if it's not in hosts Signed-off-by: Marc-Antoine Perennou <[email protected]>
@bors: r+ |
📌 Commit 087cd77 has been approved by |
☀️ Test successful - checks-travis, status-appveyor |
Replaces #61544
Fixes #59917
We need CXX to build llvm-libunwind which can be enabled for alltargets.
As we needed it for all hosts anyways, just move the detection so that it is ran for all targets (which contains all hosts) instead.