Skip to content

Failed to build Rust programs on darwin #254104

@jaudiger

Description

@jaudiger

Describe the bug

Since a recent upgrade, cc tool from LLVM suite, fails to build simple program. I cannot even invoke it with a simple command such as: clang --version:

[user@system:~]$ clang --version
mktemp: illegal option -- -
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix

Steps To Reproduce

To reproduce with cargo, but it can be reproduced without it as shown in the description.

  1. cargo init foo
  2. cd foo
  3. cargo build

Expected behavior

The program should build.

Additional context

cargo build   
   Compiling foo v0.1.0 (/Users/jaudiger/Downloads/test/foo)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/jaudiger/development/scripts:/Users/jaudiger/development/scripts/ioterop/alaska:/nix/store/dfgwfxmkvsz4lvnsc1pr5wsrrj1p9p41-devenv-profile/bin:/Users/jaudiger/.config/carapace/bin:/Users/jaudiger/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/etc/profiles/per-user/jaudiger/bin:/run/current-system/sw/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:/Users/jaudiger/Development/git-repositories/jaudiger/iowa-rs/.devenv/state/cargo-install/bin:/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/bin" VSLANG="1033" ZERO_AR_DATE="1" "cc" "-arch" "arm64" "/var/folders/2p/ffp4lc_n1z3b08fcr0c8x0cw0000gn/T/nix-shell.XXXXXX.UmuyNXXk/rustcioDcXQ/symbols.o" "/Users/jaudiger/Downloads/test/foo/target/debug/deps/foo-81ff2ee467938130.1jh3lrjcj17s958y.rcgu.o" "/Users/jaudiger/Downloads/test/foo/target/debug/deps/foo-81ff2ee467938130.2xr33ct7iud5m2gv.rcgu.o" "/Users/jaudiger/Downloads/test/foo/target/debug/deps/foo-81ff2ee467938130.2xyzgcivkf9qkaqv.rcgu.o" "/Users/jaudiger/Downloads/test/foo/target/debug/deps/foo-81ff2ee467938130.3e08yhzy1ox6qalc.rcgu.o" "/Users/jaudiger/Downloads/test/foo/target/debug/deps/foo-81ff2ee467938130.5c1ulshnxmkalya4.rcgu.o" "/Users/jaudiger/Downloads/test/foo/target/debug/deps/foo-81ff2ee467938130.ahmtt8pmg7y1c7o.rcgu.o" "/Users/jaudiger/Downloads/test/foo/target/debug/deps/foo-81ff2ee467938130.2n1nhu2hh32pqpfd.rcgu.o" "-L" "/Users/jaudiger/Downloads/test/foo/target/debug/deps" "-F" "/nix/store/dfgwfxmkvsz4lvnsc1pr5wsrrj1p9p41-devenv-profile/Library/Frameworks" "-L" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libstd-ea564c277a9775e7.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-c304a3a182c52105.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libobject-0da73a32c086f64c.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libmemchr-556ad8b38e2b6326.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-57143c50a93b3a9f.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libgimli-adc2359764c1f3f9.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-2d8358e39b89a642.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libstd_detect-d0d09b18e41baa81.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-39f4403a59eee8ff.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-ecdabbd76e51f43d.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libminiz_oxide-aa17e9989b8bb446.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libadler-f43598e54d974a89.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libunwind-ea359c2001d296ca.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-d6ca6b2b6de59e80.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/liblibc-675c3823e7b08979.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/liballoc-b138f6381e7b42de.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-54a048c441247cd0.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libcore-1dcac5a329c19f30.rlib" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-9a5dde18cc747729.rlib" "-lSystem" "-lc" "-lm" "-L" "/nix/store/vd6jzf0m9kprxyd95lkd2h3gy73sq90a-rustc-1.72.0/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Users/jaudiger/Downloads/test/foo/target/debug/deps/foo-81ff2ee467938130" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: mktemp: illegal option -- -
          usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
                 mktemp [-d] [-q] [-u] -t prefix 
          

error: could not compile `foo` (bin "foo") due to previous error

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"aarch64-darwin"`
 - host os: `Darwin 22.6.0, macOS 13.5.2`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.16.1`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions