Cc linkage error

Hi. I've tried xcode reinstalling, downgrading mac sdk to try and fix this cc linkage issue among other solutions online but none seem to work.

error: linking with cc failed: exit status: 1
|
= note: "cc" "/Users/User/Documents/prog/rust_test/target/debug/deps/rustcEkamEK/symbols.o" "<34 object files omitted>" "/lib/rustlib/aarch64-apple-darwin/lib/{libtest-,libgetopts-,librustc_std_workspace_std-,libstd-,libpanic_unwind-,libobject-,libmemchr-,libaddr2line-,libgimli-,libcfg_if-,librustc_demangle-,libstd_detect-,libhashbrown-,librustc_std_workspace_alloc-,libminiz_oxide-,libadler2-,libunwind-,liblibc-,librustc_std_workspace_core-,liballoc-,libcore-,libcompiler_builtins-}.rlib" "-lSystem" "-lc" "-lm" "-arch" "arm64" "-mmacosx-version-min=11.0.0" "-o" "/Users/User/Documents/prog/rust_test/target/debug/deps/rust_test-d2389b80627dc9a9" "-Wl,-dead_strip" "-nodefaultlibs"
= note: some arguments are omitted. use --verbose to show all linker arguments
= note: ld: multiple errors: tapi error: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX27.0.sdk/usr/lib/libSystem.B.tbd:4:20: error: unknown architecture
arm64e.x1-macos, arm64e.x1-maccatalyst ]
^~~~~~~~~~~~~~~
in '/Library/Developer/CommandLineTools/SDKs/MacOSX27.0.sdk/usr/lib/libm.tbd'; tapi error: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX27.0.sdk/usr/lib/libSystem.B.tbd:4:20: error: unknown architecture
arm64e.x1-macos, arm64e.x1-maccatalyst ]
^~~~~~~~~~~~~~~
in '/Library/Developer/CommandLineTools/SDKs/MacOSX27.0.sdk/usr/lib/libSystem.tbd'; tapi error: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX27.0.sdk/usr/lib/libSystem.B.tbd:4:20: error: unknown architecture
arm64e.x1-macos, arm64e.x1-maccatalyst ]
^~~~~~~~~~~~~~~
in '/Library/Developer/CommandLineTools/SDKs/MacOSX27.0.sdk/usr/lib/libc.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: could not compile rust_test (bin "rust_test" test) due to 1 previous error

Has anyone seen this before?

this error seems to indicate the linker didn't recognize the architecture arm64e.x1-macos, arm64e.x1-maccatalyst.

Apple’s tools and SDKs are locked in version. When the SDK ships new architectures that the older ld doesn’t know about, you get the “malformed file / unknown architecture” error.

what exactly have you tried to solve it?

I'm not on mac, but a quick search found some discussions for other languages. for example, did you try the instructions in this discussion, which is for javscript/typescript:

and here's another one for haskell:

Hi,
It seems to have resolved itself. I'm unsure if it's a combination of solutions, but the last solution I tried was downgrading my SDK compiler to an older version that recognizes arm64e.x1-macros. I don't remember the exact lines of code I pasted into the terminal, but that seemed to be the solution. It was kind of through some trial and error.