Skip to content

Build failure with "failed to link or copy" on zfs on macOS #13838

Closed

Description

Problem

Trying to build simple hello world fail when on zfs file system on macOS (it is the only problem I have found so far, building C code works and everything else seems to work)

Steps

Running cargo build fails with:

Compiling hello_cargo v0.1.0 (/Volumes/data/devel/misc/hello_cargo)                                                                                                                                   
error: failed to link or copy `/Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03` to `/Volumes/data/devel/misc/hello_cargo/target/debug/hello_cargo`                   │

Caused by:                                                                                                                                                                                             
  Resource temporarily unavailable (os error 35)  

Possible Solution(s)

No response

Notes

$ RUSTC_LOG=debug CARGO_LOG=debug cargo build --verbose
    ... 
┐rustc_trait_selection::traits::fully_normalize 
├─┐rustc_trait_selection::traits::project::normalize_with_depth_to depth=0, value=[]
├─┘
┘
┐rustc_infer::infer::lexical_region_resolve::collect_errors 
┘
INFO rustc_codegen_ssa::base codegen_instance(<fn() as FnOnce<()>>::call_once - shim(fn()))
INFO rustc_codegen_ssa::base codegen_instance(std::ptr::drop_in_place::<{closure@rt::lang_start<()>::{closure#0}}> - shim(None))
INFO rustc_interface::passes Post-codegen
Ty interner             total           ty lt ct all
    Adt               :     56 12.9%,  0.0%   2.3%  0.0%  0.0%
    Array             :     16  3.7%,  0.0%   2.1%  0.0%  0.0%
    Slice             :     14  3.2%,  0.0%   1.4%  0.0%  0.0%
    RawPtr            :     11  2.5%,  0.0%   0.0%  0.0%  0.0%
    Ref               :    124 28.6%,  2.3%  11.1%  0.0%  0.0%
    FnDef             :     39  9.0%,  0.0%   1.4%  0.5%  0.0%
    FnPtr             :      6  1.4%,  0.0%   0.0%  0.0%  0.0%
    Placeholder       :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Coroutine         :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    CoroutineWitness  :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Dynamic           :      9  2.1%,  0.0%   0.0%  0.0%  0.0%
    Closure           :      2  0.5%,  0.0%   0.0%  0.0%  0.0%
    Tuple             :      4  0.9%,  0.0%   0.0%  0.0%  0.0%
    Bound             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Param             :     11  2.5%,  0.0%   0.0%  0.0%  0.0%
    Infer             :    126 29.1%, 23.1%   0.0%  0.0%  0.0%
    Alias             :     13  3.0%,  0.0%   0.0%  0.0%  0.0%
    Foreign           :      2  0.5%,  0.0%   0.0%  0.0%  0.0%
                  total    433        25.4%  18.2%  0.5%  0.0%
GenericArgs interner: #155
Region interner: #565
Const Allocation interner: #23
Layout interner: #46

INFO rustc_codegen_ssa::back::link preparing Executable to "/Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03"
INFO rustc_codegen_ssa::back::link env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET LC_ALL="C" PATH="/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin:/Users/thiblahute/bin:/Users/thiblahute/.nvm/versions/node/v22.0.0/bin:/Users/thiblahute/bin/google-cloud-sdk/bin:/Users/thiblahute/Library/Python/3.9/bin:/Users/thiblahute/bin:/Users/thiblahute/.depot/bin:/Users/thiblahute/.npm-global/bin:/Users/thiblahute/bin/my-devtools:/opt/homebrew/Cellar/m4/1.4.19/bin:/Users/thiblahute/bin:/Users/thiblahute/bin/google-cloud-sdk/bin:/Users/thiblahute/Library/Python/3.9/bin:/Users/thiblahute/bin:/Users/thiblahute/.depot/bin:/Users/thiblahute/.npm-global/bin:/Users/thiblahute/bin/my-devtools:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/go/bin:/usr/local/zfs/bin:/Users/thiblahute/.cargo/bin:/usr/lib/ccache/bin/:/usr/lib/icecream/bin:/Users/thiblahute/.cargo/bin:/Users/thiblahute/bin/git-phab/:/Users/thiblahute/bin/git-bz/:/Users/thiblahute/bin/git-archive-all.sh/:/Users/thiblahute/bin/:/Users/thiblahute/.local/go/bin:/Users/thiblahute/.local/bin:/Users/thiblahute/bin/patman/:/Users/thiblahute/devel/gstreamer/gst-build/meson/:/Users/thiblahute/devel/misc/depot_tools:/home/thiblahute/devel/gstreamer/gst-build/gst-devtools/debug-viewer:/Users/thiblahute/bin/allure/bin:/Users/thiblahute/.poetry/bin:/Users/thiblahute/.local/share/flatpak/exports/bin/:/usr/local/go/bin:/usr/lib/ccache/bin/:/usr/lib/icecream/bin:/Users/thiblahute/.cargo/bin:/Users/thiblahute/bin/git-phab/:/Users/thiblahute/bin/git-bz/:/Users/thiblahute/bin/git-archive-all.sh/:/Users/thiblahute/bin/:/Users/thiblahute/.local/go/bin:/Users/thiblahute/.local/bin:/Users/thiblahute/bin/patman/:/Users/thiblahute/devel/gstreamer/gst-build/meson/:/Users/thiblahute/devel/misc/depot_tools:/home/thiblahute/devel/gstreamer/gst-build/gst-devtools/debug-viewer:/Users/thiblahute/bin/allure/bin:/Users/thiblahute/.poetry/bin:/Users/thiblahute/.local/share/flatpak/exports/bin/:/usr/local/go/bin" VSLANG="1033" ZERO_AR_DATE="1" "cc" "-arch" "arm64" "/var/folders/9w/s7tm2hnn7y7d_jv5q_pn8mkc0000gn/T/rustcs7SIV2/symbols.o" "/Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03.11drbqbabi6r1aby.rcgu.o" "/Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03.33uv80zlv7467gp8.rcgu.o" "/Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03.4k69ddrwc5z0q1d2.rcgu.o" "/Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03.4sxfbg7j9eyn4zya.rcgu.o" "/Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03.4x6hnecg7c2uuy6j.rcgu.o" "/Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03.52txyyh7rnmo5hfp.rcgu.o" "/Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03.23kz3x8k4fjdx1p3.rcgu.o" "-L" "/Volumes/data/devel/misc/hello_cargo/target/debug/deps" "-L" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-b7bbc4a3799f91ec.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-9a832f29e113f2ac.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-187acb73fb221979.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libmemchr-f379d77720ea5d52.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-5f995b6402184362.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-6d4646231255d040.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-ddf92ea3297b7931.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd_detect-4bd9fc9ff7289783.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-bbf01e0821f9af8a.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-df3ad4119d36f143.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libminiz_oxide-3839cef552c2783c.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libadler-130a17e70576817a.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-f7bc4dcd41ebfabc.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-3b8c9f0215d4bce7.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-8e6430dafe1e0d1f.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-9d92a40a452d227c.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-fb23eb00feddf1cb.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-c6577f5d4f5dcd9a.rlib" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-6d556b0e8bf6f23e.rlib" "-lSystem" "-lc" "-lm" "-L" "/Users/thiblahute/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03" "-Wl,-dead_strip" "-nodefaultlibs"
INFO rustc_codegen_ssa::back::link linker stderr:

INFO rustc_codegen_ssa::back::link linker stdout:

   0.185422583s DEBUG cargo_util::paths: set file mtime /Volumes/data/devel/misc/hello_cargo/target/debug/.fingerprint/hello_cargo-b15663378fbcff03/dep-bin-hello_cargo to 1714582167.625250491s
   0.185465792s DEBUG cargo_util::paths: linking /Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03 to /Volumes/data/devel/misc/hello_cargo/target/debug/hello_cargo
   0.185581083s DEBUG cargo_util::paths: link failed Resource temporarily unavailable (os error 35). falling back to fs::copy
   0.185701875s DEBUG cargo::core::compiler::job_queue: end (Unit { pkg: Package { id: PackageId { name: "hello_cargo", version: "0.1.0", source: "/Volumes/data/devel/misc/hello_cargo" }, ..: ".." }, target: TargetInner { name: "hello_cargo", doc: true, ..: with_path("/Volumes/data/devel/misc/hello_cargo/src/main.rs", Edition2021) }, profile: Profile { split_debuginfo: Some("unpacked"), ..: default_dev() }, kind: Host, mode: Build, features: [], artifact: false, artifact_target_for_features: None, is_std: false, dep_hash: 2202906307356721367 }): Err(failed to link or copy `/Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03` to `/Volumes/data/devel/misc/hello_cargo/target/debug/hello_cargo`

Caused by:
    Resource temporarily unavailable (os error 35)

Stack backtrace:
   0: std::backtrace::Backtrace::create
   1: <core::result::Result<(), std::io::error::Error> as anyhow::Context<(), std::io::error::Error>>::with_context::<alloc::string::String, cargo_util::paths::_link_or_copy::{closure#3}>
   2: cargo_util::paths::_link_or_copy
   3: <cargo::core::compiler::link_targets::{closure#1} as core::ops::function::FnOnce<(&cargo::core::compiler::job_queue::job_state::JobState,)>>::call_once::{shim:vtable#0}
   4: <<cargo::core::compiler::job_queue::job::Work>::then::{closure#0} as core::ops::function::FnOnce<(&cargo::core::compiler::job_queue::job_state::JobState,)>>::call_once::{shim:vtable#0}
   5: <<cargo::core::compiler::job_queue::job::Work>::then::{closure#0} as core::ops::function::FnOnce<(&cargo::core::compiler::job_queue::job_state::JobState,)>>::call_once::{shim:vtable#0}
   6: <cargo::core::compiler::job_queue::job::Job>::run
   7: <cargo::core::compiler::job_queue::job_state::JobState>::run_to_finish
   8: std::sys_common::backtrace::__rust_begin_short_backtrace::<<cargo::core::compiler::job_queue::DrainState>::run::{closure#1}, ()>
   9: <<std::thread::Builder>::spawn_unchecked_<<cargo::core::compiler::job_queue::DrainState>::run::{closure#1}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  10: std::sys::pal::unix::thread::Thread::new::thread_start
  11: __pthread_joiner_wake)
   0.185911583s DEBUG cargo: display_error; err=failed to link or copy `/Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03` to `/Volumes/data/devel/misc/hello_cargo/target/debug/hello_cargo`

Caused by:
    Resource temporarily unavailable (os error 35)

Stack backtrace:
   0: std::backtrace::Backtrace::create
   1: <core::result::Result<(), std::io::error::Error> as anyhow::Context<(), std::io::error::Error>>::with_context::<alloc::string::String, cargo_util::paths::_link_or_copy::{closure#3}>
   2: cargo_util::paths::_link_or_copy
   3: <cargo::core::compiler::link_targets::{closure#1} as core::ops::function::FnOnce<(&cargo::core::compiler::job_queue::job_state::JobState,)>>::call_once::{shim:vtable#0}
   4: <<cargo::core::compiler::job_queue::job::Work>::then::{closure#0} as core::ops::function::FnOnce<(&cargo::core::compiler::job_queue::job_state::JobState,)>>::call_once::{shim:vtable#0}
   5: <<cargo::core::compiler::job_queue::job::Work>::then::{closure#0} as core::ops::function::FnOnce<(&cargo::core::compiler::job_queue::job_state::JobState,)>>::call_once::{shim:vtable#0}
   6: <cargo::core::compiler::job_queue::job::Job>::run
   7: <cargo::core::compiler::job_queue::job_state::JobState>::run_to_finish
   8: std::sys_common::backtrace::__rust_begin_short_backtrace::<<cargo::core::compiler::job_queue::DrainState>::run::{closure#1}, ()>
   9: <<std::thread::Builder>::spawn_unchecked_<<cargo::core::compiler::job_queue::DrainState>::run::{closure#1}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  10: std::sys::pal::unix::thread::Thread::new::thread_start
  11: __pthread_joiner_wake
error: failed to link or copy `/Volumes/data/devel/misc/hello_cargo/target/debug/deps/hello_cargo-b15663378fbcff03` to `/Volumes/data/devel/misc/hello_cargo/target/debug/hello_cargo`

Caused by:
  Resource temporarily unavailable (os error 35)
   0.186169792s  INFO cargo::util::rustc: updated rustc info cache
   0.186205875s DEBUG cargo: exit_with_error; err=CliError { error: Some(1 job failed

Stack backtrace:
   0: std::backtrace::Backtrace::create
   1: <anyhow::Error>::new::<cargo::util::errors::AlreadyPrintedError>
   2: <cargo::core::compiler::job_queue::DrainState>::drain_the_queue
   3: std::panicking::try::<core::result::Result<(), anyhow::Error>, core::panic::unwind_safe::AssertUnwindSafe<std::thread::scoped::scope<<cargo::core::compiler::job_queue::JobQueue>::execute::{closure#3}, core::result::Result<(), anyhow::Error>>::{closure#0}>>
   4: std::thread::scoped::scope::<<cargo::core::compiler::job_queue::JobQueue>::execute::{closure#3}, core::result::Result<(), anyhow::Error>>
   5: <cargo::core::compiler::job_queue::JobQueue>::execute
   6: <cargo::core::compiler::context::Context>::compile
   7: cargo::ops::cargo_compile::compile_ws
   8: cargo::ops::cargo_compile::compile
   9: cargo::commands::build::exec
  10: cargo::cli::main
  11: cargo::main
  12: std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  13: std::rt::lang_start::<()>::{closure#0}
  14: std::rt::lang_start_internal
  15: _main), exit_code: 101 }
   0.186262250s DEBUG cargo: display_error; err=1 job failed

Stack backtrace:
   0: std::backtrace::Backtrace::create
   1: <anyhow::Error>::new::<cargo::util::errors::AlreadyPrintedError>
   2: <cargo::core::compiler::job_queue::DrainState>::drain_the_queue
   3: std::panicking::try::<core::result::Result<(), anyhow::Error>, core::panic::unwind_safe::AssertUnwindSafe<std::thread::scoped::scope<<cargo::core::compiler::job_queue::JobQueue>::execute::{closure#3}, core::result::Result<(), anyhow::Error>>::{closure#0}>>
   4: std::thread::scoped::scope::<<cargo::core::compiler::job_queue::JobQueue>::execute::{closure#3}, core::result::Result<(), anyhow::Error>>
   5: <cargo::core::compiler::job_queue::JobQueue>::execute
   6: <cargo::core::compiler::context::Context>::compile
   7: cargo::ops::cargo_compile::compile_ws
   8: cargo::ops::cargo_compile::compile
   9: cargo::commands::build::exec
  10: cargo::cli::main
  11: cargo::main
  12: std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  13: std::rt::lang_start::<()>::{closure#0}
  14: std::rt::lang_start_internal
  15: _main

Version

cargo 1.77.2 (e52e36006 2024-03-26)
release: 1.77.2
commit-hash: e52e360061cacbbeac79f7f1215a7a90b6f08442
commit-date: 2024-03-26
host: aarch64-apple-darwin
libgit2: 1.7.2 (sys:0.18.2 vendored)
libcurl: 8.4.0 (sys:0.4.70+curl-8.5.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Mac OS 14.4.1 [64-bit]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-filesystemArea: issues with filesystemsC-bugCategory: bugO-macosOS: macOSS-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions