-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Description
I did this
In #7121 I have introduced a call to SCDynamicStoreCopyProxies for a obscure, rare edge case when one is on macOS, an IPv6-only access network with DNS64/NAT64 and accesses IPv4-only literal URL such as http://1.1.1.1/. The IPv4 address is internally (by a getaddrinfo) converted into a NAT64-mapped IPv4 address, such as 64:ff9b::1.1.1.1.
The change in #7121 builds fine on macOS with clang, however fails to build on macOS if CMake and GCC are in use. The error message is:
[ 21%] Building C object lib/CMakeFiles/libcurl.dir/hostip.c.o
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32,
from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:42,
from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferences.h:35,
from /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SystemConfiguration.h:126,
from /Users/rzajic/Work/git-priv/curl-cmake2/curl/lib/hostip.c:72:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope
char bytes[kAuthorizationExternalFormLength];
^~~~~
make[2]: *** [lib/CMakeFiles/libcurl.dir/hostip.c.o] Error 1
make[1]: *** [lib/CMakeFiles/libcurl.dir/all] Error 2
make: *** [all] Error 2
Another issue popped up when reproducing the issue on my build system (testing with CMake and GCC 8.5):
[ 0%] Building C object lib/CMakeFiles/libcurl.dir/timeval.c.o
/Users/rzajic/Work/git-priv/curl-cmake2/curl/lib/timeval.c: In function 'Curl_now':
/Users/rzajic/Work/git-priv/curl-cmake2/curl/lib/timeval.c:81:28: error: "HAVE_BUILTIN_AVAILABLE" is not defined, evaluates to 0 [-Werror=undef]
#if defined(__APPLE__) && (HAVE_BUILTIN_AVAILABLE == 1)
^~~~~~~~~~~~~~~~~~~~~~
/Users/rzajic/Work/git-priv/curl-cmake2/curl/lib/timeval.c:88:28: error: "HAVE_BUILTIN_AVAILABLE" is not defined, evaluates to 0 [-Werror=undef]
#if defined(__APPLE__) && (HAVE_BUILTIN_AVAILABLE == 1)
^~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [lib/CMakeFiles/libcurl.dir/timeval.c.o] Error 1
make[1]: *** [lib/CMakeFiles/libcurl.dir/all] Error 2
make: *** [all] Error 2
I expected the following
The project to build and run.
curl/libcurl version
Master with #7121 merged.
operating system
macOS Big Sur, CMake, GCC 8 (also happens with GCC 9)
resolution
The first issue is a known compatibility problem between macOS SDK and GCC. Switching from #include <SystemConfiguration/SCDynamicStoreCopySpecific.h> to #include <SystemConfiguration/SystemConfiguration.h> results in successful build on CMake/GCC (macOS), autoreconf -i && ./configure && make (macOS) and CMake/clang (macOS).
The second issue can be worked around by adding && defined(HAVE_BUILTIN_AVAILABLE) to the #if condition.
I will submit another pull request fixing the broken build process.