Skip to content

rustc panic with -C prefer-dynamic=yes and -C rpath=yes #125785

Closed
@tallinn1960

Description

@tallinn1960

Code

fn main() {
    println!("Hello, World");
}

Meta

rustc --version --verbose:

rustc 1.78.0 (9b00956e5 2024-04-29)
binary: rustc
commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
commit-date: 2024-04-29
host: aarch64-unknown-linux-gnu
release: 1.78.0
LLVM version: 18.1.2

Error output

thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/rpath.rs:88:43:
called `Result::unwrap()` on an `Err` value: Error { kind: InvalidInput, message: "cannot make an empty path absolute" }
stack backtrace:
   0:     0xf3e2f6a94684 - std::backtrace_rs::backtrace::libunwind::trace::h4210404a228eb944
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0xf3e2f6a94684 - std::backtrace_rs::backtrace::trace_unsynchronized::hea2e482630a56378
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0xf3e2f6a94684 - std::sys_common::backtrace::_print_fmt::h326180b7b26e4e21
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:68:5
   3:     0xf3e2f6a94684 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::haee13570c31cb77b
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:44:22
   4:     0xf3e2f6addd98 - core::fmt::rt::Argument::fmt::hee8176c00818b355
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/fmt/rt.rs:142:9
   5:     0xf3e2f6addd98 - core::fmt::write::he0b40f3f74e7e87c
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/fmt/mod.rs:1153:17
   6:     0xf3e2f6a8a390 - std::io::Write::write_fmt::hc8024efb884f388c
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:1843:15
   7:     0xf3e2f6a944d0 - std::sys_common::backtrace::_print::he99739ec6cb2be23
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:47:5
   8:     0xf3e2f6a944d0 - std::sys_common::backtrace::print::hf1431a2be8ae8207
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:34:9
   9:     0xf3e2f6a96f34 - std::panicking::default_hook::{{closure}}::ha26cf0d89fc27676
  10:     0xf3e2f6a96be8 - std::panicking::default_hook::hddcfc2aac016eb46
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:292:9
  11:     0xf3e2f76a8744 - <alloc[ccb988b3005c3588]::boxed::Box<rustc_driver_impl[3fc2c9115806cda5]::install_ice_hook::{closure#0}> as core[85292272d9c1851d]::ops::function::Fn<(&dyn for<'a, 'b> core[85292272d9c1851d]::ops::function::Fn<(&'a core[85292272d9c1851d]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[85292272d9c1851d]::marker::Send + core[85292272d9c1851d]::marker::Sync, &core[85292272d9c1851d]::panic::panic_info::PanicInfo)>>::call
  12:     0xf3e2f6a97594 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hfecde373d761a7ff
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2034:9
  13:     0xf3e2f6a97594 - std::panicking::rust_panic_with_hook::hbd9f5866892982cc
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:783:13
  14:     0xf3e2f6a97318 - std::panicking::begin_panic_handler::{{closure}}::hf930a65f0587fc68
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:657:13
  15:     0xf3e2f6a94b48 - std::sys_common::backtrace::__rust_end_short_backtrace::h8aeef1aadd5204df
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:171:18
  16:     0xf3e2f6a970b0 - rust_begin_unwind
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
  17:     0xf3e2f6a6204c - core::panicking::panic_fmt::h3c23aa0af13818a0
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
  18:     0xf3e2f6a62428 - core::result::unwrap_failed::h96aa0d56e71b0bb4
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/result.rs:1654:5
  19:     0xf3e2fbd9d328 - rustc_codegen_ssa[e0b766259ef00854]::back::rpath::get_rpath_relative_to_output
  20:     0xf3e2fbd89044 - <alloc[ccb988b3005c3588]::vec::Vec<std[87579508558a169c]::ffi::os_str::OsString> as alloc[ccb988b3005c3588]::vec::spec_from_iter::SpecFromIter<std[87579508558a169c]::ffi::os_str::OsString, core[85292272d9c1851d]::iter::adapters::map::Map<core[85292272d9c1851d]::slice::iter::Iter<&std[87579508558a169c]::path::Path>, rustc_codegen_ssa[e0b766259ef00854]::back::rpath::get_rpaths_relative_to_output::{closure#0}>>>::from_iter
  21:     0xf3e2fbd9c944 - rustc_codegen_ssa[e0b766259ef00854]::back::rpath::get_rpath_flags
  22:     0xf3e2fbdb972c - rustc_codegen_ssa[e0b766259ef00854]::back::link::linker_with_args
  23:     0xf3e2fbdb04b0 - rustc_codegen_ssa[e0b766259ef00854]::back::link::link_natively
  24:     0xf3e2fbdaca98 - rustc_codegen_ssa[e0b766259ef00854]::back::link::link_binary
  25:     0xf3e2f79bfcb0 - <rustc_codegen_llvm[43115a8746da5e25]::LlvmCodegenBackend as rustc_codegen_ssa[e0b766259ef00854]::traits::backend::CodegenBackend>::link
  26:     0xf3e2f782f364 - <rustc_interface[85568ebed8d58871]::queries::Linker>::link
  27:     0xf3e2f767c588 - rustc_span[e243d4aacbb1055c]::create_session_globals_then::<core[85292272d9c1851d]::result::Result<(), rustc_span[e243d4aacbb1055c]::ErrorGuaranteed>, rustc_interface[85568ebed8d58871]::interface::run_compiler<core[85292272d9c1851d]::result::Result<(), rustc_span[e243d4aacbb1055c]::ErrorGuaranteed>, rustc_driver_impl[3fc2c9115806cda5]::run_compiler::{closure#0}>::{closure#0}>
  28:     0xf3e2f76c5dcc - std[87579508558a169c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[85568ebed8d58871]::util::run_in_thread_with_globals<rustc_interface[85568ebed8d58871]::interface::run_compiler<core[85292272d9c1851d]::result::Result<(), rustc_span[e243d4aacbb1055c]::ErrorGuaranteed>, rustc_driver_impl[3fc2c9115806cda5]::run_compiler::{closure#0}>::{closure#0}, core[85292272d9c1851d]::result::Result<(), rustc_span[e243d4aacbb1055c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[85292272d9c1851d]::result::Result<(), rustc_span[e243d4aacbb1055c]::ErrorGuaranteed>>
  29:     0xf3e2f7684630 - <<std[87579508558a169c]::thread::Builder>::spawn_unchecked_<rustc_interface[85568ebed8d58871]::util::run_in_thread_with_globals<rustc_interface[85568ebed8d58871]::interface::run_compiler<core[85292272d9c1851d]::result::Result<(), rustc_span[e243d4aacbb1055c]::ErrorGuaranteed>, rustc_driver_impl[3fc2c9115806cda5]::run_compiler::{closure#0}>::{closure#0}, core[85292272d9c1851d]::result::Result<(), rustc_span[e243d4aacbb1055c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[85292272d9c1851d]::result::Result<(), rustc_span[e243d4aacbb1055c]::ErrorGuaranteed>>::{closure#1} as core[85292272d9c1851d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0xf3e2f6aa01e4 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he33e42d7304511c2
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2020:9
  31:     0xf3e2f6aa01e4 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h85d9a8900b736259
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2020:9
  32:     0xf3e2f6aa01e4 - std::sys::pal::unix::thread::Thread::new::thread_start::h05189fd97c8bce01
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys/pal/unix/thread.rs:108:17
  33:     0xf3e2f68dd5c8 - start_thread
                               at ./nptl/pthread_create.c:442:8
  34:     0xf3e2f6945edc - thread_start
                               at ./misc/../sysdeps/unix/sysv/linux/aarch64/clone.S:79
  35:                0x0 - <unknown>

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

Invocation was:

rustc -o hello_world_rs -C prefer_dynamic=yes -C rpath=yes -O hello_world.rs

Platform:
Ubuntu Linux 24.04 ARM64 Parallels VM

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions