-
Notifications
You must be signed in to change notification settings - Fork 455
-
I'm trying to cross compile rust-gpu's rustc_codegen_spirv crate. It depends on a specific Rust nightly version and the components: rust-src, rustc-dev and llvm-tools.
The build errors I get are all similar to: error[E0463]: can't find crate for rustc_apfloat. I also get the helpful tip:
= help: maybe you need to install the missing components with:
`rustup component add rust-src rustc-dev llvm-tools-preview`
I'm not certain but it seems like the error is because rust-src (or maybe rustc-dev?) isn't available to the build. I've tried various ways to make the components available:
# Not necessarily all at the same time! I'm just listing various things I've tried.
rustup toolchain install nightly-2023年09月30日
rustup toolchain install nightly-2023年09月30日-aarch64-unknown-linux-gnu
rustup target add aarch64-unknown-linux-gnu
rustup component add rust-src rustc-dev llvm-tools
rustup component add --target aarch64-unknown-linux-gnu rust-src rustc-dev llvm-toolsI should also mention that the repo contains this rust-toolchain.toml:
[toolchain] channel = "nightly-2023年09月30日" components = ["rust-src", "rustc-dev", "llvm-tools"]
I would have thought rustup would auto-install that?
Notes
crossversion:cargo install cross --git https://github.com/cross-rs/cross- Build command:
CROSS_NO_WARNINGS=0 cross build --locked --release --target aarch64-unknown-linux-gnu - I'm mostly working in Github Actions because my own machine is
aarch64and I can't get anycrossDocker images to work.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 4 replies
-
can you show me the full output including the call to cross. You can add -v to get more information about what's happening too
Beta Was this translation helpful? Give feedback.
All reactions
-
Sure, here's the first part of the build. And you can see the full logs at: https://github.com/tombh/rust-gpu-cli/actions/runs/11346728902/job/31556453174#step:5:1
CROSS_NO_WARNINGS=0 cross -v build --locked --release --target aarch64-unknown-linux-gnu
shell: /usr/bin/bash -e {0}
env:
CARGO_TERM_COLOR: always
GH_TOKEN: ***
+ cargo metadata --format-version 1 --filter-platform aarch64-unknown-linux-gnu
[cross] warning: Found conflicting cross configuration in `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/getrandom-0.2.15/Cargo.toml`, use `[workspace.metadata.cross]` in the workspace manifest instead.
Currently only using configuration from `/home/runner/work/rust-gpu-cli/rust-gpu-cli/Cargo.toml`
+ rustc --print sysroot
+ /usr/bin/docker
+ /usr/bin/docker version -f '{{ .Server.Os }},,,{{ .Server.Arch }}'
+ /usr/bin/docker info -f {{.SecurityOptions}}
+ rustup toolchain list
+ rustup target list --toolchain nightly-2023年09月30日-x86_64-unknown-linux-gnu
+ rustup target add aarch64-unknown-linux-gnu --toolchain nightly-2023年09月30日-x86_64-unknown-linux-gnu
info: downloading component 'rust-std' for 'aarch64-unknown-linux-gnu'
info: installing component 'rust-std' for 'aarch64-unknown-linux-gnu'
+ /usr/bin/docker run --userns host -e 'XARGO_HOME=/home/runner/.xargo' -e 'CARGO_HOME=/home/runner/.cargo' -e 'CROSS_RUST_SYSROOT=/home/runner/.rustup/toolchains/nightly-2023年09月30日-x86_64-unknown-linux-gnu' -e 'CARGO_TARGET_DIR=/target' -e 'CROSS_RUNNER=' -e CROSS_NO_WARNINGS -e CARGO_TERM_COLOR -e 'USER=runner' -e 'CROSS_RUSTC_MAJOR_VERSION=1' -e 'CROSS_RUSTC_MINOR_VERSION=74' -e 'CROSS_RUSTC_PATCH_VERSION=0' --name cross-nightly-2023年09月30日-x86_64-unknown-linux-gnu-df82f-8ce4540bd-aarch64-unknown-linux-gnu-8ad27-1728997773600 --rm --user 1001:127 -v /home/runner/.xargo:/home/runner/.xargo:z -v /home/runner/.cargo:/home/runner/.cargo:z -v /home/runner/.cargo/bin -v /home/runner/work/rust-gpu-cli/rust-gpu-cli:/home/runner/work/rust-gpu-cli/rust-gpu-cli:z -v /home/runner/.rustup/toolchains/nightly-2023年09月30日-x86_64-unknown-linux-gnu:/home/runner/.rustup/toolchains/nightly-2023年09月30日-x86_64-unknown-linux-gnu:z,ro -v /home/runner/work/rust-gpu-cli/rust-gpu-cli/target:/target:z -w /home/runner/work/rust-gpu-cli/rust-gpu-cli ghcr.io/cross-rs/aarch64-unknown-linux-gnu@sha256:9808d7b7563a6334042c00555e473d0e0be46a171e3426301030118807280c86 sh -c 'PATH="$PATH":"/home/runner/.rustup/toolchains/nightly-2023年09月30日-x86_64-unknown-linux-gnu/bin" cargo -v build --locked --release --target aarch64-unknown-linux-gnu'
Unable to find image 'ghcr.io/cross-rs/aarch64-unknown-linux-gnu@sha256:9808d7b7563a6334042c00555e473d0e0be46a171e3426301030118807280c86' locally
ghcr.io/cross-rs/aarch64-unknown-linux-gnu@sha256:9808d7b7563a6334042c00555e473d0e0be46a171e3426301030118807280c86: Pulling from cross-rs/aarch64-unknown-linux-gnu
9ea8908f4765: Pulling fs layer
...
There are more runs here: https://github.com/tombh/rust-gpu-cli/actions
The workflow is here: https://github.com/tombh/rust-gpu-cli/pull/1/files#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34R43
Beta Was this translation helpful? Give feedback.
All reactions
-
Interesting!
The crates should live in $RUSTUP_HOME/toolchains/nightly-2023年09月30日-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib, maybe they exist but are not visible to docker due to rustup doing something wrong?
Can you do
rustup component add rustc-dev
and then
cross-util run --target aarch64-unknown-linux-gnu -- "ls -la $(rustup show home)/toolchains/nightly-2023年09月30日-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib
(not sure if this exact line would work, but you just need to give it the RUSTUP_HOME)
Beta Was this translation helpful? Give feedback.
All reactions
-
oh, duh. I think I solved it now thinking about it :3 try adding the rustc-dev-aarch64-unknown-linux-gnu component
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank you for your ideas. I'm still seeing the error. Now, I actually think it's an issue in rustup: rust-lang/rustup#3255
Do you think it's worth exploring trying to cross compile without rustup?
Beta Was this translation helpful? Give feedback.