[bugfix] iOS: wordexp/wordfree unavailable and missing env() implementation#561
[bugfix] iOS: wordexp/wordfree unavailable and missing env() implementation#561uilianries wants to merge 2 commits into
Conversation
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
|
@samuelvenable can you double check if that's correct? |
I don't do iOS dev but last I checked, yes, just like macOS, iOS doesn't have The apple code I wrote was intended to be macOS specific because that is the only apple platform I even have access to or do software dev on. If anything else I wrote happens to work on other apple platforms besides macOS that would be by luck and not because I actually read documentation or tested on them. |
|
Hello! Thank you all for reviewing the PR. If you need any extra information, including more build logs, tell me, and I'll provide as much as I can. Regards, and have a great weekend! |
Greetings! 👋
When building Boost 1.91.0 on Mac M1 (aarch64) for iOS with Apple clang, it fails to build Boost.Process with two independent errors:
1. The functions
wordexpandwordfreeare unavailable on iOSApple iOS/tvOS/watchOS SDKs ship
<wordexp.h>(inherited from the shared Apple SDK headers), but explicitly markwordexp()/wordfree()as unavailable there:The full build error can be seen here: boost-1.91.0-ios-shared-process-wordexp.log
The
shell.cppalready guards against__OpenBSD__and__ANDROID__https://github.com/boostorg/process/blob/boost-1.91.0/src/shell.cpp#L22
Similar to #440, it's just missing the same guard for Apple's non-macOS targets like
iphone.The commit ecca6b2 extends that rule to include Apple platforms that are not
darwin. We need to includeTargetConditionals.hto makeTARGET_OS_OSXavailable.Reference: https://developer.apple.com/documentation/xcode/running-code-on-a-specific-version#Compile-code-for-a-specific-platform
2. Function
ext::envis never defined for iOSOnce the commit ecca6b2 is applied, the previously mentioned error no longer occurs, but a new error shows later during the linkage stage:
You can see the build log with this error here: boost-1.91.0-ios-shared-process-env.log
The
env.cppalready correctly excludes iOS with#elif (defined(__APPLE__) && defined(__MACH__)) && !TARGET_OS_IOS, but no replacement forext::envwas added for the iOS case, so on iOS execution falls through every#elifwith none matching, the symbols result as undefined.The commit beec496 adds an iOS-specific implementation of
ext::envthat returnsENOTSUP, mirroring OpenBSD/Android.Both changes only affect Apple non-macOS targets; for b2, they are
iphoneandappletv. I validated both thesharedandstaticlink variants build on iOS 26.5 / Apple clang 21.0.0 with this patch applied to Boost 1.91.0. You can check my build logs with this patch:Steps to Reproduce
My
user-config.jamlooks like:Environment
This PR is related to #401.
Feel free to ask for more information about this case if needed. Regards!