-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS link error with static curl — missing ___isOSVersionAtLeast #279
Comments
Thanks for the investigation here! This all definitely makes more sense now with respect to Travis/Azure. I suspect Travis was running on 10.14 which is why we never ran into this, but Azure must be running on 10.13 or prior. The I think there's two possible routes to fix this:
Do you know if it's difficult to fidn |
I don't know much about clang, so I'm just going off what I can see. One option is to run Another option is to compile a simple binary ( Neither option sounds good. It looks like the builtin needs a plist parser, which doesn't seem too pleasant to add. I can confirm that adding |
Heh yeah so I think we should avoid parsing |
On OSX we need to link against the clang runtime, which is hidden in some non-default path. We can get the path from `clang --print-search-dirs`. Kudos to @ehuss for finding that workaround. Fixes alexcrichton#279.
On OSX we need to link against the clang runtime, which is hidden in some non-default path. We can get the path from `clang --print-search-dirs`. Kudos to @ehuss for finding that workaround. Fixes alexcrichton#279.
I'm running into this issue on macOS 10.15, but only when trying to compile for grcov. For me it looks like the same problem as this issue rust-lang/rust#63047. |
On OSX we need to link against the clang runtime, which is hidden in some non-default path. We can get the path from `clang --print-search-dirs`. Kudos to @ehuss for finding that workaround. Fixes alexcrichton#279.
On OSX we need to link against the clang runtime, which is hidden in some non-default path. We can get the path from `clang --print-search-dirs`. Kudos to @ehuss for finding that workaround. Fixes alexcrichton#279.
Linking with the static feature on macOS 10.13 fails with the following error:
The problem is that
rustc
links with the-nodefaultlibs
flag. This preventscc
from linking with/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a
(or whatever version of xcode you have), which is where___isOSVersionAtLeast
is located.This is caused by the use of things like
__builtin_available(macOS 10.13.4, iOS 11, tvOS 11, *)
. Usually clang will statically strip out this builtin, which is why it normally works on 10.14. However, if you are building on an older version, it adds the call to___isOSVersionAtLeast
at runtime. Strangely, using a minor semver version (like10.13.4
instead of10.13
) also prevents it from being determined statically when building on 10.13 (presumably it defaults to--mmacosx-version-min=10.13
which sets the floor to10.13.0
regardless which minor version you are on).Here's a reduced example project that will fail on 10.14 (by testing for 10.15).
foo.zip
Hopefully that's all clear. Unfortunately I don't know how to fix this. Presumably
rustc
uses-nodefaultlibs
for a good reason. It seems unlikely to me, but maybe there is a way to discover the correct location oflibclang_rt.osx.a
and include it in the link list? A more draconian solution would be to unsetHAVE_BUILTIN_AVAILABLE
, but I think that would disable some important features (like TLS 1.3). Perhaps Alex has some clever ideas?The text was updated successfully, but these errors were encountered: