various: add iOS and iOS simulator cross-compilation#512100
Conversation
af88c1b to
586e55b
Compare
586e55b to
a7ae3dc
Compare
There was a problem hiding this comment.
If #511070 is merged, will not using the Apple libiconv on iOS be a problem?
There was a problem hiding this comment.
AFAIU propagate-common-inputs is using the libiconv built with nix, its the inputs in propagate-inputs that don't work with iOS cross compilation yet (although i'm making good progress getting those working as well).
But, i've tried w/ and w/o libiconv in propagate, and they both work, so i don't see an issue with 511070 either way
I also may misunderstand your question here tho, (or misunderstand the libiconv situation in nixpkgs) so happy to test against realLibiconv pr to verify
There was a problem hiding this comment.
#511070 got dropped. We’re sticking with Apple’s libiconv implementation for now, which should have a fine license.
0f4875c to
833fdd6
Compare
There was a problem hiding this comment.
will send an upstream gnulib patch to upstream this if possible, seems like a no-brainer
833fdd6 to
f4c2c80
Compare
| useiOSPrebuilt = true; | ||
| darwinSdkVersion = "14"; | ||
| darwinMinVersion = "14"; | ||
| xcodeVer = "12"; |
There was a problem hiding this comment.
unsure if we want to bump this. I tested this stack against xcode 26.3 (that's the one I had installed) and in practice i'm unsure of anyone who wouldn't be on a later xcode version
f4c2c80 to
ad64a01
Compare
ed5b936 to
298f7fe
Compare
|
just as an update, I updated this PR to the latest staging and am preparing to integrate it (as an additional patch to unstable nixpkgs) into libxmtp iOS dylib/static lib library release flow, so i'll be testing it with a real world app pipeline |
Upstream 484648c adds the *-apple-ios-simulator triple, needed by autotools packages (libiconv, pcre2, gnugrep, sqlcipher).
New simulator ABI with isiOSSimulator predicate; darwinPlatform, xcodePlatform, and rust target inference; refreshed iphone64 examples.
Extract the iOS SDK from a host Xcode (fetch-ios-sdk.nix), pick the platform from hostPlatform.xcodePlatform, propagate common inputs on iOS.
iOS defines VOL_CAP_FMT_DECMPFS_COMPRESSION but lacks decmpfs.h transitive headers; hoist <TargetConditionals.h> above the guard.
Static-only (configure rejects *-apple-ios shared), --with-ospeed=int to skip the macOS-only <sys/ttydev.h>, no progs/tests (system(3) unavailable).
wipefs/tzbootuuid/tzlink need <sys/disk.h>, <tzfile.h>, or XPC marked unavailable on iOS; gate on cc.has_header.
Enable COMPILER_RT_ENABLE_IOS without sanitizers; key the DARWIN_* ARCHS/SYSROOT cmake flags on xcodePlatform (simulator uses iossim).
Substitute @xcodePlatform@ so SDKROOT resolves the right platform SDK instead of hardcoded MacOSX; export the deployment-target variable.
Pass xcodePlatform and the apple-sdk fallback to the wrapper; export IPHONEOS_DEPLOYMENT_TARGET for tools invoking the compiler directly.
getentropy is private API on iOS (App Store rejection); strchrnul needs iOS 18.4+ and only trips -Wunguarded-availability-new.
iOS forbids writable+executable pages (W^X).
gnulib stackvma.c macOS arm includes them unused since 2003; iOS does not ship them. Two-line deletion, no-op on macOS.
Refresh autosetup config.{sub,guess}, stub system(3) call sites, drop
readline/TCL for cross builds, fix .so vs .dylib install names.
configure rejects shared libs on *-apple-ios; build static-only.
Resolve xcode via targetPackages xcodeVer, fix splices, bake the deployment target into the clang triple, force wrapped ld via -fuse-ld.
iosSdkPkgs.clang wires the SDK itself; propagating apple-sdk would drag in the full source-built Darwin bootstrap.
Things done
this is my attempt at iOS cross compilation for nixpkgs. this PR contains some ios-specific changes for packages outside of apple-sdk/compiler-rt as well, since they were required for compiling iOS static/dylib for the project I was testing this with. Happy to split those into separate PRs based on preferences of maintainers here, or if it means getting individual changes in faster.
With this stack i was able to cross compile from
aarch64-darwintox86_64-darwin,iphone64andiphone64 simulatortargets. it bumps gnu-config to a revision which includes ios*-simulator support to make handling-simulatortargets more idiomaticresolves #171537 #361934
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.