Repository navigation
Closed
Labels
Description
I did this
After updating to Xcode 26.4, my script to compile curl for use in iOS fails specifically for the iOS simulator:
configure: Configured to build curl/libcurl:
Host setup: arm-apple-darwin
Install prefix: /Users/ian/Developer/tlskit-external-dependencies/builder/curl-ios/build/curl_arm64-iphonesimulator/artifacts
Compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/gcc
CFLAGS: -arch arm64 -pipe -Os -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator26.4.sdk -miphonesimulator-version-min=12.0 -Qunused-arguments -Werror-implicit-function-declaration -Werror=partial-availability
CFLAGS extras:
CPPFLAGS: -isystem /Users/ian/Developer/tlskit-external-dependencies/builder/openssl-ios/build/openssl_arm64-iphonesimulator/artifacts/include
LDFLAGS: -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator26.4.sdk -L/Users/ian/Developer/tlskit-external-dependencies/builder/openssl-ios/build/openssl_arm64-iphonesimulator/artifacts/lib
curl-config: -L/Users/ian/Developer/tlskit-external-dependencies/builder/openssl-ios/build/openssl_arm64-iphonesimulator/artifacts/lib
LIBS: -lssl -lcrypto -lssl -lcrypto -lz
curl version: 8.19.0
SSL: enabled (OpenSSL)
SSH: no (--with-{libssh,libssh2})
zlib: enabled
brotli: no (--with-brotli)
zstd: no (--with-zstd)
GSS-API: no (--with-gssapi)
GSASL: no (--with-gsasl)
TLS-SRP: no (--enable-tls-srp)
resolver: POSIX threaded
IPv6: enabled
Unix sockets: enabled
IDN: no (--with-{libidn2,winidn})
Build docs: no
Build libcurl: Shared=no, Static=yes
Built-in manual: no (--enable-manual)
--libcurl option: enabled (--disable-libcurl-option)
Type checking: enabled (--disable-typecheck)
Verbose errors: enabled (--disable-verbose)
Code coverage: disabled
SSPI: no (--enable-sspi)
ca native: no
ca cert bundle: no
ca cert path: no
ca cert embed: /Users/ian/Developer/tlskit-external-dependencies/builder/curl-ios/rootca-apple-bundle_20260319.pem
ca fallback: no
LDAP: no (--enable-ldap / --with-ldap-lib / --with-lber-lib)
LDAPS: no (--enable-ldaps)
IPFS/IPNS: no (--enable-ipfs)
RTSP: no (--enable-rtsp)
RTMP: no (--with-librtmp)
PSL: no (--with-libpsl)
Alt-svc: enabled (--disable-alt-svc)
Headers API: enabled (--disable-headers-api)
HSTS: enabled (--disable-hsts)
HTTP1: enabled (internal)
HTTP2: no (--with-nghttp2)
HTTP3: no (--with-ngtcp2 --with-nghttp3, --with-quiche)
ECH: no (--enable-ech)
HTTPS RR: no (--enable-httpsrr)
SSLS-EXPORT: no (--enable-ssls-export)
Protocols: http https ws wss
Features: alt-svc AsynchDNS CAcert HSTS HTTPS-proxy IPv6 Largefile libz SSL threadsafe UnixSockets
The error appears to be around an incorrect test result for supporting pipe2, which appears to be a GNU function that isn't going to be available on Darwin:
[...]
checking for pipe2... yes
[...]
socketpair.c:59:6: error: call to undeclared function 'pipe2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
59 | if(pipe2(socks, flags))
| ^
socketpair.c:59:6: note: did you mean 'pipe'?
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator26.4.sdk/usr/include/unistd.h:482:6: note: 'pipe' declared here
482 | int pipe(int [2]);
| ^
1 error generated.
CC libcurl_la-splay.lo
CC libcurl_la-strcase.lo
make[2]: *** [libcurl_la-socketpair.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
This only happens for the iphonesimulator platform, compiling for devices itself works (pipe2 support is correctly flagged as no).
See the full log from configure and make: arm64-iphonesimulator_build.log
I expected the following
Curl to not try and use GNU methods that don't exist on Darwin
curl/libcurl version
8.19.0
operating system
macOS 26.4
Activity
bagder commentedon Apr 6, 2026
FTR, pipe2() is posix: https://pubs.opengroup.org/onlinepubs/9799919799/functions/pipe.html
bagder commentedon Apr 6, 2026
It appears to be a missing
#includefor the prototype that causes the build to fail.vszakats commentedon Apr 6, 2026
pipe2 declaration seems to be missing from all Apple SDK headers. Strange
that this symbol is exported or whatever is causing the mis-detection.
@ecnepsnai Would you mind attaching
config.log?ecnepsnai commentedon Apr 6, 2026
Oh! good to know. I had searched through Apple's docs and the headers and didn't see it so I (incorrectly) jumped to the conclusion that it was GNU.
Attached is the config log:
config.log
Also I checked, if I pass
ac_cv_func_pipe2=noto my./configurethen things to build successfully, so that at least unblocks me as a temporary workaround.vszakats commentedon Apr 6, 2026
pipe2 detection in
config.log:Can't spot anything unexpected. I wonder where the phantom symbol may be coming from.
The check can be fenced off from apple, or replaced by a complex/slow check (not a fan),
but it'd be nevertheless interesting to understand what's going on. I can't find signs
of this kind of issue on the internet. pipe2 detection was added a year ago with no reports
since.
One known weak spot of this detection method is that the symbol may be picked up from
3rd-party libs if they for some reason export it. I had seen this with LibreSSL.
ecnepsnai commentedon Apr 7, 2026
Is there a way I could check for this? I am building OpenSSL and providing that to curl when I build it.
vszakats commentedon Apr 7, 2026
conftest.mapmay hopefully give some clues.ecnepsnai commentedon Apr 7, 2026
That ran without error (exit 0)
However if I change it to use iPhoneOS it fails as expected:
vszakats commentedon Apr 8, 2026
What is the content of
conftest.mapin either cases?ecnepsnai commentedon Apr 8, 2026
Apologies, forgot to upload that. Here you are:
vszakats commentedon Apr 8, 2026
Thanks! It answers the riddle:
/usr/lib/system/libsystem_sim_kernel.dylibisexporting this symbol. Might be an oversight, but I wouldn't expect Apple fixing
this, even if it is.
In this case guarding off this feature check for Apple platforms seems like a
reasonable solution to me. If Apple ever gets to support this API, it will require
a different approach, but that's not something likely to happen IMO.
build: skip detecting pipe2() for Apple targets
vszakats commentedon Apr 8, 2026
@ecnepsnai Does this patch fix the issue for you?: #21271
2 remaining items
ecnepsnai commentedon Apr 8, 2026
I did not, thanks for pointing that out!
And after doing that, I can confirm your patch does fix the issue.
vszakats commentedon Apr 8, 2026
Thanks for your tests! I merged the fix.
build: skip detecting `pipe2()` for Apple targets
Suppress false detection of pipe2() under darwin
Suppress false detection of pipe2() under darwin
Suppress false detection of pipe2() under darwin
build: skip detecting `pipe2()` for Apple targets
akoeplinger commentedon Sep 16, 2026
it looks like Apple added this function in the macOS/iOS 27 releases, from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/sys/unistd.hGHA/macos: add Xcode 27, drop macos-14
s1
s1
s1
socketpair: use `pipe2()` on Apple OSes (requires SDK 27)
vszakats commentedon Sep 28, 2026
@akoeplinger Thanks for reporting. I landed PR #23126 to enable
pipe2()support on Apple OSes. (could not try it locally due to the lack of SDK 27, but the CI builds it and runs tests with it.)