can't find crate for `std` error for mips-unknown-linux-musl target
arun11299 opened this issue · 2 comments
arun11299 commented
Checklist
- I've looked through the issues and pull requests for similar reports
Describe your issue
Getting error or trying to cross compile/build a simple hello world Rust code to mips-unknown-linux-musl target using cross-rs.
Output with verbose:
+ cargo metadata --format-version 1 --filter-platform mips-unknown-linux-musl
[src/lib.rs:938] &metadata.metadata = None
+ 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 stable-x86_64-unknown-linux-gnu
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu
+ /usr/bin/docker run --userns host -e 'XARGO_HOME=/home/xxx/.xargo' -e 'CARGO_HOME=/home/xxx/.cargo' -e 'CROSS_RUST_SYSROOT=/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu' -e 'CARGO_TARGET_DIR=/target' -e 'CROSS_RUNNER=' -e TERM -e 'USER=xxx' -e 'CROSS_RUSTC_MAJOR_VERSION=1' -e 'CROSS_RUSTC_MINOR_VERSION=75' -e 'CROSS_RUSTC_PATCH_VERSION=0' --name cross-stable-x86_64-unknown-linux-gnu-c4ec6-82e1608df-mips-unknown-linux-musl-af07c-1706867124968 --rm --user 1000:1000 -v /home/xxx/.xargo:/home/xxx/.xargo:z -v /home/xxx/.cargo:/home/xxx/.cargo:z -v /home/xxx/.cargo/bin -v /home/xxx/dev_test/Rust/test-wrt:/home/xxx/dev_test/Rust/test-wrt:z -v /home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:z,ro -v /home/xxx/dev_test/Rust/test-wrt/target:/target:z -w /home/xxx/dev_test/Rust/test-wrt -t ghcr.io/cross-rs/mips-unknown-linux-musl:main sh -c 'PATH="$PATH":"/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin" cargo -v build --target mips-unknown-linux-musl'
Compiling test-wrt v0.1.0 (/home/xxx/dev_test/Rust/test-wrt)
Running `rustc --crate-name test_wrt --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=227 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=2b8063823a563f5f -C extra-filename=-2b8063823a563f5f --out-dir /target/mips-unknown-linux-musl/debug/deps --target mips-unknown-linux-musl -C linker=mips-linux-muslsf-gcc -C incremental=/target/mips-unknown-linux-musl/debug/incremental -L dependency=/target/mips-unknown-linux-musl/debug/deps -L dependency=/target/debug/deps -C target-feature=+crt-static -C link-arg=-s`
error[E0463]: can't find crate for `std`
|
= note: the `mips-unknown-linux-musl` target may not be installed
= help: consider downloading the target with `rustup target add mips-unknown-linux-musl`
error: cannot find macro `println` in this scope
--> src/main.rs:2:5
|
2 | println!("Hello, world!");
| ^^^^^^^
error: requires `sized` lang_item
For more information about this error, try `rustc --explain E0463`.
error: could not compile `test-wrt` (bin "test-wrt") due to 3 previous errors
Caused by:
process didn't exit successfully: `rustc --crate-name test_wrt --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=227 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=2b8063823a563f5f -C extra-filename=-2b8063823a563f5f --out-dir /target/mips-unknown-linux-musl/debug/deps --target mips-unknown-linux-musl -C linker=mips-linux-muslsf-gcc -C incremental=/target/mips-unknown-linux-musl/debug/incremental -L dependency=/target/mips-unknown-linux-musl/debug/deps -L dependency=/target/debug/deps -C target-feature=+crt-static -C link-arg=-s` (exit status: 1)
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu
[cross] warning: rust-std is not available for mips-unknown-linux-musl
[cross] note: you may need to build components for the target via `-Z build-std=<components>` or in your cross configuration specify `target.mips-unknown-linux-musl.build-std`
the available components are core, std, alloc, and proc_macro
What target(s) are you cross-compiling for?
mips-unknown-linux-musl
Which operating system is the host (e.g computer cross is on) running?
- macOS
- Windows
- Linux / BSD
- other OS (specify in description)
What architecture is the host?
- x86_64 / AMD64
- arm32
- arm64 (including Mac M1)
What container engine is cross using?
- docker
- podman
- other container engine (specify in description)
cross version
cross 0.2.5 (ea50548 2024-02-02)
Example
cargo new test-wrt
cd test-wrt
cross -v build --target mips-unknown-linux-musl
Additional information / notes
Based on another issue, I checked whether there was any permission issues to access toolchain files from docker. Did not find any issue as such.
From host:
xxx@home-pc:~$ ls -al /home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib
total 876
drwxrwxr-x 6 xxx xxx 4096 Feb 2 13:48 .
drwxrwxr-x 3 xxx xxx 4096 Feb 2 12:00 ..
-rw-rw-r-- 1 xxx xxx 252 Feb 2 13:48 components
drwxrwxr-x 2 xxx xxx 4096 Feb 2 12:00 etc
-rw-rw-r-- 1 xxx xxx 1482 Feb 2 12:00 manifest-cargo-x86_64-unknown-linux-gnu
-rw-rw-r-- 1 xxx xxx 148 Feb 2 12:00 manifest-clippy-preview-x86_64-unknown-linux-gnu
-rw-rw-r-- 1 xxx xxx 1049 Feb 2 12:00 manifest-rustc-x86_64-unknown-linux-gnu
-rw-rw-r-- 1 xxx xxx 24 Feb 2 12:00 manifest-rust-docs-x86_64-unknown-linux-gnu
-rw-rw-r-- 1 xxx xxx 142 Feb 2 12:00 manifest-rustfmt-preview-x86_64-unknown-linux-gnu
-rw-rw-r-- 1 xxx xxx 104554 Feb 2 13:48 manifest-rust-src
-rw-rw-r-- 1 xxx xxx 2657 Feb 2 12:27 manifest-rust-std-x86_64-pc-windows-gnu
-rw-rw-r-- 1 xxx xxx 2729 Feb 2 12:00 manifest-rust-std-x86_64-unknown-linux-gnu
-rw-rw-r-- 1 xxx xxx 723994 Feb 2 13:48 multirust-channel-manifest.toml
-rw-rw-r-- 1 xxx xxx 555 Feb 2 13:48 multirust-config.toml
-rw-rw-r-- 1 xxx xxx 1 Feb 2 13:48 rust-installer-version
drwxrwxr-x 3 xxx xxx 4096 Feb 2 13:48 src
drwxrwxr-x 3 xxx xxx 4096 Feb 2 12:27 x86_64-pc-windows-gnu
drwxrwxr-x 4 xxx xxx 4096 Feb 2 12:00 x86_64-unknown-linux-gnu
From container:
xxx@home-pc:~$ docker run -v /home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:z,ro -v /home/xxx/dev_test/Rust/test-wrt/target:/target:z -w /home/xxx/dev_test/Rust/test-wrt -it ubuntu:20.04 ls -al /home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib
total 876
drwxrwxr-x 6 1000 1000 4096 Feb 2 08:18 .
drwxrwxr-x 3 1000 1000 4096 Feb 2 06:30 ..
-rw-rw-r-- 1 1000 1000 252 Feb 2 08:18 components
drwxrwxr-x 2 1000 1000 4096 Feb 2 06:30 etc
-rw-rw-r-- 1 1000 1000 1482 Feb 2 06:30 manifest-cargo-x86_64-unknown-linux-gnu
-rw-rw-r-- 1 1000 1000 148 Feb 2 06:30 manifest-clippy-preview-x86_64-unknown-linux-gnu
-rw-rw-r-- 1 1000 1000 24 Feb 2 06:30 manifest-rust-docs-x86_64-unknown-linux-gnu
-rw-rw-r-- 1 1000 1000 104554 Feb 2 08:18 manifest-rust-src
-rw-rw-r-- 1 1000 1000 2657 Feb 2 06:57 manifest-rust-std-x86_64-pc-windows-gnu
-rw-rw-r-- 1 1000 1000 2729 Feb 2 06:30 manifest-rust-std-x86_64-unknown-linux-gnu
-rw-rw-r-- 1 1000 1000 1049 Feb 2 06:30 manifest-rustc-x86_64-unknown-linux-gnu
-rw-rw-r-- 1 1000 1000 142 Feb 2 06:30 manifest-rustfmt-preview-x86_64-unknown-linux-gnu
-rw-rw-r-- 1 1000 1000 723994 Feb 2 08:18 multirust-channel-manifest.toml
-rw-rw-r-- 1 1000 1000 555 Feb 2 08:18 multirust-config.toml
-rw-rw-r-- 1 1000 1000 1 Feb 2 08:18 rust-installer-version
drwxrwxr-x 3 1000 1000 4096 Feb 2 08:18 src
drwxrwxr-x 3 1000 1000 4096 Feb 2 06:57 x86_64-pc-windows-gnu
drwxrwxr-x 4 1000 1000 4096 Feb 2 06:30 x86_64-unknown-linux-gnu
arun11299 commented
I was expecting to see a mips-unknown-linux-musl directory under rustlib, but dont see any.