rust-lang / rustc_codegen_gcc

libgccjit AOT codegen for rustc
Apache License 2.0
906 stars 60 forks source link

Error: could not compile `std` #390

Closed micl2e2 closed 9 months ago

micl2e2 commented 9 months ago

I was following the steps at README, but failed at LIBRARY_PATH=$(cat gcc_path) LD_LIBRARY_PATH=$(cat gcc_path) ./y.sh build --release. With errors below:

RUST_BACKTRACE=full LIBRARY_PATH=$(cat gcc_path) LD_LIBRARY_PATH=$(cat gcc_path) ./y.sh build --release
[BUILD] build system
    Finished release [optimized] target(s) in 0.00s
    Finished release [optimized] target(s) in 0.01s
[BUILD] sysroot
    Updating crates.io index
   Compiling core v0.0.0 (/root/rustc_codegen_gcc/build_sysroot/sysroot_src/library/core)
   Compiling compiler_builtins v0.1.104
   Compiling libc v0.2.150
   Compiling std v0.0.0 (/root/rustc_codegen_gcc/build_sysroot/sysroot_src/library/std)
   Compiling rustc-std-workspace-core v1.99.0 (/root/rustc_codegen_gcc/build_sysroot/sysroot_src/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/root/rustc_codegen_gcc/build_sysroot/sysroot_src/library/alloc)
   Compiling cfg-if v1.0.0
   Compiling unwind v0.0.0 (/root/rustc_codegen_gcc/build_sysroot/sysroot_src/library/unwind)
   Compiling adler v1.0.2
   Compiling memchr v2.6.4
   Compiling rustc-demangle v0.1.23
   Compiling rustc-std-workspace-alloc v1.99.0 (/root/rustc_codegen_gcc/build_sysroot/sysroot_src/library/rustc-std-workspace-alloc)
   Compiling gimli v0.28.1
   Compiling miniz_oxide v0.7.1
   Compiling std_detect v0.1.5 (/root/rustc_codegen_gcc/build_sysroot/sysroot_src/library/stdarch/crates/std_detect)
   Compiling object v0.32.1
   Compiling hashbrown v0.14.3
   Compiling panic_abort v0.0.0 (/root/rustc_codegen_gcc/build_sysroot/sysroot_src/library/panic_abort)
   Compiling panic_unwind v0.0.0 (/root/rustc_codegen_gcc/build_sysroot/sysroot_src/library/panic_unwind)
   Compiling addr2line v0.21.0
thread 'rustc' panicked at src/intrinsic/mod.rs:1050:9:
not implemented
stack backtrace:
   0:     0x7f110ec6389c - std::backtrace_rs::backtrace::libunwind::trace::h9837d8cc7db48e37
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f110ec6389c - std::backtrace_rs::backtrace::trace_unsynchronized::h28a72fb23801ef33
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f110ec6389c - std::sys_common::backtrace::_print_fmt::h6fa72b099b921165
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f110ec6389c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he9138f3b386f9c3b
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f110ecb68a0 - core::fmt::rt::Argument::fmt::ha045b2751e87b9b0
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/core/src/fmt/rt.rs:142:9
   5:     0x7f110ecb68a0 - core::fmt::write::h767ea95c4adc6a9d
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f110ec577bf - std::io::Write::write_fmt::ha8ce928f10051ff5
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/std/src/io/mod.rs:1762:15
   7:     0x7f110ec63684 - std::sys_common::backtrace::_print::ha0c01e411116bddd
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f110ec63684 - std::sys_common::backtrace::print::hca7ff960c782ae41
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f110ec66317 - std::panicking::default_hook::{{closure}}::h454f2e7524e4866d
  10:     0x7f110ec6607f - std::panicking::default_hook::h0b3fc3c0108bf5a8
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/std/src/panicking.rs:292:9
  11:     0x7f11119bdd40 - std[de81cf9dbb691208]::panicking::update_hook::<alloc[a172c493805c4680]::boxed::Box<rustc_driver_impl[29c85b9b2f145ef4]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f110ec66a58 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb65c1f1ed2d0124c
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/alloc/src/boxed.rs:2021:9
  13:     0x7f110ec66a58 - std::panicking::rust_panic_with_hook::hc207a5c828e8a697
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/std/src/panicking.rs:783:13
  14:     0x7f110ec66779 - std::panicking::begin_panic_handler::{{closure}}::hcf03e38cf5c5ecfb
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/std/src/panicking.rs:649:13
  15:     0x7f110ec63d66 - std::sys_common::backtrace::__rust_end_short_backtrace::h8c792587ac872d02
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7f110ec66512 - rust_begin_unwind
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/std/src/panicking.rs:645:5
  17:     0x7f110ecb2f85 - core::panicking::panic_fmt::hb901d5c8b1917c97
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/core/src/panicking.rs:72:14
  18:     0x7f110ecb3023 - core::panicking::panic::h6e69e30894c3317e
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/core/src/panicking.rs:127:5
  19:     0x7f1105463eee - rustc_codegen_gcc::intrinsic::try_intrinsic::hf71f11a51ca04ec9
  20:     0x7f11054cf18c - rustc_codegen_gcc::intrinsic::<impl rustc_codegen_ssa::traits::intrinsic::IntrinsicCallMethods for rustc_codegen_gcc::builder::Builder>::codegen_intrinsic_call::hace3e5fcdb62eb81
  21:     0x7f1105484499 - rustc_codegen_ssa::mir::intrinsic::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_intrinsic_call::h1640f4203cc7a29f
  22:     0x7f1105479d7c - rustc_codegen_ssa::mir::block::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_terminator::h0111450c55afe0a0
  23:     0x7f110547443f - rustc_codegen_ssa::mir::codegen_mir::h9e5edd4efc2d1813
  24:     0x7f110554cf04 - rustc_codegen_ssa::base::codegen_instance::hc9304dd18645c10a
  25:     0x7f110549c5c3 - <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define::h4dc7364d1b6edf62
  26:     0x7f110552cfc5 - rustc_codegen_gcc::base::compile_codegen_unit::module_codegen::h17a66282d7441e6d
  27:     0x7f110552b84e - rustc_codegen_gcc::base::compile_codegen_unit::he95280cff098556b
  28:     0x7f110554c554 - rustc_codegen_ssa::base::codegen_crate::h81591752ab49ac87
  29:     0x7f11054a7f5a - <rustc_codegen_gcc::GccCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h06d57ca21ca6735e
  30:     0x7f111366f959 - rustc_interface[a613985da683c8bc]::passes::start_codegen
  31:     0x7f111366f333 - <rustc_interface[a613985da683c8bc]::queries::Queries>::ongoing_codegen
  32:     0x7f1113c6cb8d - rustc_interface[a613985da683c8bc]::interface::run_compiler::<core[d802bf11ec88483a]::result::Result<(), rustc_span[aece3de8e42f8850]::ErrorGuaranteed>, rustc_driver_impl[29c85b9b2f145ef4]::run_compiler::{closure#1}>::{closure#0}
  33:     0x7f1113c73e5a - std[de81cf9dbb691208]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a613985da683c8bc]::util::run_in_thread_with_globals<rustc_interface[a613985da683c8bc]::util::run_in_thread_pool_with_globals<rustc_interface[a613985da683c8bc]::interface::run_compiler<core[d802bf11ec88483a]::result::Result<(), rustc_span[aece3de8e42f8850]::ErrorGuaranteed>, rustc_driver_impl[29c85b9b2f145ef4]::run_compiler::{closure#1}>::{closure#0}, core[d802bf11ec88483a]::result::Result<(), rustc_span[aece3de8e42f8850]::ErrorGuaranteed>>::{closure#0}, core[d802bf11ec88483a]::result::Result<(), rustc_span[aece3de8e42f8850]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d802bf11ec88483a]::result::Result<(), rustc_span[aece3de8e42f8850]::ErrorGuaranteed>>
  34:     0x7f1113c73c83 - <<std[de81cf9dbb691208]::thread::Builder>::spawn_unchecked_<rustc_interface[a613985da683c8bc]::util::run_in_thread_with_globals<rustc_interface[a613985da683c8bc]::util::run_in_thread_pool_with_globals<rustc_interface[a613985da683c8bc]::interface::run_compiler<core[d802bf11ec88483a]::result::Result<(), rustc_span[aece3de8e42f8850]::ErrorGuaranteed>, rustc_driver_impl[29c85b9b2f145ef4]::run_compiler::{closure#1}>::{closure#0}, core[d802bf11ec88483a]::result::Result<(), rustc_span[aece3de8e42f8850]::ErrorGuaranteed>>::{closure#0}, core[d802bf11ec88483a]::result::Result<(), rustc_span[aece3de8e42f8850]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d802bf11ec88483a]::result::Result<(), rustc_span[aece3de8e42f8850]::ErrorGuaranteed>>::{closure#1} as core[d802bf11ec88483a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35:     0x7f110ec70915 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h52efeac0842d526d
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/alloc/src/boxed.rs:2007:9
  36:     0x7f110ec70915 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb2dec26d0b701166
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/alloc/src/boxed.rs:2007:9
  37:     0x7f110ec70915 - std::sys::unix::thread::Thread::new::thread_start::h0f2ac351d038e158
                               at /rustc/a57770440f1ebe5b992551d3bcc489ae211908d4/library/std/src/sys/unix/thread.rs:108:17
  38:     0x7f110eb7aea7 - start_thread
                               at ./nptl/pthread_create.c:477:8
  39:     0x7f110ea98a2f - clone
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  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: please attach the file at `/root/rustc_codegen_gcc/build_sysroot/rustc-ice-2023-12-02T09_25_25-76740.txt` to your bug report

note: compiler flags: --crate-type dylib --crate-type rlib -C prefer-dynamic -C embed-bitcode=no -C debuginfo=2 -Z unstable-options -C symbol-mangling-version=v0 -C debuginfo=2 -Z codegen-backend=/root/rustc_codegen_gcc/target/release/librustc_codegen_gcc.so -C lto=off -Z mir-opt-level=3

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

query stack during panic:
end of query stack
error: could not compile `std` (lib)
Command failed to run: "Command `cargo build --target x86_64-unknown-linux-gnu` exited with status Some(101)"
antoyo commented 9 months ago

Oh, it seems we forgot to update the readme. You need now to specify this flag: --features master.

cc @GuillaumeGomez

GuillaumeGomez commented 9 months ago

Sending a fix right away.

micl2e2 commented 9 months ago

It seems working now. Thanks!