rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.29k stars 12.58k forks source link

rustc-1.81.0 fails to build on RPi4 #130830

Closed juanitotc closed 6 days ago

juanitotc commented 1 week ago

Building rustc-1.81.1 natively on an RPi4 using llvm-19.1.0/clang-19.1.0 fails with the error below.

Note that I have tried the various sed commands suggested here also https://linuxfromscratch.org/blfs/view/svn/general/rust.html rustc-ice-2024-09-24T15_55_55-13515.txt

error log attached

Compiling rustc_driver v0.0.0 (/mnt/sda8/usr/src/rustc-1.81.0-src/compiler/rustc_driver)
thread 'coordinator' panicked at /mnt/sda8/usr/src/rustc-1.81.0-src/compiler/rustc_codegen_ssa/src/back/write.rs:1851:6:
failed to spawn work thread: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }
stack backtrace:
   0: 0xb3cdd4f4 - <unknown>
   1: 0xb3d32fd0 - <unknown>
   2: 0xb3cd1b3c - <unknown>
   3: 0xb3cdfe48 - <unknown>
   4: 0xb3cdf954 - <unknown>
   5: 0xb42d2410 - <unknown>
   6: 0xb3ce08e0 - <unknown>
   7: 0xb3ce04d8 - <unknown>
   8: 0xb3cdda58 - <unknown>
   9: 0xb3ce0210 - <unknown>
  10: 0xb3c9d8ac - <unknown>
  11: 0xb3c9ddf4 - <unknown>
  12: 0xb4532bf0 - <unknown>
  13: 0xb4554704 - <unknown>
  14: 0xb45314a8 - <unknown>
  15: 0xb455d74c - <unknown>
  16: 0xb3ceada8 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly

note: please attach the file at `/mnt/sda8/usr/src/rustc-1.81.0-src/rustc-ice-2024-09-24T15_55_55-13515.txt` to your bug report

note: compiler flags: --crate-type dylib -C prefer-dynamic -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C symbol-mangling-version=v0 -Z unstable-options -Z macro-backtrace -C split-debuginfo=off -Z unstable-options -C prefer-dynamic -C link-args=-Wl,-z,origin -C link-args=-Wl,-rpath,$ORIGIN/../lib -Z on-broken-pipe=kill -Z dylib-lto -C lto=thin -C embed-bitcode=yes -Z binary-dep-depinfo -Z tls-model=initial-exec -Z force-unstable-if-unmarked

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread 'rustc' panicked at /mnt/sda8/usr/src/rustc-1.81.0-src/compiler/rustc_codegen_ssa/src/back/write.rs:2057:17:
/mnt/sda8/usr/src/rustc-1.81.0-src/compiler/rustc_codegen_ssa/src/back/write.rs:2057:17: panic during codegen/LLVM phase
stack backtrace:
   0: 0xb3cdd4f4 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h52c1c866acd96aff
   1: 0xb3d32fd0 - core::fmt::write::h7f80af50f38a3dee
   2: 0xb3cd1b3c - std::io::Write::write_fmt::h10855848ecac0779
   3: 0xb3cdfe48 - std::panicking::default_hook::{{closure}}::hfc58ef73967812c9
   4: 0xb3cdf954 - std::panicking::default_hook::h3a9a52905e7ab957
   5: 0xb42d2410 - std[e7e9174aa8ba670]::panicking::update_hook::<alloc[e8c609cc5f254c00]::boxed::Box<rustc_driver_impl[562b67701ea10c0]::install_ice_hook::{closure#0}>>::{closure#0}
   6: 0xb3ce08e0 - std::panicking::rust_panic_with_hook::hab93b7d42225c7a1
   7: 0xb62c8cfc - std[e7e9174aa8ba670]::panicking::begin_panic::<alloc[e8c609cc5f254c00]::string::String>::{closure#0}
   8: 0xb62b3768 - std[e7e9174aa8ba670]::sys::backtrace::__rust_end_short_backtrace::<std[e7e9174aa8ba670]::panicking::begin_panic<alloc[e8c609cc5f254c00]::string::String>::{closure#0}, !>
   9: 0xb4249b94 - std[e7e9174aa8ba670]::panicking::begin_panic::<alloc[e8c609cc5f254c00]::string::String>
  10: 0xb63d4320 - rustc_middle[c8fbeb190ea999c0]::util::bug::opt_span_bug_fmt::<rustc_span[17ed61a65647d497]::span_encoding::Span>::{closure#0}
  11: 0xb6393740 - rustc_middle[c8fbeb190ea999c0]::ty::context::tls::with_opt::<rustc_middle[c8fbeb190ea999c0]::util::bug::opt_span_bug_fmt<rustc_span[17ed61a65647d497]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  12: 0xb6393228 - rustc_middle[c8fbeb190ea999c0]::ty::context::tls::with_context_opt::<rustc_middle[c8fbeb190ea999c0]::ty::context::tls::with_opt<rustc_middle[c8fbeb190ea999c0]::util::bug::opt_span_bug_fmt<rustc_span[17ed61a65647d497]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  13: 0xb424ebc0 - rustc_middle[c8fbeb190ea999c0]::util::bug::bug_fmt
  14: 0xb460b958 - <rustc_codegen_llvm[5ad56a7c54a287c2]::LlvmCodegenBackend as rustc_codegen_ssa[752d090f72c1ed7f]::traits::backend::CodegenBackend>::join_codegen
  15: 0xb44fb014 - <rustc_interface[b5528ac35d256af5]::queries::Linker>::link
  16: 0xb42d68a0 - rustc_interface[b5528ac35d256af5]::interface::run_compiler::<core[4727ee9421bbf378]::result::Result<(), rustc_span[17ed61a65647d497]::ErrorGuaranteed>, rustc_driver_impl[562b67701ea10c0]::run_compiler::{closure#0}>::{closure#1}
  17: 0xb42c3988 - std[e7e9174aa8ba670]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[b5528ac35d256af5]::util::run_in_thread_with_globals<rustc_interface[b5528ac35d256af5]::interface::run_compiler<core[4727ee9421bbf378]::result::Result<(), rustc_span[17ed61a65647d497]::ErrorGuaranteed>, rustc_driver_impl[562b67701ea10c0]::run_compiler::{closure#0}>::{closure#1}, core[4727ee9421bbf378]::result::Result<(), rustc_span[17ed61a65647d497]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4727ee9421bbf378]::result::Result<(), rustc_span[17ed61a65647d497]::ErrorGuaranteed>>
  18: 0xb42d9180 - <<std[e7e9174aa8ba670]::thread::Builder>::spawn_unchecked_<rustc_interface[b5528ac35d256af5]::util::run_in_thread_with_globals<rustc_interface[b5528ac35d256af5]::interface::run_compiler<core[4727ee9421bbf378]::result::Result<(), rustc_span[17ed61a65647d497]::ErrorGuaranteed>, rustc_driver_impl[562b67701ea10c0]::run_compiler::{closure#0}>::{closure#1}, core[4727ee9421bbf378]::result::Result<(), rustc_span[17ed61a65647d497]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4727ee9421bbf378]::result::Result<(), rustc_span[17ed61a65647d497]::ErrorGuaranteed>>::{closure#1} as core[4727ee9421bbf378]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  19: 0xb3ceada8 - std::sys::pal::unix::thread::Thread::new::thread_start::h14bc3b5e7a419823

error: the compiler unexpectedly panicked. this is a bug.

note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly

note: please attach the file at `/mnt/sda8/usr/src/rustc-1.81.0-src/rustc-ice-2024-09-24T15_55_55-13515.txt` to your bug report

note: compiler flags: --crate-type dylib -C prefer-dynamic -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C symbol-mangling-version=v0 -Z unstable-options -Z macro-backtrace -C split-debuginfo=off -Z unstable-options -C prefer-dynamic -C link-args=-Wl,-z,origin -C link-args=-Wl,-rpath,$ORIGIN/../lib -Z on-broken-pipe=kill -Z dylib-lto -C lto=thin -C embed-bitcode=yes -Z binary-dep-depinfo -Z tls-model=initial-exec -Z force-unstable-if-unmarked

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `rustc_driver` (lib)

Meta

rustc --version --verbose:

<version>
Backtrace

``` ```

saethlin commented 6 days ago

As far as I can tell, this is pthread_create returning EAGAIN, which the man page says:

       EAGAIN A  system-imposed  limit on the number of threads was encountered.  There are a number of limits that may trigger
              this error: the RLIMIT_NPROC soft resource limit (set via setrlimit(2)), which limits the number of processes and
              threads for a real user ID, was reached; the kernel's system-wide limit on the number of processes  and  threads,
              /proc/sys/kernel/threads-max, was reached (see proc(5)); or the maximum number of PIDs, /proc/sys/kernel/pid_max,
              was reached (see proc(5)).

What does ulimit -a say on your pi?

saethlin commented 6 days ago

Also, just to make sure, are you aware that we distribute binary artifacts that you can pull down and use instead of bootstrapping your own toolchain?

juanitotc commented 6 days ago

Thanks for the suggestions - ulimit is not available on this distro (provided by bash-completions?).

Anyway, I tried again without doing anything different and rust built without errors - I lost the ssh connection to the RPi4 part way through and had to restart the build, perhaps this helped?