-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Description
I did this
Install curl 8.2.0 on OS X 10.8 (or on any Mac OS X or OS X version where curl was compiled with the macOS 10.11 SDK or earlier)
I expected the following
curl compiles but fails to run, for example:
$ curl --version
dyld: lazy symbol binding failed: Symbol not found: _SCDynamicStoreCopyProxies
Referenced from: /opt/local/lib/libcurl.4.dylib
Expected in: flat namespace
dyld: Symbol not found: _SCDynamicStoreCopyProxies
Referenced from: /opt/local/lib/libcurl.4.dylib
Expected in: flat namespace
Trace/BPT trap: 5
This was reported to MacPorts here: https://trac.macports.org/ticket/67803
The problem seems to be that curl always wants to use SCDynamicStoreCopyProxies on macOS, and this is part of the SystemConfiguration framework, and has been ever since Mac OS X 10.1. However, curl only links with that framework when building against the macOS 10.12 SDK or later.
Normally a missing symbol would be a link-time error but by using the flags -Wl,-undefined -Wl,dynamic_lookup you're telling the linker to ignore the problem and that the symbol will exist at runtime. It doesn't, though, because you haven't linked in the framework that has the symbol.
This configure test is faulty:
checking whether to link macOS CoreFoundation and SystemConfiguration framework... no
It is checking whether TARGET_OS_OSX is defined. That define was newly added in the macOS 10.12 SDK.
It looks like an attempt to fix this issue was made in #11417 but it didn't fix it in m4/curl-sysconfig.m4.
TARGET_OS_OSX was introduced to help developers distinguish between macOS and other Darwin-derived operating systems (iOS, tvOS, watchOS). Is that distinction necessary here? If not, you can use TARGET_OS_MAC which encompasses all of them. Another way to identify any Darwin-based Apple OS is to check if both __APPLE__ and __MACH__ are defined.
curl/libcurl version
8.2.0
operating system
Darwin redacted 12.6.0 Darwin Kernel Version 12.6.0: Wed Mar 18 16:23:48 PDT 2015; root:xnu-2050.48.19~1/RELEASE_X86_64 x86_64