Skip to content

Build failure on macOS 10.9 with "dyld: Symbol not found: _linkat" #2036

Closed
@RandomInsano

Description

@RandomInsano

Hitting a build-time error with "dyld: Symbol not found: _linkat" on an old Mac. Rust itself should support back to 10.7 but without the libc crate supporting it, you're only able to do no_std work.

Though, this version of macOS is ancient and really shouldn't be used. This is all just for fun.

Target triple:

$ rustup default
stable-x86_64-apple-darwin (default)

Rust version:

$ rustup --version
rustup 1.23.1 (3df2264a9 2020-11-30)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.49.0 (e1884a8e3 2020-12-29)`

Here's the macOS version:

Darwin edwins-mbp.enet.local 13.4.0 Darwin Kernel Version 13.4.0: Mon Jan 11 18:17:34 PST 2016; root:xnu-2422.115.15~1/RELEASE_X86_64 x86_64

Here's the minimal test and output:

$ cargo new --bin test_libc
     Created binary (application) `test_libc` package
$ cd test_libc/
$ cargo build -v
   Compiling test_libc v0.1.0 (/Users/me/Documents/Code/rust/test_libc)
     Running `rustc --crate-name test_libc --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=83ef5ef9eed072b6 --out-dir /Users/me/Documents/Code/rust/test_libc/target/debug/deps -C incremental=/Users/me/Documents/Code/rust/test_libc/target/debug/incremental -L dependency=/Users/me/Documents/Code/rust/test_libc/target/debug/deps`
dyld: lazy symbol binding failed: Symbol not found: _linkat
  Referenced from: /Users/me/.rustup/toolchains/stable-x86_64-apple-darwin/bin/../lib/libstd-518979da66993550.dylib
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _linkat
  Referenced from: /Users/me/.rustup/toolchains/stable-x86_64-apple-darwin/bin/../lib/libstd-518979da66993550.dylib
  Expected in: /usr/lib/libSystem.B.dylib

error: could not compile `test_libc`

Caused by:
  process didn't exit successfully: `rustc --crate-name test_libc --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=83ef5ef9eed072b6 --out-dir /Users/me/Documents/Code/rust/test_libc/target/debug/deps -C incremental=/Users/me/Documents/Code/rust/test_libc/target/debug/incremental -L dependency=/Users/me/Documents/Code/rust/test_libc/target/debug/deps` (signal: 5, SIGTRAP: trace/breakpoint trap)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions