Issue when building with `cross rustdoc`
makspll opened this issue · 13 comments
Maintainers note: The issue was filed wrongly initially, the real issue is using cross rustdoc
Checklist
- I've looked through the issues and pull requests for similar reports
Describe your issue
When running
cross +nightly-2023-07-16-aarch64-unknown-linux-gnu rustdoc --target=aarch64-unknown-linux-gnu -p bevy_asset@0.11.2 -- -Zunstable-options --output-format json
I get the following error:
[cross] warning: unable to get metadata for package
[cross] note: Falling back to `cargo` on the host.
qemu-aarch64: Could not open '/lib/ld-linux-aarch64.so.1': No such file or directory
If I use +nightly-2023-07-16
by itself, it runs successfully but it fallbacks to cargo on host and the build clearly isn't being done on arm64.
What target(s) are you cross-compiling for?
aarch64-unknown-linux-gnu
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
0.2.5
Example
No response
Additional information / notes
No response
This is a current limitation with our images, all our current images run with platform = linux/amd64
, not linux/arm64
. If you need arm64 host support you need to make the image yourself, see target.TARGET.image.toolchain
The tracking issue for overall aarch64 host support is #751
In there there's also an example of how to use the feature
Hi I am not trying to run on an Arm64 host but to cross compile to Arm64 from x86
Aha, I see!
The toolchain you picked is not valid, it should be cross +nightly-2023-07-16-x86_64-unknown-linux-gnu ...
in never versions of cross you'll get an error message
Note:
Overriding the toolchain in cross is only possible in CLI by specifying a channel and optional date: `+channel[-YYYY-MM-DD]`.
To override the toolchain mounted in the image, set `target.aarch64-unknown-linux-gnu.image.toolchain = "aarch64-unknown-linux-gnu"`
Suggestion: try `cross +1.65` instead
however, I just noticed that you're trying to use rustdoc! We don't support rustdoc as a command, not sure why though.
For now, use cross doc
and set env var RUSTDOCFLAGS
I think I'll explain a bit more so that it's totally clear what happened here initially!
cross uses a rust toolchain, like nightly-x86_64-unknown-linux-gnu
, inside a docker container by mounting that toolchain from the system hosting the container engine. To compile for a specific target like aarch64-unknown-linux-gnu
, rust specifies targets (see rustup target list
). These targets are used to compile, with any "host" toolchain, for a specific target triplet. All cross does is setup a cross-compilation friendly environment so that tools needed to compile for that target is available.
I've fixed the issue with rustdoc now hopefully, can you try it out with #1342
cargo install cross --git https://github.com/cross-rs/cross --branch explain-fallback-fix-rustdoc
Hey, thanks so much! Will try now
Okay I tried with that branch and the following command:
cross +nightly-2023-07-16 rustdoc --target=aarch64-unknown-linux-gnu -p bevy_asset@0.11.2 -- -Zunstable-options --output-format json
but got this error:
error[E0463]: can't find crate for `proc_macro_hack`
--> /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/const-random-0.1.15/src/lib.rs:2:5
|
2 | use proc_macro_hack::proc_macro_hack;
| ^^^^^^^^^^^^^^^ can't find crate
error[E0463]: can't find crate for `const_random_macro`
--> /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/const-random-0.1.15/src/lib.rs:16:9
|
16 | pub use const_random_macro::const_random;
| ^^^^^^^^^^^^^^^^^^ can't find crate
error: cannot determine resolution for the attribute macro `proc_macro_hack`
--> /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/const-random-0.1.15/src/lib.rs:15:3
|
15 | #[proc_macro_hack(fake_call_site)]
| ^^^^^^^^^^^^^^^
|
= note: import resolution is stuck, try simplifying macro imports
error[E0463]: can't find crate for `thiserror_impl`
--> /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.40/src/lib.rs:246:9
|
246 | pub use thiserror_impl::*;
| ^^^^^^^^^^^^^^ can't find crate
For more information about this error, try `rustc --explain E0463`.
error: could not compile `const-random` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `thiserror` (lib) due to previous error
error[E0463]: can't find crate for `tracing_attributes`
--> /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-0.1.37/src/lib.rs:959:9
|
959 | pub use tracing_attributes::instrument;
| ^^^^^^^^^^^^^^^^^^ can't find crate
error[E0463]: can't find crate for `bytemuck_derive`
--> /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytemuck-1.13.1/src/lib.rs:129:9
|
129 | pub use bytemuck_derive::{
| ^^^^^^^^^^^^^^^ can't find crate
error: cannot determine resolution for the import
--> /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytemuck-1.13.1/src/anybitpattern.rs:1:13
|
1 | use crate::{Pod, Zeroable};
| ^^^
error: cannot determine resolution for the import
--> /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytemuck-1.13.1/src/anybitpattern.rs:1:18
|
1 | use crate::{Pod, Zeroable};
| ^^^^^^^^
error: cannot determine resolution for the import
--> /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytemuck-1.13.1/src/checked.rs:6:3
|
6 | AnyBitPattern, NoUninit,
| ^^^^^^^^^^^^^
error: cannot determine resolution for the import
--> /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytemuck-1.13.1/src/checked.rs:6:18
|
6 | AnyBitPattern, NoUninit,
| ^^^^^^^^
error: cannot determine resolution for the import
--> /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytemuck-1.13.1/src/no_uninit.rs:1:5
|
1 | use crate::Pod;
| ^^^^^^^^^^
error[E0432]: unresolved imports `crate::Pod`, `crate::Zeroable`, `crate::AnyBitPattern`, `crate::NoUninit`, `crate::Pod`
--> /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytemuck-1.13.1/src/anybitpattern.rs:1:13
|
1 | use crate::{Pod, Zeroable};
| ^^^ ^^^^^^^^
|
::: /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytemuck-1.13.1/src/checked.rs:6:3
|
6 | AnyBitPattern, NoUninit,
| ^^^^^^^^^^^^^ ^^^^^^^^
|
::: /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytemuck-1.13.1/src/no_uninit.rs:1:5
|
1 | use crate::Pod;
| ^^^^^^^^^^
thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_resolve/src/lib.rs:1913:67
stack backtrace:
0: 0x7f41c23961e1 - std::backtrace_rs::backtrace::libunwind::trace::h3b5c50f24cf4b35a
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7f41c23961e1 - std::backtrace_rs::backtrace::trace_unsynchronized::he026a26ead582316
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f41c23961e1 - std::sys_common::backtrace::_print_fmt::h76fd67678968a4e3
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/sys_common/backtrace.rs:65:5
3: 0x7f41c23961e1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdd83524e3f3c2be2
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f41c23fc19c - core::fmt::rt::Argument::fmt::h654276e7f109452e
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/core/src/fmt/rt.rs:138:9
5: 0x7f41c23fc19c - core::fmt::write::h138407e966f7b43b
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/core/src/fmt/mod.rs:1094:21
6: 0x7f41c2388b8e - std::io::Write::write_fmt::h2424dcece48dafda
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/io/mod.rs:1714:15
7: 0x7f41c2395ff5 - std::sys_common::backtrace::_print::hed0bf89a99fb894c
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7f41c2395ff5 - std::sys_common::backtrace::print::h247f5c941c9353a5
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7f41c2398da3 - std::panicking::default_hook::{{closure}}::hcccd6b964b717049
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/panicking.rs:269:22
10: 0x7f41c2398b34 - std::panicking::default_hook::hce795b61120bca6d
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/panicking.rs:288:9
error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /target/debug/deps/libserde_derive-552deed17fc288bd.so)
--> /home/makspll/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.164/src/lib.rs:340:1
|
340 | extern crate serde_derive;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
11: 0x7f41c562a27b - <rustc_driver_impl[36a7eaa3807b03c1]::install_ice_hook::{closure#0} as core[81c8fe8a09de0f06]::ops::function::FnOnce<(&core[81c8fe8a09de0f06]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
12: 0x7f41c23995ce - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h3187784b6c983a99
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/alloc/src/boxed.rs:2021:9
13: 0x7f41c23995ce - std::panicking::rust_panic_with_hook::h46c9d18986d08847
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/panicking.rs:709:13
14: 0x7f41c2399311 - std::panicking::begin_panic_handler::{{closure}}::h9240e694e6b0cb3e
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/panicking.rs:595:13
15: 0x7f41c2396646 - std::sys_common::backtrace::__rust_end_short_backtrace::h37d9a711c5606b4e
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/sys_common/backtrace.rs:151:18
16: 0x7f41c23990a2 - rust_begin_unwind
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/panicking.rs:593:5
17: 0x7f41c23f8543 - core::panicking::panic_fmt::hb353582dad440800
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/core/src/panicking.rs:67:14
18: 0x7f41c23f85d3 - core::panicking::panic::hfb3ea9ceb774db6b
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/core/src/panicking.rs:117:5
19: 0x7f41c46b515d - <rustc_resolve[e1f6c3e8a3137548]::Resolver>::resolve_rustdoc_path
20: 0x7f41c46b493a - <rustc_resolve[e1f6c3e8a3137548]::late::LateResolutionVisitor>::resolve_and_cache_rustdoc_path
21: 0x7f41c46af0eb - <rustc_resolve[e1f6c3e8a3137548]::late::LateResolutionVisitor>::resolve_doc_links
22: 0x7f41c46f6602 - <rustc_resolve[e1f6c3e8a3137548]::Resolver>::late_resolve_crate
23: 0x7f41c46f592b - <rustc_session[b1a5d361b73cfad9]::session::Session>::time::<(), <rustc_resolve[e1f6c3e8a3137548]::Resolver>::resolve_crate::{closure#0}>
24: 0x7f41c46f2a46 - rustc_interface[b60702df0ae80ef4]::passes::resolver_for_lowering
25: 0x7f41c4ab1aaa - rustc_query_impl[f1760b35ee71e15a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f1760b35ee71e15a]::query_impl::resolver_for_lowering::dynamic_query::{closure#2}::{closure#0}, rustc_middle[bafd45fe52eb4faf]::query::erase::Erased<[u8; 8usize]>>
26: 0x7f41c4ab1a99 - <rustc_query_impl[f1760b35ee71e15a]::query_impl::resolver_for_lowering::dynamic_query::{closure#2} as core[81c8fe8a09de0f06]::ops::function::FnOnce<(rustc_middle[bafd45fe52eb4faf]::ty::context::TyCtxt, ())>>::call_once
27: 0x7f41c4a1fc8c - rustc_query_system[a39b5eca44b3ed3c]::query::plumbing::try_execute_query::<rustc_query_impl[f1760b35ee71e15a]::DynamicConfig<rustc_query_system[a39b5eca44b3ed3c]::query::caches::SingleCache<rustc_middle[bafd45fe52eb4faf]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[f1760b35ee71e15a]::plumbing::QueryCtxt, false>
28: 0x7f41c4f5ba05 - rustc_query_impl[f1760b35ee71e15a]::query_impl::resolver_for_lowering::get_query_non_incr::__rust_end_short_backtrace
29: 0x7f41c48a0993 - <rustc_middle[bafd45fe52eb4faf]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[36a7eaa3807b03c1]::run_compiler::{closure#1}::{closure#2}::{closure#2}, &rustc_data_structures[35b5ace3765b8b60]::steal::Steal<(rustc_middle[bafd45fe52eb4faf]::ty::ResolverAstLowering, alloc[2889214108738437]::rc::Rc<rustc_ast[20c04f8646ec3dd0]::ast::Crate>)>>
30: 0x7f41c489fd8a - <rustc_interface[b60702df0ae80ef4]::interface::Compiler>::enter::<rustc_driver_impl[36a7eaa3807b03c1]::run_compiler::{closure#1}::{closure#2}, core[81c8fe8a09de0f06]::result::Result<core[81c8fe8a09de0f06]::option::Option<rustc_interface[b60702df0ae80ef4]::queries::Linker>, rustc_span[d4de8c39017ea598]::ErrorGuaranteed>>
31: 0x7f41c48991d5 - rustc_span[d4de8c39017ea598]::set_source_map::<core[81c8fe8a09de0f06]::result::Result<(), rustc_span[d4de8c39017ea598]::ErrorGuaranteed>, rustc_interface[b60702df0ae80ef4]::interface::run_compiler<core[81c8fe8a09de0f06]::result::Result<(), rustc_span[d4de8c39017ea598]::ErrorGuaranteed>, rustc_driver_impl[36a7eaa3807b03c1]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
32: 0x7f41c4898c46 - <scoped_tls[121ecede58d5c05f]::ScopedKey<rustc_span[d4de8c39017ea598]::SessionGlobals>>::set::<rustc_interface[b60702df0ae80ef4]::interface::run_compiler<core[81c8fe8a09de0f06]::result::Result<(), rustc_span[d4de8c39017ea598]::ErrorGuaranteed>, rustc_driver_impl[36a7eaa3807b03c1]::run_compiler::{closure#1}>::{closure#0}, core[81c8fe8a09de0f06]::result::Result<(), rustc_span[d4de8c39017ea598]::ErrorGuaranteed>>
33: 0x7f41c489820c - std[fa39155a576d62c5]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b60702df0ae80ef4]::util::run_in_thread_pool_with_globals<rustc_interface[b60702df0ae80ef4]::interface::run_compiler<core[81c8fe8a09de0f06]::result::Result<(), rustc_span[d4de8c39017ea598]::ErrorGuaranteed>, rustc_driver_impl[36a7eaa3807b03c1]::run_compiler::{closure#1}>::{closure#0}, core[81c8fe8a09de0f06]::result::Result<(), rustc_span[d4de8c39017ea598]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[81c8fe8a09de0f06]::result::Result<(), rustc_span[d4de8c39017ea598]::ErrorGuaranteed>>
34: 0x7f41c4897fce - <<std[fa39155a576d62c5]::thread::Builder>::spawn_unchecked_<rustc_interface[b60702df0ae80ef4]::util::run_in_thread_pool_with_globals<rustc_interface[b60702df0ae80ef4]::interface::run_compiler<core[81c8fe8a09de0f06]::result::Result<(), rustc_span[d4de8c39017ea598]::ErrorGuaranteed>, rustc_driver_impl[36a7eaa3807b03c1]::run_compiler::{closure#1}>::{closure#0}, core[81c8fe8a09de0f06]::result::Result<(), rustc_span[d4de8c39017ea598]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[81c8fe8a09de0f06]::result::Result<(), rustc_span[d4de8c39017ea598]::ErrorGuaranteed>>::{closure#1} as core[81c8fe8a09de0f06]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
35: 0x7f41c23a3c55 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h83f49025b00909a5
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/alloc/src/boxed.rs:2007:9
36: 0x7f41c23a3c55 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h21b0d4679eed4e05
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/alloc/src/boxed.rs:2007:9
37: 0x7f41c23a3c55 - std::sys::unix::thread::Thread::new::thread_start::h030641e4e4790460
at /rustc/4c8bb79d9f565115637cc6da739f8389e79f3a29/library/std/src/sys/unix/thread.rs:108:17
38: 0x7f41c226a609 - start_thread
39: 0x7f41c218d133 - clone
40: 0x0 - <unknown>
error: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.73.0-nightly (4c8bb79d9 2023-07-15) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on -C linker=aarch64-linux-gnu-gcc
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [resolver_for_lowering] getting the resolver for lowering
end of query stack
Some errors have detailed explanations: E0432, E0463.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `bytemuck` (lib) due to 7 previous errors
error: could not compile `tracing` (lib) due to previous error
error: could not compile `serde` (lib) due to previous error
make: *** [makefile:62: make_json_files] Error 101
hmm, i feel like there's some information missing here, can you post the full log? I'll try this myself later this weekend, is the project you're compiling from public? I guess maybe I can reproduce it with just a cargo.toml using bevy_asset@0.11.2
oh also, please try a cargo clean --target aarch64-unknown-linux-gnu
then run the command again, the fact that this produces a ice is interesting though
oh and also! Generally, cross
or really any cross compilation tool, isn't really needed when targeting another target, are you sure it doesn't just work with cargo +nightly-2023-07-16 rustdoc --target=aarch64-unknown-linux-gnu -p bevy_asset@0.11.2 -- -Zunstable-options --output-format json
?
hmm, i feel like there's some information missing here, can you post the full log? I'll try this myself later this weekend, is the
project you're compiling from public? I guess maybe I can reproduce it with just a cargo.toml using bevy_asset@0.11.2
Here is the full log: https://gist.github.com/makspll/c3058a54896dd3a8f78b6b654308e9bf
Yes the project is public, the issue and context I am needing this for can be found here: makspll/bevy_mod_scripting#77
oh and also! Generally, cross or really any cross compilation tool, isn't really needed when targeting another target, are you sure it doesn't just work with cargo +nightly-2023-07-16 rustdoc --target=aarch64-unknown-linux-gnu -p bevy_asset@0.11.2 -- -Zunstable-options --output-format json?
The reason I was using cross was because I was getting unexpected output from cargo. Turns out I didn't realise cargo would generate under a new directory in target, specifically target/aarch64-unknown-linux-gnu
which caused me to use the old rustdoc json files and hence wrong output! I just assumed I needed some sort of emulation for this to work. But also I do think I need cross for running anything with a bevy dependency as it has some dependencies:
[target.aarch64-unknown-linux-gnu]
pre-build = [
"dpkg --add-architecture arm64 && apt-get -y update; apt-get -y install libasound2-dev:arm64 libudev-dev:arm64",
]
oh also, please try a cargo clean --target aarch64-unknown-linux-gnu then run the command again, the fact that this produces a ice is interesting though
This solved it! it run the command successfully, and after correcting for the target directory everything worked as expected!
Thanks alot!
awesome, then this is the good old issue #724 but rustdoc throwing an ICE, very nice
Ah I see, strange!