Skip to content

Build iOS libffi for the device target and cache more build outputs - #63

Merged
tiensonqin merged 2 commits into
mainfrom
devin/1791615652-ios-device-libffi-cache
Oct 10, 2026
Merged

tiensonqin merged 2 commits into
mainfrom
devin/1791615652-ios-device-libffi-cache

Conversation

@tiensonqin

Copy link
Copy Markdown
Contributor

Summary

Fixes the Build-iOS failure and adds the requested caching.

libffi fix: build-mobile-ios-device.sh now builds a real iOS libffi, same as the simulator script — the ctypes-foreign stub compile was falling back to the host CLT ffi.h ('ffi_type_*' is unavailable: not available on iOS, 20 errors). The device path now:

  • builds libffi.a into $toolchain_root/ios/libffi-$triple (inside the cached _build/apple-toolchains)
  • passes PKG_CONFIG_PATH=$ffi_prefix/lib/pkgconfig to build-mobile-ocaml.sh so ctypes discovers the right headers
  • appends -L$ffi_prefix/lib to native_link_inputs so the Xcode archive link resolves -lffi

Caching (iOS + Android, in addition to the existing opam-root/opam-switch/duniverse/toolchain caches):

  • _build/ios-core — incremental dune objects (sha key + prefix restore-keys)
  • apple/.build + ~/Library/Developer/Xcode/DerivedData — SwiftPM/Xcode incremental state
  • apple/App/vendor/bundle — bundler gems (keyed on Gemfile + workflow)
  • android/app/.cxx + android/app/build/intermediates — CMake/Gradle intermediates (sha key + prefix restore-keys)

Link to Devin session: https://app.devin.ai/sessions/3fbb55f8acd849db864aa2e7287c0cea
Open in Devin Desktop: https://app.devin.ai/desktop/session/3fbb55f8acd849db864aa2e7287c0cea?variant=devin
Requested by: @tiensonqin

CI vendors the lockfile SHAs (opam monorepo pull fills duniverse
before the pin-depends clone loop, which then skips existing dirs).
The lockfile still pointed at drive 7f407b0, which predates the
detach-subtree patch op, so every drive test died in
Drive.Model.apply_op with a non-exhaustive match (26 failures).
ocaml-signal had drifted the same way (868c145 -> df355e1).
- build-mobile-ios-device.sh now builds a real iOS libffi like the
  simulator script does: ctypes-foreign's stub compile was falling back
  to the host CLT ffi.h ("not available on iOS"), and the archive link
  now gets -L for the vendored libffi.a. PKG_CONFIG_PATH points the
  ctypes pkg-config discovery at the toolchain prefix.
- build-ios-release.yml caches _build/ios-core (incremental dune),
  apple/.build + DerivedData, and bundler gems under vendor/bundle.
- build-android.yml caches android/app/.cxx + build/intermediates for
  incremental CMake/Gradle rebuilds.
@tiensonqin
tiensonqin merged commit cd22838 into main Oct 10, 2026
3 checks passed
@tiensonqin
tiensonqin deleted the devin/1791615652-ios-device-libffi-cache branch October 10, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant