-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
dyld: lazy symbol binding failed: Symbol not found: _SCDynamicStoreCopyProxies #11502
Comments
|
If the macOS distinction is important—if you need this code to happen on macOS but not iOS/tvOS/watchOS—a condition that was used in harfbuzz for that purpose was: #if TARGET_OS_MAC && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
The now-not-particularly-accurately-named |
We want it to work as widely as possible. But I don't know what that requires. |
The question is what was the intent of #7121: to use it on any Darwin OS or only on macOS? It says:
but looking at the code it is actually defined on all Apple platforms: Lines 258 to 260 in 57f56cc
It also says:
I
But this Stack Overflow post shows someone encountering these errors:
with someone responding:
|
I'm not sure that's terribly important. The intent of that PR was to fix the problem of the author, which I believe it did. That seems have been to make libcurl to behave better on macOS. Does this logic also apply to other apple operating systems and versions or is it perhaps restricted to a subset? And if so, can the change be improved? If so, I hope someone offers a PR that does it. The intent of the PR from two years ago is no longer that interesting. |
I tried a build for iOS after changing the conditions from
That confirms for me that this should really only be used on macOS, not other Darwin OS derivatives, and I'll prepare a PR to fix it so it'll work on older SDKs. |
I haven't decided yet what conditional to use to identify macOS. Elsewhere in curl this conditional is used: Line 70 in 3c0a910
However Apple now says The conditional to identify macOS is currently repeated in four files. The breakage in 8.2.0 was caused by making a change to the conditional in only three out of the four files. Would it be better to define that conditional in fewer files so that it's less likely to go out of sync? I was thinking of defining it only here: Line 33 in 3c0a910
however it would need to be duplicated in the CMake build system too. But then the configure script or CMake could define a macro in curl_config.h which the rest of the .c and .h files could use. If this is a good idea, what would be a good macro name? Are there other existing curl macros for identifying other operating systems? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I still think reducing the number of places the same conditional is repeated would be a good idea but for now I've submitted a PR that just fixes the conditionals. I'll attempt to reproduce the PHP FPM problem and will file a separate issue if I find anything. |
As feared, this change will make it a tad hairier to avoid including this code. Still, compiling with |
@fds242 if you can provide evidence of problems with this function call, preferably in a way to reproduce the issue, then we could work on fixing the root cause instead of you trying to disable parts of libcurl that is not written to be disabled easily. That would be great! |
@badger It is inherent incompatibility that logically cannot be fixed, only disabled or removed. Assuming we accept as noted in #11254 that this function should not be called in a fork. (I have not personally found Apple documentation to this effect on this specific call.) PHP-FPM is a classic single-threaded Unix server that creates worker forks of itself, as configured, to carry out the work. By the time a worker fork loads the PHP curl shared extension, and hence any libcurl code has a chance to run, it is already inside a fork. Whether documented or not, this sure causes severe issues, unrelated PHP extensions suddenly now causing the worker fork to unceremoniously crash with no error message, just because a libcurl that included this call was also loaded. Only workarounds I could imagine are outside of curl, But, again, it continues to make no sense to me for libcurl to even attempt make this call. Even if you disregard the terrible crashes it causes, it's quite akin to how libcurl would never make a In the end I'm satisfied I could continue building libcurl without it, I was just hoping for the change to be more like … ah, I see changes are actively being made, and looking much closer to how I hoped it would be on making my first comments. If the define to CURL_OSX_CALL_COPYPROXIES could be wrapped in an ifndef check, it would be perfection.
Then you could very easily |
I'm not satisfied with that. |
@fds242 I've attempted to use PHP FPM with the curl and pdo_pgsql modules and I haven't been able to make it crash, so I may not be testing the same way you were. Could you file a separate issue please with more information on your setup (macOS version, PHP version, which web server and version, a minimal reproduction recipe)? |
@ryandesign Apologies for the off-topic reply here, but I simply don't know when I'd have the time to finish writing up & filing a proper separate issue myself. Thank you for wanting to look into it. After too much trial-and-error, the key to triggering a 100% immediately reproducible crash is having a libpq (the postgresql client library) built with Kerberos support ( Finally here are some draft build & test instructions that should make it easy to reproduce:
|
Now SCDynamicStoreCopyProxies is called (and the required frameworks are linked in) on all versions of macOS and only on macOS. Fixes crash due to undefined symbol when built with the macOS 10.11 SDK or earlier. CURL_OSX_CALL_COPYPROXIES is renamed to CURL_MACOS_CALL_COPYPROXIES and is now only defined when SCDynamicStoreCopyProxies will actually be called. Previously, it was defined when ENABLE_IPV6 was not defined but SCDynamicStoreCopyProxies is not called in that case. TARGET_OS_OSX is only defined in the macOS 10.12 SDK and later and only when dynamic targets are enabled. TARGET_OS_MAC is always defined but means any Mac OS or derivative including macOS, iOS, tvOS, and watchOS. TARGET_OS_IPHONE means any Darwin OS other than macOS. Follow-up to c73b2f8 Closes curl#11502
curl/curl#11502 osx-arm64 builds fine without the patch, but I applied the patch to both macos arches we support because feature used by curl, and that generates the problem may be enabled at some point.
Now SCDynamicStoreCopyProxies is called (and the required frameworks are linked in) on all versions of macOS and only on macOS. Fixes crash due to undefined symbol when built with the macOS 10.11 SDK or earlier. CURL_OSX_CALL_COPYPROXIES is renamed to CURL_MACOS_CALL_COPYPROXIES and is now only defined when SCDynamicStoreCopyProxies will actually be called. Previously, it was defined when ENABLE_IPV6 was not defined but SCDynamicStoreCopyProxies is not called in that case. TARGET_OS_OSX is only defined in the macOS 10.12 SDK and later and only when dynamic targets are enabled. TARGET_OS_MAC is always defined but means any Mac OS or derivative including macOS, iOS, tvOS, and watchOS. TARGET_OS_IPHONE means any Darwin OS other than macOS. Follow-up to c73b2f8 Fixes curl#11502 Closes curl#11516
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:
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:
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 useTARGET_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
The text was updated successfully, but these errors were encountered: