cURL / Mailing Lists / curl-library / Single Mail

curl-library

macOS10.12/Xcode8 introduces run-time crash when building libcurl for earlier iOS versions

From: Peter White (jawhite2) <jawhite2_at_cisco.com>
Date: Wed, 14 Sep 2016 16:24:58 +0000

Hi there,

On macOS Sierra (v10.12) and iOS 10, the function clock_gettime has been introduced in the Darwin kernel. When building libcurl on macOS 10.12 with Xcode 8 and iOS10 SDK, the configure script will return yes for "monotonic clock_gettime" (around Line 20434 of configure).

However, when using libcurl in an application on an earlier version of iOS, this will cause a run time crash due to a missing symbol for clock_gettime.

No crash occurs on an iPhone 6 running iOS10, but on an iPad running iOS9.3.5, a crash occurs due to a missing symbol for clock_gettime.

OS: macOS Sierra (v10.12). Darwin kernel version 16.0.0
Libcurl version build: v7.49.1
Building libcurl for iOS 9.0 with Xcode 8 GM seed.

Configure output with Xcode 8 (on macOS 10.12)
==========
configure:20433: checking for monotonic clock_gettime
configure:20466: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/ -miphoneos-version-min=9.0 -arch armv7 -mthumb -DNDEBUG -isystem /Volumes/local/JenkinsSlave/trunk/dependencies/openssl/include -Qunused-arguments -Os conftest.c >&5
configure:20466: $? = 0
configure:20468: result: yes
==========

Configure output with Xcode 7 (on OSX 10.11)
==========
configure:20466: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/ -miphoneos-version-min=9.0 -arch armv7 -mthumb -isystem /Volumes/local/JenkinsSlave/trunk/dependencies/openssl/include -Qunused-arguments -Os conftest.c >&5
conftest.c:72:15: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
        (void)clock_gettime(CLOCK_MONOTONIC, &ts);
              ^
conftest.c:72:29: error: use of undeclared identifier 'CLOCK_MONOTONIC'
        (void)clock_gettime(CLOCK_MONOTONIC, &ts);
                            ^
1 warning and 1 error generated.
configure:20466: $? = 1
=========

I changed "curl_func_clock_gettime" to "no" in configure as a quick workaround and the libcurl binary didn't cause any issues in either iOS9 or iOS10.

Although not tested yet, I believe the same issue would occur when building libcurl on macOS 10.12 and using that binary on OSX 10.11 or lower.

Best,
Peter

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-09-14