Problem compiling helloworld on macOS big Sur

I'm unable to compile a hello world on macOS big sur. I've uninstalled and reinstalled rustup cargo etc. as well as the Mac developer tools.

cargo build -v Compiling helloww v0.1.0 (/Users/anode/Code/rust_playground/helloww) Running rustc --crate-name helloww --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=3a3a6e1670b57ec2 --out-dir /Users/anode/Code/rust_playground/helloww/target/debug/deps -C incremental=/Users/anode/Code/rust_playground/helloww/target/debug/incremental -L dependency=/Users/anode/Code/rust_playground/helloww/target/debug/deps -Clink-arg=-lstdc++error: linking withcc` failed: exit status: 1
|
= note: "cc" "-m64" "-arch" "x86_64" "-L" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/anode/Code/rust_playground/helloww/target/debug/deps/helloww.helloww.6hwxhsbo-cgu.0.rcgu.o" "/Users/anode/Code/rust_playground/helloww/target/debug/deps/helloww.helloww.6hwxhsbo-cgu.1.rcgu.o" "/Users/anode/Code/rust_playground/helloww/target/debug/deps/helloww.helloww.6hwxhsbo-cgu.2.rcgu.o" "/Users/anode/Code/rust_playground/helloww/target/debug/deps/helloww.helloww.6hwxhsbo-cgu.3.rcgu.o" "/Users/anode/Code/rust_playground/helloww/target/debug/deps/helloww.helloww.6hwxhsbo-cgu.4.rcgu.o" "/Users/anode/Code/rust_playground/helloww/target/debug/deps/helloww.helloww.6hwxhsbo-cgu.5.rcgu.o" "/Users/anode/Code/rust_playground/helloww/target/debug/deps/helloww.helloww.6hwxhsbo-cgu.6.rcgu.o" "/Users/anode/Code/rust_playground/helloww/target/debug/deps/helloww.helloww.6hwxhsbo-cgu.7.rcgu.o" "-o" "/Users/anode/Code/rust_playground/helloww/target/debug/deps/helloww" "/Users/anode/Code/rust_playground/helloww/target/debug/deps/helloww.1acpsu9vi5z2j8xv.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/anode/Code/rust_playground/helloww/target/debug/deps" "-L" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-f4a73f2c70e583e1.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-b41e562edf698ab1.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-2a4df4c2256492de.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-6aebf63c63f128f7.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-91bb9fde6bea50b4.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-0046ab440646372a.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-9ae8cf74422b8f0c.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-cf93ef7a59a8cd79.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-2a57083a9622d5ba.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-81882c7eecd5bf0e.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-01c4d0a0963e224a.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-482192be7675f505.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-5104ab1bec4ed881.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-7b1ea7b508ec1c03.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-a124ffd13a55a195.rlib" "/Users/anode/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-160a7dd17f2dc334.rlib" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-lstdc++"
= note: ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error

error: could not compile helloww

Caused by:
process didn't exit successfully: rustc --crate-name helloww --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=3a3a6e1670b57ec2 --out-dir /Users/anode/Code/rust_playground/helloww/target/debug/deps -C incremental=/Users/anode/Code/rust_playground/helloww/target/debug/incremental -L dependency=/Users/anode/Code/rust_playground/helloww/target/debug/deps -Clink-arg=-lstdc++ (exit status: 1)`

cargo 1.53.0 (4369396ce 2021-04-27)
rustup 1.24.3 (ce5817a94 2021-05-31
rustc 1.53.0 (53cb7b09b 2021-06-17)

I've found numerous issues that look somewhat similar but none of their solutions have helped. If you anyone needs any other information I'm happy to provide it.

I'm dying to get coding on my mac again please help!

That's an odd one. It apparently finds the linker, but not the libraries.

You don't have some toolchain wrappers installed which hijack any of the commands it is trying to run, right?

What does which cc say?

cc -v
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

It seems like everything is here.

which ld
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin//ld

I'm out of ideas.

"You don't have some toolchain wrappers installed which hijack any of the commands it is trying to run, right?"

Do know of anything specifically that I can check for? I don't think so.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.