Newbie Rust issue: Link error in hello world

Hi, I am anewbie to rust. I installed a couple of weeks ago. I did a few examples and totorials. No problems. Then today I started a new project:
cargo new hw
cd hw
cargo build

I get link errors:
Compiling emit v0.1.0 (/Users/davidtilley/dev/rust/emit)
error : linking with cc failed: exit status: 1

I banged my head for quite a while then uninstalled rust and reinstalled rust
same result. I go to one of my earlier projects and in compiles and runs.

Thoughts?

Is there any other output emitted?

Compiling emit v0.1.0 (/Users/davidtilley/dev/rust/emit)

error : linking with cc failed: exit status: 1

|

= note : "cc" "-m64" "-arch" "x86_64" "/Users/davidtilley/dev/rust/emit/target/debug/deps/emit.184q219ef3oa2xul.rcgu.o" "/Users/davidtilley/dev/rust/emit/target/debug/deps/emit.2a8hnrku1qej3qsk.rcgu.o" "/Users/davidtilley/dev/rust/emit/target/debug/deps/emit.2bqcwqr0q1i3jvu5.rcgu.o" "/Users/davidtilley/dev/rust/emit/target/debug/deps/emit.2k2bb08vpvu6c4ck.rcgu.o" "/Users/davidtilley/dev/rust/emit/target/debug/deps/emit.3ah484dxf3y6ol4y.rcgu.o" "/Users/davidtilley/dev/rust/emit/target/debug/deps/emit.50zwe8x2qw5x8mee.rcgu.o" "/Users/davidtilley/dev/rust/emit/target/debug/deps/emit.552nmficvo01rxdb.rcgu.o" "/Users/davidtilley/dev/rust/emit/target/debug/deps/emit.v67w6q7i537qh9b.rcgu.o" "/Users/davidtilley/dev/rust/emit/target/debug/deps/emit.guiw2k06ljr6ys7.rcgu.o" "-L" "/Users/davidtilley/dev/rust/emit/target/debug/deps" "-L" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-7b3af7e771532c4d.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-a312a9d36c2b4585.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-0056ecd921542c45.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-136473faa654159d.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-8948906b8f5e65a2.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-349769333cecb33c.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-2836451a12f8e8a3.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-82701dea42c34fd2.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-b9c0c998e7e580c1.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-b80d5b40251f2607.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-48a685da8003dd08.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-6c310d5e4d35fd71.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-49c2386372f9dd61.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-e7ab9cb891a80b09.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-f2fbb54bfcfb6a1f.rlib" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-7f68ec848bc59e6b.rlib" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/davidtilley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Users/davidtilley/dev/rust/emit/target/debug/deps/emit" "-Wl,-dead_strip" "-nodefaultlibs"

= note : xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

error : aborting due to previous error

error : could not compile emit

This is on a mac os

You may need to reinstall or reconfigure the Xcode build tools. Try this command:

xcode-select --install

or this command:

sudo xcode-select --reset

Yep! That worked. So thanks. Still don't know why that was required.

This is the relevant line:

= note : xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

According to this StackOverflow answer, the issue seems to be:

The problem is that one needs to explicitly agree to the license agreement.

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.