-
Notifications
You must be signed in to change notification settings - Fork 235
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
Improve support for older macOS versions #314
Improve support for older macOS versions #314
Conversation
Interesting. Well, it seems like the "right way" would be to target macOS 10.11 when you compile in order for the resulting binary to work on macOS 10.11. If you look at the code here, you can see that we use env CFLAGS=-mmacosx-version-min=10.11 cargo build Indeed this probably ought to be the recommended approach if you want to produce a macOS executable that is compatible with versions older than your build system. Unfortunately this doesn't work for me right now because of #279, but you get the idea at least. Not defining Unless we define |
@sagebind I tried it, but it still produces the bad symbol 😢 In my
(The version in the path is like #283 just to make it compile) Running
|
Well the symbol will still be there, but it is a weak symbol in that it will be used only if it is available on the current system. I would try running the binary you produced this way on a macOS 10.11 system. It should acknowledge that |
@ohadravid Can you try swapping this out for |
I did some digging and it looks like While setting an old macOS target version is still the "right way" to guarantee compatability with old versions, its not worth the trouble in this situation when } else {
if target.contains("-apple-") {
- cfg.define("__APPLE__", None).define("macintosh", None);
+ cfg.define("__APPLE__", None)
+ .define("macintosh", None)
+ .define("HAVE_MACH_ABSOLUTE_TIME", None);
+ } else {
+ cfg.define("HAVE_CLOCK_GETTIME_MONOTONIC", None)
+ .define("HAVE_GETTIMEOFDAY", None);
}
cfg.define("RECV_TYPE_ARG1", "int")
- .define("HAVE_CLOCK_GETTIME_MONOTONIC", None)
- .define("HAVE_GETTIMEOFDAY", None)
.define("HAVE_PTHREAD_H", None)
.define("HAVE_ARPA_INET_H", None)
.define("HAVE_ERRNO_H", None) |
…_ABSOLUTE_TIME` instead `clock_gettime` wasn't added until macOS 10.12, which causes `dyld: Symbol not found: _clock_gettime` error
a15236d
to
842e70c
Compare
@sagebind you're totally right about the weak symbol, I didn't know this was a thing and indeed the I applied your suggested fix and I can confirm it runs on my El Capitian test machine! |
👍 |
I tried running a binary built with the
static-curl
feature on macOS El Captian, and got the following error:Apparently
clock_gettime
wasn't added until macOS 10.12.There is a similar issue for
curl
which says to not defineHAVE_CLOCK_GETTIME_MONOTONIC
, so I changed this in thebuild.rs
and everything seems to be working fine.