-
Notifications
You must be signed in to change notification settings - Fork 13k
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
A rustc
compiled from the rust-*-src
tarballs can't be used with the std
binaries from s.r-l.o/dist
#33286
Comments
I've never considered that it should be possible to mix binaries from compilers of different origin - our metadata situation used to be so screwed up that I just assumed it wouldn't be, and I suspect we intentionally made it impossible at some point in the past. I don't know if even today it's possible. I would assume that e.g. changing cfg values will invalidate the metadata, though perhaps we embed and validate cfg compatibility by now. |
After considering it further, I don't see why this shouldn't be possible. This case wouldn't be mixing crates produced by different compilers. It's just reading a complete collection of crates produced by a different compiler. |
There may still be some conditional values embedded in the compiler that could influence crate behavior. Use of unstable features could be one, but that is mostly determined by the version number.
Something like this I think. |
The original problem is that the metadata format occasionally changes between nightlies, so that |
I think we should just compare the commit hash - that means storing it in the tarball. |
So this is a duplicate of #31393 (which I've closed in favor of this), but the conclusion reached there appears to be incorrect to me.
@alexcrichton noted in #31393 that if we only check git commits it'll suffice for "these should link together." However, that won't work for this issue's case since there is no commit hash for the version, as far as I can tell. I'm not sure what the right steps are in that case, so not marking as E-easy for the time being. @alexcrichton Any thoughts on this? Could you propose a solution? |
I believe it boils down to these lines of code in the build system right now. They don't work (return As to how to do that, I'd be fine with just generating some file during the creation of the source tarball. |
Triage: the code is now here: https://github.com/rust-lang/rust/blob/master/src/bootstrap/tool.rs#L244-L253 |
Do we have any progress on this issue ? Doesn't seem to be much activity |
Just got this error when trying to use the std binaries for the Is this just an issue of mismatched metadata (commit hash/date) that causes the compilation error, or is the problem deeper rooted (i.e. compilation for target necessary)? |
I think this is just an issue of mismatched metadata; the compiler was built from the same sources, so it should be able to read libraries built by the same sources, even if they're a different physical binary. It turns out that we already vendor the version hash when creating the Mentoring instructions: In Line 1335 in 85c87f6
self.rust_info.is_git().is_none() . If so, manually add the git commit from git-commit-hash . It's ok to panic if that file isn't present; the only supported way to build without git sources is through the vendored source tarball.
@rustbot label +E-mentor +E-easy |
@rustbot claim |
Originally reported here
In the reported case the
rust
package provided by Arch Linux was compiled from therustc-1.8.0-src.tar.gz
tarball. Thus theirrustc
binary doesn't have a git commit hash encoded in it:And if you try to use this
rustc
to cross compile using thestd
binaries from s.r-l.o you get the following error:At the center of this issue is this check, this rustc_version function and this CFG_VERSION env variable which is set by the build system.
In the case of the
std
crate since it was compiled from a git checkout the value returned byrustc_version
is1.8.0 ($SOME_HASH $SOME_DATE)
whereas the same function just returns1.8.0
in the case of arustc
that was compiled from a source tarball. The mismatch between these two strings is what causes the error reported above. But the error message is wrong because both binaries where compiled from the exact same source code and can be used together.How to fix this? Possible solutions:
rustc-*-src.tar.gz
tarballs, perhaps as a.commit-hash
file and tweak the build system to use the contents of this file in the "rustc_version" string when one is not building from a git checkout.Thoughts? @alexcrichton @brson
The text was updated successfully, but these errors were encountered: