Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with multiple large include_bytes! uses. #103979

Closed
novafacing opened this issue Nov 4, 2022 · 3 comments
Closed

Error with multiple large include_bytes! uses. #103979

novafacing opened this issue Nov 4, 2022 · 3 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@novafacing
Copy link
Contributor

Code

My code is here. The error happens when just compiling the cloned repo with cargo build, and I'm not sure how to minimize it since the error comes from include_bytes!. Repro may need an apt-get build-dep qemu && python3 -m pip install meson ninja before it will compile to the point of the crash.

Meta

rustc --version --verbose:

rustc 1.65.0 (897e37553 2022-11-02)
binary: rustc
commit-hash: 897e37553bba8b42751c67658967889d11ecd120
commit-date: 2022-11-02
host: x86_64-unknown-linux-gnu
release: 1.65.0
LLVM version: 15.0.0

Error output

<output>
Backtrace

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: TryFromIntError(())', compiler/rustc_metadata/src/rmeta/table.rs:234:49
stack backtrace:
   0:     0x7f3500f6dd40 - std::backtrace_rs::backtrace::libunwind::trace::h32eb3e08e874dd27
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f3500f6dd40 - std::backtrace_rs::backtrace::trace_unsynchronized::haa3f451d27bc11a5
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3500f6dd40 - std::sys_common::backtrace::_print_fmt::h5b94a01bb4289bb5
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f3500f6dd40 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb070b7fa7e3175df
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f3500fc8bfe - core::fmt::write::hd5207aebbb9a86e9
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/fmt/mod.rs:1202:17
   5:     0x7f3500f5e935 - std::io::Write::write_fmt::h3bd699bbd129ab8a
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/io/mod.rs:1679:15
   6:     0x7f3500f709f3 - std::sys_common::backtrace::_print::h7a21be552fdf58da
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f3500f709f3 - std::sys_common::backtrace::print::ha85c41fe4dd80b13
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f3500f709f3 - std::panicking::default_hook::{{closure}}::h04cca40023d0eeca
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:295:22
   9:     0x7f3500f706df - std::panicking::default_hook::haa3ca8c310ed5402
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:314:9
  10:     0x7f350379e2e1 - rustc_driver[cfb34b1539811fe8]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f3500f7122d - std::panicking::rust_panic_with_hook::h7b190ce1a948faac
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:702:17
  12:     0x7f3500f71087 - std::panicking::begin_panic_handler::{{closure}}::hbafbfdc3e1b97f68
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:588:13
  13:     0x7f3500f6e1ec - std::sys_common::backtrace::__rust_end_short_backtrace::hda93e5fef243b4c0
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f3500f70da2 - rust_begin_unwind
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:584:5
  15:     0x7f3500fc57d3 - core::panicking::panic_fmt::h8d17ca1073d9a733
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:142:14
  16:     0x7f3500fc5b53 - core::result::unwrap_failed::hfaddf24b248137d3
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/result.rs:1785:5
  17:     0x7f3502b2e963 - <rustc_metadata[d8be3da67d4a4339]::rmeta::encoder::EncodeContext>::encode_crate_root
  18:     0x7f35026bac42 - rustc_metadata[d8be3da67d4a4339]::rmeta::encoder::encode_metadata_impl
  19:     0x7f350269d64e - rustc_data_structures[62ce3989ce8140ee]::sync::join::<rustc_metadata[d8be3da67d4a4339]::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata[d8be3da67d4a4339]::rmeta::encoder::encode_metadata::{closure#1}, (), ()>
  20:     0x7f350269d539 - rustc_metadata[d8be3da67d4a4339]::rmeta::encoder::encode_metadata
  21:     0x7f350269c623 - rustc_metadata[d8be3da67d4a4339]::fs::encode_and_write_metadata
  22:     0x7f3502690342 - <rustc_interface[3182dd864eff9d7d]::passes::QueryContext>::enter::<<rustc_interface[3182dd864eff9d7d]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[8c92e53db3fc2eaa]::result::Result<alloc[188ed69dc0d14b4b]::boxed::Box<dyn core[8c92e53db3fc2eaa]::any::Any>, rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>
  23:     0x7f350264fe73 - <rustc_interface[3182dd864eff9d7d]::queries::Queries>::ongoing_codegen
  24:     0x7f350264e2ca - rustc_interface[3182dd864eff9d7d]::interface::create_compiler_and_run::<core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>, rustc_driver[cfb34b1539811fe8]::run_compiler::{closure#1}>
  25:     0x7f350264cac1 - <scoped_tls[e395fa6e23b19669]::ScopedKey<rustc_span[8f00505efff112e2]::SessionGlobals>>::set::<rustc_interface[3182dd864eff9d7d]::interface::run_compiler<core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>, rustc_driver[cfb34b1539811fe8]::run_compiler::{closure#1}>::{closure#0}, core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>
  26:     0x7f350264c7af - std[71cb4861428b0c25]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3182dd864eff9d7d]::util::run_in_thread_pool_with_globals<rustc_interface[3182dd864eff9d7d]::interface::run_compiler<core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>, rustc_driver[cfb34b1539811fe8]::run_compiler::{closure#1}>::{closure#0}, core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>::{closure#0}, core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>
  27:     0x7f3503601d70 - <<std[71cb4861428b0c25]::thread::Builder>::spawn_unchecked_<rustc_interface[3182dd864eff9d7d]::util::run_in_thread_pool_with_globals<rustc_interface[3182dd864eff9d7d]::interface::run_compiler<core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>, rustc_driver[cfb34b1539811fe8]::run_compiler::{closure#1}>::{closure#0}, core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>::{closure#0}, core[8c92e53db3fc2eaa]::result::Result<(), rustc_errors[f77a66b68db622d5]::ErrorGuaranteed>>::{closure#1} as core[8c92e53db3fc2eaa]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  28:     0x7f3500f7b003 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h49f797984e2121bf
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/alloc/src/boxed.rs:1940:9
  29:     0x7f3500f7b003 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfa4f3d0ee6440e0b
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/alloc/src/boxed.rs:1940:9
  30:     0x7f3500f7b003 - std::sys::unix::thread::Thread::new::thread_start::h62ca48b42d48a8fc
                               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys/unix/thread.rs:108:17
  31:     0x7f3500d2b5b5 - start_thread
  32:     0x7f3500dacd50 - __clone3
  33:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: 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.65.0 (897e37553 2022-11-02) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
end of query stack
error: could not compile `qemu`

@novafacing novafacing added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 4, 2022
@novafacing
Copy link
Contributor Author

Tagging on to this, I don't get a compile error for the following but if I uncomment the last constant initializer it does crash!

#[cfg(feature = "aarch64-softmmu")]
pub const QEMU_SYSTEM_AARCH64: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-aarch64"
));

#[cfg(feature = "alpha-softmmu")]
pub const QEMU_SYSTEM_ALPHA: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-alpha"
));

#[cfg(feature = "arm-softmmu")]
pub const QEMU_SYSTEM_ARM: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-arm"
));

#[cfg(feature = "avr-softmmu")]
pub const QEMU_SYSTEM_AVR: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-avr"
));

#[cfg(feature = "cris-softmmu")]
pub const QEMU_SYSTEM_CRIS: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-cris"
));

#[cfg(feature = "hppa-softmmu")]
pub const QEMU_SYSTEM_HPPA: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-hppa"
));

#[cfg(feature = "i386-softmmu")]
pub const QEMU_SYSTEM_I386: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-i386"
));

#[cfg(feature = "loongarch64-softmmu")]
pub const QEMU_SYSTEM_LOONGARCH64: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-loongarch64"
));

#[cfg(feature = "m68k-softmmu")]
pub const QEMU_SYSTEM_M68K: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-m68k"
));

#[cfg(feature = "microblazeel-softmmu")]
pub const QEMU_SYSTEM_MICROBLAZEEL: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-microblazeel"
));

#[cfg(feature = "microblaze-softmmu")]
pub const QEMU_SYSTEM_MICROBLAZE: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-microblaze"
));

#[cfg(feature = "mips64el-softmmu")]
pub const QEMU_SYSTEM_MIPS64EL: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-mips64el"
));

#[cfg(feature = "mips64-softmmu")]
pub const QEMU_SYSTEM_MIPS64: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-mips64"
));

#[cfg(feature = "mipsel-softmmu")]
pub const QEMU_SYSTEM_MIPSEL: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-mipsel"
));

#[cfg(feature = "mips-softmmu")]
pub const QEMU_SYSTEM_MIPS: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-mips"
));

#[cfg(feature = "nios2-softmmu")]
pub const QEMU_SYSTEM_NIOS2: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-nios2"
));

#[cfg(feature = "or1k-softmmu")]
pub const QEMU_SYSTEM_OR1K: &[u8] = include_bytes!(concat!(
    env!("OUT_DIR"),
    "/install",
    "/bin",
    "/qemu-system-or1k"
));

// #[cfg(feature = "ppc64-softmmu")]
// pub const QEMU_SYSTEM_PPC64: &[u8] = include_bytes!(concat!(
//     env!("OUT_DIR"),
//     "/install",
//     "/bin",
//     "/qemu-system-ppc64"
// ));

@est31
Copy link
Member

est31 commented Nov 4, 2022

This will likely be fixed by #103812 . cc also #65818 .

@novafacing
Copy link
Contributor Author

Looks like #103812 will solve this, so I'll declutter and close this issue. Turned on notifications for that PR and I'll reopen after it is merged if this is in fact a separate bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants