[ICE]: Encountered errors while formatting message for codegen_ssa_apple_sdk_error_sdk_path
#107370
Closed
3 of 4 tasks
Labels
A-translation
Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic
C-bug
Category: This is a bug.
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
E-mentor
Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
Reproduce
This occurs with binary crate that is able to target macOS and is most visible when cross compiling.
cargo new --bin
is sufficient. The commandcargo rustc --target=x86_64-apple-darwin -- -C linker-flavor=ld64.lld
produces the error on Linux machines, with or without-C linker=/usr/bin/ld64.lld
.Affected release channels
Rust Version
Current error output
Backtrace
Anything else?
I encountered this when cross compiling from Linux to macOS. Setting
$SDKROOT
to some path that does exist but isn't a valid macOS SDK gives the expected linker errors of not-found libraries and undefined symbols.The correct linker errors, which occur with `SDKROOT=/usr` (or any other path that exists)
error: linking with `/usr/bin/ld64.lld` failed: exit status: 1 | = note: "/usr/bin/ld64.lld" "-flavor" "darwin" "-arch" "x86_64" "-platform_version" "macos" "10.7" "10.7" "/tmp/rustcmRdv6R/symbols.o" "/home/qyriad/code/hello/target/x86_64-apple-darwin/debug/deps/hello-7ed2cd3132e5ea0d.26g0geex1k13oru9.rcgu.o" "/home/qyriad/code/hello/target/x86_64-apple-darwin/debug/deps/hello-7ed2cd3132e5ea0d.2kfapquck9om5nbv.rcgu.o" "/home/qyriad/code/hello/target/x86_64-apple-darwin/debug/deps/hello-7ed2cd3132e5ea0d.2t3gdrcxwz5f2emf.rcgu.o" "/home/qyriad/code/hello/target/x86_64-apple-darwin/debug/deps/hello-7ed2cd3132e5ea0d.3lx1xqdx4bz34wy1.rcgu.o" "/home/qyriad/code/hello/target/x86_64-apple-darwin/debug/deps/hello-7ed2cd3132e5ea0d.3zkhvxoukuri2hzc.rcgu.o" "/home/qyriad/code/hello/target/x86_64-apple-darwin/debug/deps/hello-7ed2cd3132e5ea0d.czomv88vqwv63hy.rcgu.o" "/home/qyriad/code/hello/target/x86_64-apple-darwin/debug/deps/hello-7ed2cd3132e5ea0d.4xpuzhu0nabigv2g.rcgu.o" "-L" "/home/qyriad/code/hello/target/x86_64-apple-darwin/debug/deps" "-L" "/home/qyriad/code/hello/target/debug/deps" "-L" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libstd-c84f81b3d1a36b6e.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-5398d4db8ed2ff6f.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libobject-478a76a3581fca81.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-6876f637b366443d.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-539c7e906abde336.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libgimli-83399a3f8aaf8f32.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-ffb3dc98877a45b4.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-067f58df60a72a89.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-faef232906858087.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libminiz_oxide-4f1ed014f3c75703.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libadler-749b556aef66aa6c.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-0b3b0361e5f0a714.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libunwind-72e9a1e277d7769c.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-357e8106cf3b63d5.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/liblibc-90980575ee007a80.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/liballoc-b73946858ff9839c.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-6dd5c0cef5b5f8b3.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libcore-7d2b712101daf86c.rlib" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-9b0bf4523e9805e9.rlib" "-lSystem" "-lc" "-lm" "-syslibroot" "/usr" "-L" "/home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/home/qyriad/code/hello/target/x86_64-apple-darwin/debug/deps/hello-7ed2cd3132e5ea0d" "-dead_strip" = note: ld64.lld: error: library not found for -lSystem ld64.lld: error: library not found for -lc ld64.lld: error: library not found for -lm ld64.lld: error: undefined symbol: __Unwind_Resume >>> referenced by function.rs:507 (/rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/ops/function.rs:507) >>> /home/qyriad/code/hello/target/x86_64-apple-darwin/debug/deps/hello-7ed2cd3132e5ea0d.2t3gdrcxwz5f2emf.rcgu.o:(symbol __ZN4core3ops8function6FnOnce9call_once17hf4bc1fd436eb6a1eE+0x1f) >>> referenced by function.rs:507 (library/core/src/ops/function.rs:507) >>> /home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libstd-c84f81b3d1a36b6e.rlib(std-c84f81b3d1a36b6e.std.0959ce86-cgu.0.rcgu.o):(symbol __ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hb84e30cb55012ce5E+0x80) >>> referenced by mod.rs:490 (library/core/src/ptr/mod.rs:490) >>> /home/qyriad/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libstd-c84f81b3d1a36b6e.rlib(std-c84f81b3d1a36b6e.std.0959ce86-cgu.0.rcgu.o):(symbol __ZN4core3ptr104drop_in_place$LT$alloc..vec..Vec$LT$$LP$usize$C$std..backtrace_rs..symbolize..gimli..Mapping$RP$$GT$$GT$17hed3f267c6b45955bE+0xd1) >>> referenced 89 more timesOn Rust 1.66.0, it simply emits the (non-internal) error:
error: failed to get macosx SDK path: No such file or directory (os error 2)
, which makes sense.I imagine this would also happen on non-cross builds targeting macOS if
xcrun
isn't available and$SDKROOT
isn't set.The text was updated successfully, but these errors were encountered: