Skip to content

Conversation

madsmtm
Copy link
Contributor

@madsmtm madsmtm commented Sep 9, 2025

We previously linked the Clang runtime libclang_rt.osx.a to fix #279.

All current usage of __builtin_available(...) in curl detects for APIs older than macOS 10.12, which is Rust's currently minimum supported version. This means that they are no-ops, and thus no longer emit a symbol that we need to link.

Additionally, Rust's std has recently introduced these symbols in its standard library, see rust-lang/rust#138944. This means that even if curl were to start using __builtin_available with a check for a newer macOS version, it would still successfully link (at least when using Rust 1.91.0 or newer).

Finally, curl has supported the cfg option HAVE_BUILTIN_AVAILABLE for a while now, so if there ever does come a point where this starts having problems again, we can just disable that define.

Motivation: This makes cross-compiling from some other host to macOS slightly easier (since you no longer need to have the clang runtime built and available).

This was fixing alexcrichton#279.

All current usage of __builtin_available(...) in curl detects for APIs
older than macOS 10.12, which is Rust's currently minimum supported
version. This means that they are no-ops, and thus no longer emit a
symbol that we need to link.

Additionally, Rust's `std` has recently introduced these symbols in its
standard library, see rust-lang/rust#138944.
This means that even if curl _were_ to start using __builtin_available
with a check for a newer macOS version, it would still successfully link
(at least when using Rust 1.91.0 or newer).

Finally, curl has supported the cfg option HAVE_BUILTIN_AVAILABLE for a
while now, so if there ever does come a point where this starts having
problems again, we can just disable that define.
Copy link
Owner

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

@alexcrichton alexcrichton merged commit 4591a9a into alexcrichton:main Sep 9, 2025
14 checks passed
@madsmtm madsmtm deleted the remove-libclang_rt.osx.a-workaround branch September 9, 2025 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

macOS link error with static curl — missing ___isOSVersionAtLeast
2 participants