Skip to content

macOS mixed deployment linker warning can be noisy, difficult to manage #156714

Description

@ehuss

When building on nightly, and linking against an external shared library, you can end up with the following warning:

warning: linker stderr: ld: building for macOS-11.0, but linking with dylib '/opt/homebrew/opt/openssl@3/lib/libssl.3.dylib' which was built for newer version 15.0
         ld: building for macOS-11.0, but linking with dylib '/opt/homebrew/opt/openssl@3/lib/libcrypto.3.dylib' which was built for newer version 15.0
  │
  ╰ note: `#[warn(linker_messages)]` on by default

In this particular case, I am linking against OpenSSL from homebrew (which is the default if it is installed and homebrew's pkg-config is in PATH).

I see two sides to this warning:

  • You are legitimately trying to make redistributable executables with a minimum macOS deployment target. In this case, it is useful to know that you have incorrectly mixed versions.
  • You are just using Rust on a mac, and you don't care, or even know what a deployment target is. In this case the warning is noisy and may be confusing.

Part of the problem in dealing with this warning is:

  • You have to know what MACOSX_DEPLOYMENT_TARGET is and how to set it. I suspect the vast majority of mac users do not know. The warning says nothing about it, or give any hint on what to do.
  • Silencing linker_messages on a project basis just for this one warning means you lose out on any other warnings on any other platform that could be useful to know.
  • Setting MACOSX_DEPLOYMENT_TARGET on a project basis is not feasible since there may be developers with different versions, environments, or you don't want to set or change the deployment target when doing a distribution build (versus a local developer build).

I don't know particularly how to fix this in the general case. Forcing users to set MACOSX_DEPLOYMENT_TARGET seems cumbersome.

Meta

rustc --version --verbose:

rustc 1.97.0-nightly (507271bc1 2026-05-17)
binary: rustc
commit-hash: 507271bc119683008ec719ecee48814e8ac86c65
commit-date: 2026-05-17
host: aarch64-apple-darwin
release: 1.97.0-nightly
LLVM version: 22.1.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkersArea: linkers... you gotta love linkersC-bugCategory: This is a bug.L-linker_messagesLint: linker_messagesO-macosOperating system: macOST-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions