Open
Description
This is actually a followup to #76733, because somehow I overlooked that when checking the fix for that issue worked.
After building the compiler with the following config.toml:
[build]
build = "x86_64-apple-darwin"
host = ["aarch64-apple-darwin"]
target = ["aarch64-apple-darwin"]
you end up with a compiler without any of the libstd, etc. rlibs, meaning that using the compiler fails with:
error[E0463]: can't find crate for `std`
The same is true when building with the following config.toml on linux:
[build]
build = "x86_64-unknown-linux-gnu"
host = ["i686-unknown-linux-gnu"]
target = ["i686-unknown-linux-gnu"]
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
jyn514 commentedon Sep 30, 2020
How are you building the compiler, what
x.py
command?jyn514 commentedon Sep 30, 2020
It sounds like you're using
build --stage 1 compiler/rustc
; to get the standard library you needbuild --stage 2
.Mark-Simulacrum commentedon Sep 30, 2020
I know what the problem here is, currently thinking/working on a solution.
Mark-Simulacrum commentedon Sep 30, 2020
I think this is the same underlying problem as I noted in #76799 (comment) -- for now, I think
x.py dist library/std src/librustc
should build just std + rustc tarballs and put them in thebuild/dist
directory, and if those are unpacked they will contain the expected contents.The reason this isn't fully working today is because rustbuild has no reason to populate the (internal) stage2/ compiler directory with a standard library and compiler for i686-unknown-linux-gnu; you're not able to run that locally (or so it assumes, since it could be the case).
The proper fix is quite involved -- we'd need to rework rustbuild to support the notion that while we only need to build std for each target once, we need to promote it into multiple places. Which places to copy to is not entirely obvious; I think the right answer is every host compiler in that stage, but it would potentially create awkward artifacts in e.g. i686/stage1/lib/rustlib where they don't really need to be.
I am still thinking -- there might be a targeted fix here that we can apply. For now my recommendation is that if you want to cross-compile, you use x.py dist which is likely always going to be the more stable command (since it gives you closer to "what I asked for" instead of trying to be smart and failing).
glandium commentedon Oct 1, 2020
x.py dist
doesn't leave you with a working compiler in some directory. You need tox.py install
for that, which puts things in/usr/local
, which you may or may not want.Mark-Simulacrum commentedon Oct 1, 2020
That seems easily solvable, though:
[install] prefix = "/my/own/directory"
in config.toml.build
nothost
#81702[-]cross-built compiler can't compile[/-][+]cross-built compiler doesn't have the standard library for the target in its sysroot[/+]Enselic commentedon Nov 26, 2024
Triage: This issue is quite old by now. Is this still a problem?