Cannot compile hello word on mac (`ld: unsupported tapi file type '!tapi-tbd'`)

I tried to use rust on a macbook pro (2019) with Catalina (macos 10.15.7) without success:

robinm@MacBook-Pro:~/perso> rustup show
Default host: x86_64-apple-darwin
rustup home:  /Users/robinm/.rustup

stable-x86_64-apple-darwin (default)
rustc 1.48.0 (7eac88abb 2020-11-16)
robinm@MacBook-Pro:~/perso> cargo new x
     Created binary (application) `x` package
robinm@MacBook-Pro:~/perso> cd x
robinm@MacBook-Pro:~/perso/x> cargo run
   Compiling x v0.1.0 (/Users/robinm/perso/x)
error: linking with `cc` failed: exit code: 254
  |
  = note: "cc" "-m64" "-arch" "x86_64" "-L" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/robinm/perso/x/target/debug/deps/x.3qoqm0rjjadn47g3.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.47bfzwwv5r13dyse.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.4af0a4yml1g11ve2.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.502cfa4c9yykc3w0.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.51b85tjwlulsh56n.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.5d66qkflzk15dsbv.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.5f1zxmfzr5bxgvhv.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.5foori7qwcwc82m4.rcgu.o" "-o" "/Users/robinm/perso/x/target/debug/deps/x" "/Users/robinm/perso/x/target/debug/deps/x.3mbbypu23ok1rftx.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/robinm/perso/x/target/debug/deps" "-L" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-688c1376a25c049d.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-078f89c2cdb6d46b.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-fec020208bc1ad3c.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-38540dcacc9fd218.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-6f613179f618c598.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-4d1a5d7118aaeaf2.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-d88fab3b1b9d8356.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-a21754532a052f2f.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-2e9ebc4127641a96.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-82d0f961232a05ca.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-370b1b71f08bac3c.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-816106c1f35f5421.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-20f3a030f1a56a86.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-60333aa00936c5ce.rlib" "/Users/robinm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-116aaeaea873ef94.rlib" "-lSystem" "-lresolv" "-lc" "-lm"
  = note: ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libresolv.tbd' for architecture x86_64
          clang: error: unable to execute command: Bus error: 10
          clang: error: linker command failed due to signal (use -v to see invocation)
          

error: aborting due to previous error

error: could not compile `x`

Caused by:
  process didn't exit successfully: `rustc --crate-name x --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=a2fdc0d262c586b9 --out-dir /Users/robinm/perso/x/target/debug/deps -C incremental=/Users/robinm/perso/x/target/debug/incremental -L dependency=/Users/robinm/perso/x/target/debug/deps` (exit code: 1)

I am very new to the mac world, and much more familiar with Linux. I have xcode 10.1 installed for work, and I do not want to touch it. According to brew, I have llvm 11.0.0 installed. I installed Rust with rustup.

EDIT: adding the output of ld -v since I think it’s the source of the issue. I think my ld is outdated:

ld -v
@(#)PROGRAM:ld  PROJECT:ld64-409.12
BUILD 17:47:51 Sep 25 2018
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em arm64e arm64_32
LTO support using: LLVM version 10.0.0, (clang-1000.11.45.5) (static support for 21, runtime is 21)
TAPI support using: Apple TAPI version 10.0.0 (tapi-1000.11.8.2)

This could be the case. Could you try installing an older version of Rust to see if at least that works? I'm happily using 1.39 (also installed via rustup) with Xcode 9.1 and a reported ld version of ld64-302.3.1.

(You might also get something out of (re-)installing/updating the Xcode Command Line Tools by running xcode-select --install. Frankly, I'm getting tired of trying to understand the logic behind Apple's approach to toolchain management. Basically nothing ever works unless you go through their Magic GUI™.)

Maybe this cargo config helps: https://doc.rust-lang.org/cargo/reference/config.html#targettriplelinker

Try to use the linker of the brew installed LLVM 11.

I tried without success rust-1.39. And in the long run I don’t think it would have been useful since my current project use internals of rustc, and thus nightly. I also tried xcode-select --install without success either. I suspect that not using xcode 11 on Catalina doesn’t make the apple god happy :wink:

I also tried to the llvm linker provided by brew. I don’t understand the syntax to be able to use the environment variable CARGO_TARGET_<tripple>_LINKER. What should be my tripple? (CARGO_TARGET_x86_64-apple-darwin_LINKER=/usr/local/opt/llvm/bin/lld cargo run -v doesn’t work).

If I run cargo run -v, then copy-paste the rustccommand, and add -C linker=/usr/local/opt/llvm/bin/ld.lld` at the end, I get something slightly better.

MacBook-Pro [~/perso/x] > rustc --crate-name x --edition=2018 src/main.rs --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=a2fdc0d262c586b9 --out-dir /Users/robinm/perso/x/target/debug/deps -C incremental=/Users/robinm/perso/x/target/debug/incremental -L dependency=/Users/robinm/perso/x/target/debug/deps -C linker=/usr/local/opt/llvm/bin/ld.lld 
error: linking with `/usr/local/opt/llvm/bin/ld.lld` failed: exit code: 1
  |
  = note: "/usr/local/opt/llvm/bin/ld.lld" "-L" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/robinm/perso/x/target/debug/deps/x.1h8esrx5kscemyim.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.3g111051z4zfxbc1.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.43uxakv4utjt2o9o.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.458rozt7zdebpgdj.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.502cfa4c9yykc3w0.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.566nmklg2cjts2rv.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.5foori7qwcwc82m4.rcgu.o" "/Users/robinm/perso/x/target/debug/deps/x.a0d3zfed3p11w0x.rcgu.o" "-o" "/Users/robinm/perso/x/target/debug/deps/x" "/Users/robinm/perso/x/target/debug/deps/x.3mbbypu23ok1rftx.rcgu.o" "-dead_strip" "-L" "/Users/robinm/perso/x/target/debug/deps" "-L" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-cf45c391193686b0.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-bfb82cdc97bd35ea.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-0e543fa90fe41090.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-f50981f4143e4c69.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-bbe9b2276f9fe948.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-c04e87d408a5de4c.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-3865f13d7ece40bb.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-83f3487f53b2e684.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-518f93c579715cca.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-ab0ea20e972aeb4f.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-50e4694516c58a71.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-8171c7b795c55f62.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-8357f853e5f39333.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-80c77ff1434731cf.rlib" "/Users/robinm/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-8c8eeab435e54e85.rlib" "-lSystem" "-lresolv" "-lc" "-lm"
  = note: ld.lld: error: unknown argument '-dead_strip'
          ld.lld: error: /Users/robinm/perso/x/target/debug/deps/x.1h8esrx5kscemyim.rcgu.o: unknown file type
          ld.lld: error: /Users/robinm/perso/x/target/debug/deps/x.3g111051z4zfxbc1.rcgu.o: unknown file type
          ld.lld: error: /Users/robinm/perso/x/target/debug/deps/x.43uxakv4utjt2o9o.rcgu.o: unknown file type
          ld.lld: error: /Users/robinm/perso/x/target/debug/deps/x.458rozt7zdebpgdj.rcgu.o: unknown file type
          ld.lld: error: /Users/robinm/perso/x/target/debug/deps/x.502cfa4c9yykc3w0.rcgu.o: unknown file type
          ld.lld: error: /Users/robinm/perso/x/target/debug/deps/x.566nmklg2cjts2rv.rcgu.o: unknown file type
          ld.lld: error: /Users/robinm/perso/x/target/debug/deps/x.5foori7qwcwc82m4.rcgu.o: unknown file type
          ld.lld: error: /Users/robinm/perso/x/target/debug/deps/x.a0d3zfed3p11w0x.rcgu.o: unknown file type
          ld.lld: error: /Users/robinm/perso/x/target/debug/deps/x.3mbbypu23ok1rftx.rcgu.o: unknown file type
          ld.lld: error: unable to find library -lSystem
          ld.lld: error: unable to find library -lresolv
          ld.lld: error: unable to find library -lc
          ld.lld: error: unable to find library -lm
          

error: aborting due to previous error

I think it will become uppercase and - replaced by _. So give CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER env var a try.
It is describe here.

And I think it is only compatible with the "cc"-frontend for linking. So maybe clang.

1 Like

Maybe your mac is missing Command Line Tools , this post shows how to install it, see if this helps.

And remember to run cargo clean before you run cargo run or cargo build again, sometimes cargo does not clean old targets and that could fail the new build.

So, I somewhat found a fix, even if I really don’t understand what mac/xcode is doing.

CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=/Applications/Xcode.app/Contents/Developer/usr/bin/ld cargo build

The above line works. So I will just export in into my .tcshrc. Go figure why /usr/bin/ld and /Applications/Xcode.app/Contents/Developer/usr/bin/ld aren’t the same…

Thanks all for trying to help me.

Arf, but obviously it couldn’t be easy for everything.

MacBook-Pro [~/perso/x] > export CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=//Applications/Xcode.app/Contents/Developer/usr/bin/ld
MacBook-Pro [~/perso/x] > cargo install ripgrep --verbose
[ ... cutting the output ]
   Compiling ripgrep v12.1.1
     Running `rustc --edition=2018 --crate-name build_script_build /Users/robinm/.cargo/registry/src/github.com-1ecc6299db9ec823/ripgrep-12.1.1/build.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 -C debuginfo=1 -C metadata=f66345e548bf366a -C extra-filename=-f66345e548bf366a --out-dir /var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/build/ripgrep-f66345e548bf366a -C linker=//Applications/Xcode.app/Contents/Developer/usr/bin/ld -L dependency=/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps --extern clap=/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/libclap-ecbc15c01ac4397f.rlib --extern lazy_static=/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/liblazy_static-1f0dbdb5aa8d8d6a.rlib --cap-lints allow`
     Running `/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/build/ripgrep-f66345e548bf366a/build-script-build`
error: linking with `//Applications/Xcode.app/Contents/Developer/usr/bin/ld` failed: exit code: 1
  |
  = note: "//Applications/Xcode.app/Contents/Developer/usr/bin/ld" "-L" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.0.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.1.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.10.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.11.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.12.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.13.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.14.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.15.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.2.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.3.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.4.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.5.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.6.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.7.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.8.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.serde_derive.8yxwypwi-cgu.9.rcgu.o" "-o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/libserde_derive-2f4cc03339fab7ea.dylib" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.jehd1mmtuoe7lh3.rcgu.o" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/serde_derive-2f4cc03339fab7ea.1zgaerd1fjtllsp2.rcgu.o" "-dead_strip" "-L" "/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps" "-L" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/private/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/libsyn-0fa651d936a62980.rlib" "/private/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/libquote-310b4dc029969bf7.rlib" "/private/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/libproc_macro2-c3dd3f121fcca6a6.rlib" "/private/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/libunicode_xid-07831dbe30a3c810.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libproc_macro-37336ae2f3e08e7e.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-ec578e0d01ad5d6e.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-5412e5af11009a97.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-03db0718fbd4a443.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-8df90fdde44531fa.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libbacktrace-080b75c76cf389d3.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libbacktrace_sys-954947c96c071ed1.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-9a1775bac6aabe20.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-71147793b4cdc412.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-9fc81eecc6136c9a.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-4b64712313317864.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-1bcd644d1289b2fb.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-16c65b3b16ee989d.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-7dd67903be10326a.rlib" "/Users/robinm/.rustup/toolchains/1.39-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-b5923fb6eca9603a.rlib" "-lSystem" "-lresolv" "-lc" "-lm" "-dynamiclib" "-dylib"
  = note: ld: unknown option: -dynamiclib
          

error: aborting due to previous error

error: failed to compile `ripgrep v12.1.1`, intermediate artifacts can be found at `/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW`

Caused by:
  could not compile `serde_derive`.

Caused by:
  process didn't exit successfully: `rustc --crate-name serde_derive /Users/robinm/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_derive-1.0.118/src/lib.rs --color always --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C opt-level=3 -C debuginfo=1 --cfg 'feature="default"' -C metadata=2f4cc03339fab7ea -C extra-filename=-2f4cc03339fab7ea --out-dir /var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps -C linker=//Applications/Xcode.app/Contents/Developer/usr/bin/ld -L dependency=/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps --extern proc_macro2=/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/libproc_macro2-c3dd3f121fcca6a6.rlib --extern quote=/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/libquote-310b4dc029969bf7.rlib --extern syn=/var/folders/y2/dd9110ls0rx6rc92rlh3xsf4000284/T/cargo-installPc1KmW/release/deps/libsyn-0fa651d936a62980.rlib --cap-lints allow --cfg underscore_consts` (exit code: 1)

Is there anything I can do?

For unrelated reason, I updated Xcode from 10.1 to 11.7 (and btw, it’s possible to install both next to each other which was my initial fear). Now it’s perfectly working (and I could remove my tweak for CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER). If this issue arise to anyone else, it’s required to have an xcode compatible with the OS you are using (Xcode 10 was not able to target Catalina).

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.