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
2b5d889 to
eb9aeb8
Compare
Needed for autotools packages (e.g. atf, libiconv, pcre2, gnugrep) to recognize the aarch64-apple-ios-simulator triple. Upstream commit 484648c (Jan 2025) added ios*-simulator- triple recognition.
…tadata - Add 'simulator' ABI and isiOSSimulator pattern. - Darwin platform inference: pick "ios-simulator" vs "ios" vs "macos" from ABI. - xcodePlatform inference: pick "iPhoneSimulator" vs "iPhoneOS" vs "MacOSX" from ABI. - Rust target mapping: abi "simulator" -> "sim" (matches aarch64-apple-ios-sim). - Map ios kernel -> "Darwin" for uname. - Update iphone64 example to SDK 26.3 + darwinMinVersion=14, remove useiOSPrebuilt. - Add aarch64-apple-ios-sim example (SDK 26, darwinMinVersion=16, xcodeVer=26). - Drop darwin-packages.nix iOS prebuilt hook (useiOSPrebuilt is gone).
Bring apple-sdk into a working state for iOS cross-compilation and land common-input propagation across both macOS and iOS in one place. Source tree handling: - fetch-ios-sdk.nix (new): extract the iOS SDK from a host-installed Xcode.app. Separate from the macOS source-release fetcher because the iOS SDK is not source-released and must come from Xcode. - package.nix: support iOS hostPlatform; pick sdkPlatform from hostPlatform.xcodePlatform (iPhoneOS | iPhoneSimulator); parameterize sdkName / platformPath / sdkroot on sdkPlatform instead of hardcoded MacOSX. - derivation-options.nix: parameterize platformPath on sdkPlatform. - setup-hooks/sdk-hook.sh: take @sdkplatform@ (used by substituteAll). - propagate-xcrun.nix: take sdkPlatform so xcrun plist points at the right Platforms/<sdkPlatform>.platform/Info.plist. Propagation (single propagate-inputs.nix): - Fold propagate-common-inputs.nix back into propagate-inputs.nix and run it unconditionally (was previously macOS-only). Apple's SDK ships libresolv, libsbuf, libutil, libiconv, ncurses, and cups headers on iOS the same way as on macOS — splitting propagation by platform meant iOS consumers were missing resolver / <sys/sbuf.h> / <libutil.h> / <iconv.h> / ncurses / cups headers. - cupsHeaders: add --with-tls=no on iOS. CUPS's configure defaults to --with-tls=yes and can't find gnutls / SecureTransport on iOS cross, but the headers-only install doesn't actually need TLS. - x86_64-darwin Csu propagation stays gated, since it's only relevant for very old x86_64 deployment targets. Paired with cross-compile fixes for each of the propagated libraries in separate commits (copyfile, libresolv, ncurses, libutil) so they build cleanly for iOS before they're propagated.
iOS's <sys/mount.h> defines VOL_CAP_FMT_DECMPFS_COMPRESSION, so copyfile.c tries to include decmpfs.h — which pulls in <sys/kdebug.h>, <sys/kernel_types.h>, and <sys/vnode.h>, all absent from the iOS SDK. All DECMPFS code paths in copyfile.c are also guarded on DECMPFS_XATTR_NAME, so skipping the include compiles the feature out cleanly; iOS has no decmpfs filesystem so this preserves correctness. Upstream copyfile.c already includes <TargetConditionals.h> for its own quarantine-on-iOS gate, but it's sourced below the DECMPFS block, so TARGET_OS_IPHONE isn't visible at the include guard. The patch moves <TargetConditionals.h> (and injects <stdbool.h>, which decmpfs.h transitively provided on macOS) above the DECMPFS block.
dyld_priv.h from newer dyld source releases references TARGET_OS_EXCLAVEKIT under -Werror=undef-prefix=TARGET_OS_. SDKs packaged in nixpkgs (macOS 15.5, iOS/iPhoneSimulator 26) don't define the macro yet. Pre-seed it to 0 in the extracted header so the compile doesn't -Werror on an undefined macro.
Three iOS-gated changes so apple-sdk can propagate ncurses on iOS: * enableStatic defaults to true on iOS. ncurses' configure doesn't recognize *-apple-ios / *-apple-ios-simulator hosts for shared-library builds and aborts with "Shared libraries are not supported in this version". iOS apps ship static ncurses in practice. * --with-ospeed=int on iOS. The default `short` activates NCURSES_OSPEED_COMPAT, whose __APPLE__ arm includes <sys/ttydev.h> — a macOS-only header absent from the iOS SDK. Setting ospeed's type to `int` short-circuits the whole block via the existing upstream knob, no source patching needed. ABI-safe: iOS ncurses has no cross-platform consumers (iOS apps only link iOS ncurses). * --without-progs --without-tests on iOS. The tic / reset / filter binaries call system(3), which iOS's SDK marks unavailable; apple-sdk only needs libncurses.a so the utility binaries are unnecessary anyway.
libutil ships three sources that need macOS-only private API / headers:
- wipefs.cpp uses <sys/disk.h> (no iOS SDK analog).
- tzbootuuid.c uses <tzfile.h> (no iOS SDK analog).
- tzlink.c uses xpc_connection_create_mach_service (marked unavailable
on iOS via Apple's availability attributes).
Gate all three on `cc.has_header('sys/disk.h')` / `cc.has_header('tzfile.h')`
so the iOS cross-compile drops the unsupported sources (and the tzlink.h
public header it installs) while the macOS native build is unchanged.
- Disable sanitizers, XRay, libfuzzer, memprof, ORC for iOS. - Enable COMPILER_RT_ENABLE_IOS, disable TVOS/WATCHOS. - Parameterize DARWIN_<platform>_ARCHS and DARWIN_<platform>_MIN_VER on darwinCmakePlatform (osx | ios | iossim) and darwinLongPlatform (macosx | iphoneos | iphonesimulator). - Simulator builds must set DARWIN_iossim_ARCHS not DARWIN_ios_ARCHS (otherwise Apple clang rejects 'sim' as an invalid target triple version). - preConfigure: DARWIN_<longPlatform>_CACHED_SYSROOT + OVERRIDE_SDK_VERSION for iOS target; keep cross-platform overrides.
- darwin-sdk-setup.bash: substitute @xcodePlatform@ so SDKROOT points at the right Platforms/<xcodePlatform>.platform/Developer/SDKs/<xcodePlatform>.sdk instead of hardcoded MacOSX. Add iOS SDK fallback, mangle reorder, and deployment-target export (for cc-rs and other tools that invoke the compiler directly). - bintools-wrapper/default.nix: pass xcodePlatform through so the bintools wrapper's darwin-sdk-setup.bash substitution gets the correct platform.
- default.nix: pass xcodePlatform to the wrapper so darwin-sdk-setup.bash substitutes the correct platform; pass apple-sdk fallback. - setup-hook.sh: export the Darwin deployment-target env var (e.g. IPHONEOS_DEPLOYMENT_TARGET) so tools like cc-rs that invoke the compiler directly see the right minimum version instead of falling back to rustc's hardcoded target default.
- getentropy is marked as private API on iOS and will cause App Store rejection. Pre-seed ac_cv_func_getentropy=no so the link-only autoconf check doesn't find the private symbol. - strchrnul is only available on iOS 18.4+. Bash's autoconf check uses AC_RUN_IFELSE and defaults to "no" when cross-compiling, so no cache pre-seed is needed — just silence clang's -Wunguarded-availability-new when darwinMinVersion < 18.4 (the warning fires because lib/sh/strchrnul.c includes <string.h> which declares the unavailable symbol).
iOS forbids executable writable memory (W^X); the JIT path won't work in sandboxed apps.
gnulib's vendored lib/stackvma.c has a macOS arm that #includes <libc.h> and <nlist.h>, but nothing in the function body references any symbol from either — both are historical cruft from BSD. macOS ships them (so upstream didn't notice); iOS does not, causing a fatal compile error. Patch is a 2-line deletion so the file compiles on iOS; no behavior change on macOS (the includes were dead). The two mach headers actually used by the function (<mach/mach.h>, <mach/machine/vm_param.h>) are present on iOS and remain untouched. Pair with --without-libsigsegv-prefix on iOS to keep external libsigsegv out of the link entirely (not packaged for iOS, and stack-overflow recovery via mach task_info isn't viable in a sandboxed app anyway).
- postPatch: sqlcipher uses autosetup, which ships config.sub/config.guess under autosetup/ with an 'autosetup-' prefix — outside the default updateAutotoolsGnuConfigScriptsHook file-name glob. Refresh them from gnu-config so new triples (e.g. aarch64-apple-ios-simulator) are recognized. Also patch src/shell.c.in to stub system() calls on iOS (API forbidden). - configureFlags: --disable-readline on iOS (ncurses has no shared libs); --disable-tcl for any cross build (TCL nativeBuildInput is build-platform and can't be linked into a different-arch target). - buildInputs: drop readline/ncurses on iOS (ncurses has no shared libs there). - postInstall: iOS produces .so (not .dylib). Gate the Darwin dylib-symlink block on !isiOS and add an iOS .so-symlink block. Remove stale libsqlite3* symlinks before renaming. - TCLLIBDIR: only set when not cross-compiling.
eb9aeb8 to
fe4c863
Compare
| pname = "${sdkPlatform}-SDK"; | ||
| inherit version; | ||
|
|
||
| src = buildPackages.darwin.xcode; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
The Xcode package already has its license set to unfree, which should cover that.
The license on apple-sdk could be set conditionally based on iOS using xcode.meta.license, but it’s deliberate (based on historical practice in Nixpkgs for SDK frameworks) that it’s absent on macOS. On macOS, the SDK is not sourced from Xcode (or else we’d have access to several tools that we’re missing). #477742 has some discussion the last time adding the license was to the package was tried.
|
|
||
| stdenvNoCC.mkDerivation { | ||
| pname = "${sdkPlatform}-SDK"; | ||
| inherit version; |
There was a problem hiding this comment.
Should we add __contentAddressed = true; to allow recreating this derivations from a globally installed version of Xcode? On many CI platforms Xcode is already available globally in the builder images (on GitHub Actions every Xcode version is located on a different path so reproducibility won't be a problem). Adding Xcode to Nix store manually takes too long and building this derivation outside the store will be very quick. With a content addressable derivation I can imagine copy pasting the install phase from here in a custom script which depends on global Xcode and just adds the result to the store.
There was a problem hiding this comment.
thanks for your review! I'll have to look into content addressable derivations, frankly I didn't know that was possible when making this PR. I'm happy to do that if it speeds things up though, since I do have a CI workflow with xcode that takes 2min to the CI run purely from importing xcode to the nix store
Have you tried cross compiling from a Linux host? Out of curiosity, not needed for this PR. |
Have not tried yet, but can try tomorrow morning. So far everything has been with remote builders from a linux host -- i would think there's still somestuff in the stack that would result in 'exec error' from the mismatched platform, but i'll definitely verify |
Another thing that might trip you too is getting Xcode in the Nix store as Apple only ships it in a xip file. You can use https://github.com/saagarjha/unxip on Linux to extract it (I'm packaging it in #509238). |
|
Great PR! I was able to build the following packages successfully on a $ NIXPKGS_ALLOW_UNFREE=1 nix-build --option sandbox relaxed -E '
let
pkgs = import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/fe4c8633e37f526d6b7eb31fffb02c3aa3a84cf7.tar.gz";
sha256 = "1sn21bkj9jhy74p57qwbjw7iwrjg930dbqmv9nqnpk9pcj3cylx2";
}) {
overlays = [
(final: prev: {
darwin = prev.darwin.overrideScope (dfinal: dprev: {
xcode = dprev.xcode_26_Apple_silicon;
});
})
];
};
in
[
pkgs.darwin.xcode
pkgs.pkgsCross.iphone64.sqlcipher
pkgs.pkgsCross.iphone64.hello
pkgs.pkgsCross.iphone64.ncurses
pkgs.pkgsCross.iphone64.pcre2
pkgs.pkgsCross.iphone64.gnugrep
pkgs.pkgsCross.iphone64.darwin.libresolv
pkgs.pkgsCross.iphone64.darwin.libutil
pkgs.pkgsCross.iphone64.darwin.copyfile
pkgs.pkgsCross.iphone64-simulator.sqlcipher
pkgs.pkgsCross.iphone64-simulator.hello
pkgs.pkgsCross.iphone64-simulator.ncurses
pkgs.pkgsCross.iphone64-simulator.pcre2
pkgs.pkgsCross.iphone64-simulator.gnugrep
pkgs.pkgsCross.iphone64-simulator.darwin.libresolv
pkgs.pkgsCross.iphone64-simulator.darwin.libutil
pkgs.pkgsCross.iphone64-simulator.darwin.copyfile
]
'
/nix/store/f321s6jn4dz7nvkxf6rmigg5lgr8bnv1-Xcode.app
/nix/store/sadg9dm6bmrb2b2pvmjri7kp56fh4la5-sqlcipher-arm64-apple-ios-4.14.0
/nix/store/8sf9vchibs0n6x037ik1yhg9s28zpz4b-hello-arm64-apple-ios-2.12.3
/nix/store/5xfk3n7jriilv4d69nvvspy91jnnjf1s-ncurses-arm64-apple-ios-6.6
/nix/store/g5m4c1n73imdcq9p4csjm5g1r8miznn1-pcre2-arm64-apple-ios-10.46-bin
/nix/store/xhq1qqlfvcllhqxjl2v8icppigp56p80-gnugrep-arm64-apple-ios-3.12
/nix/store/anyjb9syqhqph9spw35wp2rckakvz2kf-libresolv-arm64-apple-ios-91
/nix/store/frw9iz320bw0y38x9c4gw2drvp34053s-libutil-arm64-apple-ios-72
/nix/store/7pf4i45yn0vs7msavv4xbxg558k9cjq9-copyfile-arm64-apple-ios-224
/nix/store/fnf6qvpzggvg7ikd4cl4gfnh8ly4rwq9-sqlcipher-aarch64-apple-ios-simulator-4.14.0
/nix/store/i8gi4x7lxn63rxjbsgi4145g1fjjlysz-hello-aarch64-apple-ios-simulator-2.12.3
/nix/store/sv2ia2nfly5pb699rwhvgkl308d75ziv-ncurses-aarch64-apple-ios-simulator-6.6
/nix/store/pni2spd496lh2mshxwxd57lqj1l21izf-pcre2-aarch64-apple-ios-simulator-10.46-bin
/nix/store/lxz79l9clq359q67xin8lmdld546lffl-gnugrep-aarch64-apple-ios-simulator-3.12
/nix/store/2rqnj8innhvr9b7xa4izzb932im5i50h-libresolv-aarch64-apple-ios-simulator-91
/nix/store/rjabnp4k0p42manpsb4hcvl2mcxkhiva-libutil-aarch64-apple-ios-simulator-72
/nix/store/0x1cxbzm5yc75yfkjhkcq7vv7mchqb9i-copyfile-aarch64-apple-ios-simulator-224
$ vtool -show-build result-2/lib/libsqlcipher.so
result-2/lib/libsqlcipher.so:
Load command 10
cmd LC_BUILD_VERSION
cmdsize 32
platform IOS
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ vtool -show-build result-3/bin/hello
result-3/bin/hello:
Load command 11
cmd LC_BUILD_VERSION
cmdsize 32
platform IOS
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ objdump -a result-4/lib/libncurses++.a
result-4/lib/libncurses++.a(cursesf.o): file format mach-o arm64
rw-r--r-- 0/0 18884 Thu Jan 1 02:00:00 1970 cursesf.o
result-4/lib/libncurses++.a(cursesm.o): file format mach-o arm64
rw-r--r-- 0/0 16828 Thu Jan 1 02:00:00 1970 cursesm.o
result-4/lib/libncurses++.a(cursesw.o): file format mach-o arm64
rw-r--r-- 0/0 15924 Thu Jan 1 02:00:00 1970 cursesw.o
result-4/lib/libncurses++.a(cursespad.o): file format mach-o arm64
rw-r--r-- 0/0 9780 Thu Jan 1 02:00:00 1970 cursespad.o
result-4/lib/libncurses++.a(cursesp.o): file format mach-o arm64
rw-r--r-- 0/0 6804 Thu Jan 1 02:00:00 1970 cursesp.o
result-4/lib/libncurses++.a(cursslk.o): file format mach-o arm64
rw-r--r-- 0/0 10084 Thu Jan 1 02:00:00 1970 cursslk.o
result-4/lib/libncurses++.a(cursesapp.o): file format mach-o arm64
rw-r--r-- 0/0 8228 Thu Jan 1 02:00:00 1970 cursesapp.o
result-4/lib/libncurses++.a(cursesmain.o): file format mach-o arm64
rw-r--r-- 0/0 6204 Thu Jan 1 02:00:00 1970 cursesmain.o
$ vtool -show-build result-5-bin/bin/pcre2test
result-5-bin/bin/pcre2test:
Load command 11
cmd LC_BUILD_VERSION
cmdsize 32
platform IOS
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ vtool -show-build result-6/bin/grep
result-6/bin/grep:
Load command 11
cmd LC_BUILD_VERSION
cmdsize 32
platform IOS
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ vtool -show-build result-7/lib/libresolv.dylib
result-7/lib/libresolv.dylib:
Load command 10
cmd LC_BUILD_VERSION
cmdsize 32
platform IOS
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ vtool -show-build result-8/lib/libutil.dylib
result-8/lib/libutil.dylib:
Load command 10
cmd LC_BUILD_VERSION
cmdsize 32
platform IOS
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ vtool -show-build result-9/lib/libcopyfile.dylib
result-9/lib/libcopyfile.dylib:
Load command 10
cmd LC_BUILD_VERSION
cmdsize 32
platform IOS
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ vtool -show-build result-10/lib/libsqlcipher.so
result-10/lib/libsqlcipher.so:
Load command 9
cmd LC_BUILD_VERSION
cmdsize 32
platform IOSSIMULATOR
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ vtool -show-build result-11/bin/hello
result-11/bin/hello:
Load command 10
cmd LC_BUILD_VERSION
cmdsize 32
platform IOSSIMULATOR
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ objdump -a result-12/lib/libncurses++.a
result-12/lib/libncurses++.a(cursesf.o): file format mach-o arm64
rw-r--r-- 0/0 18884 Thu Jan 1 02:00:00 1970 cursesf.o
result-12/lib/libncurses++.a(cursesm.o): file format mach-o arm64
rw-r--r-- 0/0 16828 Thu Jan 1 02:00:00 1970 cursesm.o
result-12/lib/libncurses++.a(cursesw.o): file format mach-o arm64
rw-r--r-- 0/0 15924 Thu Jan 1 02:00:00 1970 cursesw.o
result-12/lib/libncurses++.a(cursespad.o): file format mach-o arm64
rw-r--r-- 0/0 9780 Thu Jan 1 02:00:00 1970 cursespad.o
result-12/lib/libncurses++.a(cursesp.o): file format mach-o arm64
rw-r--r-- 0/0 6804 Thu Jan 1 02:00:00 1970 cursesp.o
result-12/lib/libncurses++.a(cursslk.o): file format mach-o arm64
rw-r--r-- 0/0 10212 Thu Jan 1 02:00:00 1970 cursslk.o
result-12/lib/libncurses++.a(cursesapp.o): file format mach-o arm64
rw-r--r-- 0/0 8244 Thu Jan 1 02:00:00 1970 cursesapp.o
result-12/lib/libncurses++.a(cursesmain.o): file format mach-o arm64
rw-r--r-- 0/0 6204 Thu Jan 1 02:00:00 1970 cursesmain.o
$ vtool -show-build result-13-bin/bin/pcre2test
result-13-bin/bin/pcre2test:
Load command 10
cmd LC_BUILD_VERSION
cmdsize 32
platform IOSSIMULATOR
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ vtool -show-build result-14/bin/grep
result-14/bin/grep:
Load command 10
cmd LC_BUILD_VERSION
cmdsize 32
platform IOSSIMULATOR
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ vtool -show-build result-15/lib/libresolv.dylib
result-15/lib/libresolv.dylib:
Load command 9
cmd LC_BUILD_VERSION
cmdsize 32
platform IOSSIMULATOR
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ vtool -show-build result-16/lib/libutil.dylib
result-16/lib/libutil.dylib:
Load command 9
cmd LC_BUILD_VERSION
cmdsize 32
platform IOSSIMULATOR
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ vtool -show-build result-17/lib/libcopyfile.dylib
result-17/lib/libcopyfile.dylib:
Load command 9
cmd LC_BUILD_VERSION
cmdsize 32
platform IOSSIMULATOR
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16 |
|
|
||
| iosCflags = lib.optionalString (iosBelow "18.4") "-Wno-unguarded-availability-new"; | ||
|
|
||
| iosConfigureFlags = lib.optionals isIos [ "ac_cv_func_getentropy=no" ]; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
kicking off a new build now, I don't think I tried building bash on its own since my process was mostly get zlib working in nixpkgs, then try compiling xmtp's ios libraries. if it doesn't work on its own i'll need to fix the build
I've been using xcode 26.3, so if it works on that sdk i'll switch to 26.0 and see if for some reason that could be it
should have an answer soon, most things were cached
locally i'm also based off master rather than staging, so another build i'll try (that one probably will take longer)
There was a problem hiding this comment.
Awesome, can confirm it builds on my machine:
$ NIXPKGS_ALLOW_UNFREE=1 nix-build --option sandbox relaxed -E '
let
pkgs = import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/f9ef44b5c38174dfeed5ba336388c885b248cff9.tar.gz";
sha256 = "1ykjcnnw0mrhs8h3s082zlw98wz0rka6mknhis268yjsz6anxpvs";
}) {
overlays = [
(final: prev: {
darwin = prev.darwin.overrideScope (dfinal: dprev: {
xcode = dprev.xcode_26_Apple_silicon;
});
})
];
};
in
[
pkgs.darwin.xcode
pkgs.pkgsCross.iphone64.bash
pkgs.pkgsCross.iphone64-simulator.bash
]
'
/nix/store/f321s6jn4dz7nvkxf6rmigg5lgr8bnv1-Xcode.app
/nix/store/winjp1s3r01ah4bzy11lap1h8834mqaj-bash-interactive-arm64-apple-ios-5.3p9
/nix/store/9zqjw4m0npy0q60yalp4c0cjs1qqppj1-bash-interactive-aarch64-apple-ios-simulator-5.3p9
$ vtool -show-build result-2/bin/bash
result-2/bin/bash:
Load command 11
cmd LC_BUILD_VERSION
cmdsize 32
platform IOS
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16
$ vtool -show-build result-3/bin/bash
result-3/bin/bash:
Load command 10
cmd LC_BUILD_VERSION
cmdsize 32
platform IOSSIMULATOR
minos 14.0
sdk 26.0
ntools 1
tool LD
version 954.16readline's configure doesn't recognize *-apple-ios as supporting shared libraries and reports "unsupported". nixpkgs' stdenv-generic adds --disable-static by default when configure exposes that knob, so the combination leaves Makefile with no targets and 'make all' produces nothing. The dev/man/info/doc outputs then come up empty and the build fails with 'failed to produce output path'. Flip the iOS host to dontDisableStatic + --enable-static (and pass --disable-shared explicitly to match). iOS apps ship static system libs in practice, mirroring the ncurses iOS treatment.
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/.