Closed
Description
A Cargo project with:
fn main() {
panic!("foo");
}
built with:
cargo +nightly build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu
results in a linking failure:
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/home/eric/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/eric/.cargo/bin:/home/eric/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustcFgLEbF/symbols.o" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/z5-76afd39352411349.1zyytfss6ge6z1c2.rcgu.o" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/z5-76afd39352411349.2cgsr7cusby7dzxg.rcgu.o" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/z5-76afd39352411349.2rjthrgaumg840ve.rcgu.o" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/z5-76afd39352411349.32emvdk76bp91vcu.rcgu.o" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/z5-76afd39352411349.3cj49qdg70f0gyk6.rcgu.o" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/z5-76afd39352411349.3p0mbady7r38kwwe.rcgu.o" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/z5-76afd39352411349.3poyfj1g4stxz92z.rcgu.o" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/z5-76afd39352411349.4yr89ousk3c7d2jy.rcgu.o" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/z5-76afd39352411349.50cbq5av1898h8h6.rcgu.o" "-Wl,--as-needed" "-L" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps" "-L" "/home/eric/Temp/z5/target/debug/deps" "-L" "/home/eric/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/libstd-71ebc58fe381d1e2.rlib" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/libpanic_unwind-3df6cc821977c293.rlib" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/librustc_demangle-666a7821c202eadd.rlib" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/libstd_detect-da0d60497b1c7e5c.rlib" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/libhashbrown-59ad5acb3417a67f.rlib" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/librustc_std_workspace_alloc-afb6c9f84f868152.rlib" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/libunwind-e44bde4753f5d656.rlib" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/libcfg_if-947c10ee011f75a2.rlib" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/liblibc-c433df73698cac4e.rlib" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/liballoc-86b4281adfdfc05f.rlib" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/librustc_std_workspace_core-b0197b2ea51ce186.rlib" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/libcore-d4d5a26fa7790993.rlib" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-aa52e866272be7f0.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/eric/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/z5-76afd39352411349" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
= note: /usr/bin/ld: /home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/liballoc-86b4281adfdfc05f.rlib(alloc-86b4281adfdfc05f.alloc.d0a1cb85-cgu.0.rcgu.o): in function `alloc::raw_vec::RawVec<T,A>::into_box':
/home/eric/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec.rs:154: undefined reference to `core::panicking::panic_cannot_unwind'
/usr/bin/ld: /home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/liballoc-86b4281adfdfc05f.rlib(alloc-86b4281adfdfc05f.alloc.d0a1cb85-cgu.1.rcgu.o): in function `core::ptr::drop_in_place<alloc::vec::Vec<u8>>':
/home/eric/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:490: undefined reference to `core::panicking::panic_cannot_unwind'
/usr/bin/ld: /home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/liballoc-86b4281adfdfc05f.rlib(alloc-86b4281adfdfc05f.alloc.d0a1cb85-cgu.11.rcgu.o): in function `<T as alloc::slice::hack::ConvertVec>::to_vec':
/home/eric/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/slice.rs:159: undefined reference to `core::panicking::panic_cannot_unwind'
/usr/bin/ld: /home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/liballoc-86b4281adfdfc05f.rlib(alloc-86b4281adfdfc05f.alloc.d0a1cb85-cgu.2.rcgu.o): in function `alloc::string::String::from_utf8_lossy':
/home/eric/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/string.rs:631: undefined reference to `core::panicking::panic_cannot_unwind'
/usr/bin/ld: /home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/liballoc-86b4281adfdfc05f.rlib(alloc-86b4281adfdfc05f.alloc.d0a1cb85-cgu.4.rcgu.o): in function `alloc::vec::Vec<T,A>::into_boxed_slice':
/home/eric/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:1103: undefined reference to `core::panicking::panic_cannot_unwind'
/usr/bin/ld: /home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/liballoc-86b4281adfdfc05f.rlib(alloc-86b4281adfdfc05f.alloc.d0a1cb85-cgu.7.rcgu.o):/home/eric/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1124: more undefined references to `core::panicking::panic_cannot_unwind' follow
/usr/bin/ld: /home/eric/Temp/z5/target/x86_64-unknown-linux-gnu/debug/deps/z5-76afd39352411349: hidden symbol `_ZN4core9panicking19panic_cannot_unwind17h206df51ed63dec18E' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)
This recently started with #104999. cc @saethlin do you have any insight into this?
Meta
rustc --version --verbose
:
rustc 1.68.0-nightly (3984bc583 2023-01-17)
binary: rustc
commit-hash: 3984bc5833db8bfb0acc522c9775383e4171f3de
commit-date: 2023-01-17
host: x86_64-unknown-linux-gnu
release: 1.68.0-nightly
LLVM version: 15.0.6