Linker problems w/ nightly on macos


#1

I’ve been having some trouble running nightly versions of the compiler lately, and I’m not sure if it was a MacOs update or a rustc update that broke things. This fails for me on even trivial binaries, but I don’t think I have any trouble with libraries? (Except that I can’t test them, of course.)

error: could not exec the linker `cc`
  |
  = note: Not a directory (os error 20)
  = note: "cc" "-m64" "-L" "/Users/skyschermer/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/skyschermer/Documents/development/repo/talc-rs/target/debug/build/num-traits-389b49992f871ef8/build_script_build-389b49992f871ef8.build_script_build.bw65jw3y-cgu.0.rcgu.o" "-o" "/Users/skyschermer/Documents/development/repo/talc-rs/target/debug/build/num-traits-389b49992f871ef8/build_script_build-389b49992f871ef8" "/Users/skyschermer/Documents/development/repo/talc-rs/target/debug/build/num-traits-389b49992f871ef8/build_script_build-389b49992f871ef8.3s03wxxqsynkyahb.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/skyschermer/Documents/development/repo/talc-rs/target/debug/deps" "-L" "/Users/skyschermer/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/skyschermer/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-9e5a69db4dc01737.rlib" "/Users/skyschermer/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-5a2cb5c752e3ae9c.rlib" "/Users/skyschermer/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-88ee0f866cc5107b.rlib" "/Users/skyschermer/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_system-418f733d0e05a87c.rlib" "/Users/skyschermer/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-faa0a0baebb4269f.rlib" "/Users/skyschermer/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-c18bb86c34490d18.rlib" "/Users/skyschermer/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-291d1e3476ad529e.rlib" "/Users/skyschermer/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-d676450268a06e1b.rlib" "-lSystem" "-lresolv" "-lc" "-lm"

Frustratingly, it doesn’t tell me what isn’t a directory or what should be a directory, and that’s just a whole load of crap wrt decent error reporting.

This is on High Sierra 13.16.3:

§ cc --version
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Anyway, has anybody got an idea for me? I don’t even know if this is the right cc.


#2

I’m seeing the same on Mojave with nightly-2018-11-10. Downgrading doesn’t seem to help.

Strangely enough, manually running the ostensibly failing cc command succeeds for me. I don’t seem to have any aliases installed for it in my shell either. I’m not sure how to find how which directory is missing for this to succeed when cargo invokes it.

Correction: I didn’t downgrade far enough. Pre-1.32 still seems to work, including nightly-2018-10-29-x86_64-apple-darwin.


#3

Using dtruss I can see the command searching for rust-toolchain somewhere, but that’s not in my path…

Anyway, I did manage to solve this problem by completely uninstalling rust via homebrew and rustup, then reinstalling nightly with rustup. Not sure what actually broke, but maybe this will help someone else…