Skip to content
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

lib curl compiled on OSX 10.13 failed to run on OSX 10.10 #2905

Closed
arun-govindan opened this issue Aug 21, 2018 · 3 comments
Closed

lib curl compiled on OSX 10.13 failed to run on OSX 10.10 #2905

arun-govindan opened this issue Aug 21, 2018 · 3 comments

Comments

@arun-govindan
Copy link

I did this:
I compiled my application with curl (options : ./configure --with-gnutls) on Xcode 9.4. And when I tested the application on Mac OS version yosemite (OS X 10.10) the app crashed with the below output.

Crash report :
Dyld Error Message:
Symbol not found: _clock_gettime
Referenced from: */libcurl.4.dylib (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib

I expected the following:
Application to run normally

curl/libcurl version:
curl-7.40.0

Mac OS version: yosemite (OS X 10.10)

@bagder bagder added the build label Aug 21, 2018
@bagder
Copy link
Member

bagder commented Aug 21, 2018

clock_gettime apparently wasn't added until 10.12. I don't know how this should be fixed properly (googling "clock_gettime macOS" shows this and related issues have bitten many projects but I found no clear solution).

Work-around

After you run configure, but before you invoke 'make', you can edit lib/curl_config.h and make sure HAVE_CLOCK_GETTIME_MONOTONIC is not defined. Then build.

@nickzman
Copy link
Member

I think I know how to fix this. I looked at the time.h header, and noticed that the clock_* functions are all marked for weak-linking as of macOS 10.13.x, so there are two ways we can weak-link the symbol:

  1. Use traditional weak-linking, which means checking to see if the symbol is not equal to null.
  2. Use __builtin_available() to check if the user is using macOS 10.12 or later, or iOS 10.0 or later. We have the HAVE_BUILTIN_AVAILABLE preprocessor macro to check on this.

Method 2 is the method Apple wants developers to use from now on, but as we found out a while ago, it doesn't work with compilers other than Clang.

@arun-govindan
Copy link
Author

arun-govindan commented Sep 5, 2018

I tried the workaround of removing HAVE_CLOCK_GETTIME_MONOTONIC and now the crash is not happening, but however when I tried to access the https url, it failed. It is able to access only http urls.
Can you please let me know why this behavior is occuring.

@bagder bagder closed this as completed in e6ac3ba Feb 14, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants