-
Notifications
You must be signed in to change notification settings - Fork 93
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
Force sysroot to have different hashes #217
Conversation
a540329
to
0459e7c
Compare
Sorry for the long silence. I am slowly going over our backlog of PRs. ;) How can sysroot and project share a dependency? Even when libstd depends on a crate, that should be completely separate from the crate that the project itself uses. I also don't understand what all those changes about |
They're unrelated, I accidentally made the PR with the master branch of my fork. I'll rebase this banch so it only has the sysroot fix later, and open PRs for the other commits.
Well, when I was working on
This would only happen if the libstd and crate are built in the same mode (e.g. both debug or both release) and the featureset used in both sides end up being the same. The reason why this isn't a problem in Rust's libstd is that all dependencies are built with a |
That sounds like a wrong use of hashbrown though. These features specifically exist to let libstd depend on crates, and depending on crates in another way is not supported. |
It absolutely is a wrong use. I'm just pointing out that the same underlying "issue" of crates sharing the same featureset on both side failing a build is likely to exist with the current implementation, and is simply being worked around by having a "private" feature that shouldn't be used by anyone. |
Interesting. I thought the feature mostly served for dependency tracking, and that not picking up the "wrong" crate is done through the sysroot handling (the rustc sysroot also includes a whole bunch of other crates, ones that rustc depends on, that do not have a special feature; AFAIK rustc treats those crates specially to make sure they do not get picked). The question remains, though, why unsupported/incorrect ways of adding crate dependencies to libstd should work with xargo? We barely have the capacity to keep "normal" uses of xargo working. |
There could be dependencies of |
Those would have to be |
@jethrogb if you think this is a worthwhile feature and want to do the review, I won't block it. I just don't think I want to spend the time needed to review support for this use case. However, if we land anything like this, it should come with a test. |
Xargo has its own system to work around this, which is build stages. Without this fix, build stages are basically broken in some configurations. With build stages, you can use crates that depend on core or alloc by building them in a later stage. See megaton-hammer's Xargo.toml: https://github.com/MegatonHammer/megaton-hammer/blob/master/Xargo.toml We build std in a later stage, so all previous sysroot crates are available as a dependency to libstd and its dep. |
That's not true -- Miri used them for years and they were needed. This only recently changed with rust-lang/rust#63637. |
But you have a point that the README basically indicates this as a supported use-case. |
Ok but you're the one who resurrected this issue 😄 |
Well I want to either close or merge all our PRs. I don't like them lingering. ;) So we might want to close this saying "sorry, xargo is in maintenance mode", or we actually review it. I don't see a good argument for just leaving it sitting here if we don't intend to review it. |
Or we might be able to coerce @roblabla into helping us with maintenance :D |
Also, I'd like to point out that this specific use-case is how many console homebrew toolchains use xargo for this feature. The ability to build a custom libstd with a custom crate graph has been a huge help for ctru-rs (a 3ds homebrew toolchain), rusty-horizon (another switch homebrew toolchain) and a few others. They currently all work around this problem in various ways (Using I'll try to add a test, split the commits and rebase later today. |
Yeah, I was also bitten by this in |
All right, I was not aware how much xargo is used to compile alternative libstds. That's useful information. The request for help in maintaining xargo still stands, though. ;) |
I tried writing a simple test by adding Unfortunately I don't really have a whole lot of time to dedicate to this issue, and don't currently maintain a custom libstd myself, so I'm not going to punt on this issue. Feel free to close, and I guess I'll reopen if I ever hit the issue again, or if somebody else manages to get a reproducer. I asked some of the people working on homebrew toolchains (Rust with Blackjack server) if they'd be interested in helping with the maintenance. I can't really dedicate much time to xargo maintenance myself, I'm stretched a bit too thin right now. |
257: Pass message-format to the cargo building the sysroot r=RalfJung a=roblabla Currently, `--message-format` is forwarded to the cargo building the final crate, but not when building the sysroot. This can break some tools that work by analyzing the output of `cargo build --message-format=json` when using xargo as a cargo replacement. (Split off from #217 ) Co-authored-by: roblabla <[email protected]>
Indeed I'd prefer we have some way to reproduce this in a minimal example before adding an undocumented env var. Help with that would be welcome. :) I opened #261 to track this problem, and will close the PR. Thanks! |
269: Force different metadata for sysroot crates r=RalfJung a=roblabla If the sysroot and project share a dependency, it might cause conflicts, leading to confusing cargo errors. See https://github.com/roblabla/xargo-reproducer for a reproducer of the issue. This is the same patch as #217 . Fixes #261 I have a way to reproduce the issue this time around (see the issue), but I'm having a hard time figuring out how to properly integrate it within xargo's smoketest. I don't think it's really possible to do in a robust way, actually... Co-authored-by: roblabla <[email protected]>
A terrible workaround a problem I found: If the sysroot and project share a dependency, it might cause conflicts, leading to confusing cargo errors.