Skip to content

Apple: visionOS and tvOS builds now supported; update to 26.4 SDKs#162

Closed
stuartcarnie wants to merge 1 commit intogodotengine:mainfrom
stuartcarnie:apple-embedded-updates
Closed

Apple: visionOS and tvOS builds now supported; update to 26.4 SDKs#162
stuartcarnie wants to merge 1 commit intogodotengine:mainfrom
stuartcarnie:apple-embedded-updates

Conversation

@stuartcarnie
Copy link
Copy Markdown
Contributor

Changes in this PR:

  • Updates Apple SDKs to 26.4.
  • Installs the Swift 6.3 toolchain via swiftly in Dockerfile.osx so visionOS Swift sources can be cross-compiled from Linux.
  • Replaces the local osxcross-fix-visionos.patch with the upstream fix from swiftlang/llvm-project#12174, adapted for the clang 19.1.5 tree in osxcross (AvailabilityMergeKind::NoneAMK_None).
  • Fixes visionOS SDK / Swift toolchain incompatibilities at image build time via a new files/appleembedded/patch-visionos-sdk.sh, invoked from Dockerfile.appleembedded, which rewrites the visionOS SDK in place:
    • Adds visionos to API_UNAVAILABLE(...) header lists wherever ios is already listed, working around swiftlang/llvm-project#11866 not yet being merged into swift/release/6.3.
    • Rewrites // swift-compiler-version: in every .swiftinterface so the OSS Swift 6.3 release compiler accepts Apple's interfaces (the marketing version matches but the swiftlang stamps differ: swiftlang-6.3.0.123.x vs swift-6.3-RELEASE).
    • Guts @inlinable bodies in RealityFoundation.swiftinterface that reference C++ types from simd/AVFAudio (library-evolution errors under -cxx-interoperability-mode=default), and swaps the Audio.GeneratorRenderHandler typealias to a function type so call sites using @escaping still parse.
    • Replaces CTTextAlignment/CTLineBreakMode default-argument expressions in RealityKit.swiftinterface with raw-value initializers, since the OSS compiler strips C enum prefixes less aggressively than Apple's and the bare .left / .byTruncatingTail forms don't resolve.

All SDK patches are idempotent, visionOS-only (they touch XROS.sdk), and have comments pointing at the relevant upstream issue so each can be removed once the corresponding fix lands.

Comment thread Dockerfile.osx
# Custom build Apple Clang to ensure compatibility.
# Find the equivalent LLVM version for the SDK from:
# https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
CLANG_VERSION=19.1.5 ENABLE_CLANG_INSTALL=1 INSTALLPREFIX=/usr ./build_apple_clang.sh && \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll test that to make sure everything compiles with 21.1.6

Comment thread Dockerfile.osx
git clone --progress https://github.com/tpoechtrager/osxcross && \
cd /root/osxcross && \
git checkout 121ce150c7857a9474dfff8a8e431482806b3e1b && \
# latest commit from main branch
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# latest commit from main branch
# Latest commit from main branch.

Comment thread Dockerfile.osx

RUN curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz && \
tar zxf swiftly-$(uname -m).tar.gz && \
./swiftly init --platform ubi9 --quiet-shell-followup -y && \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should pin the version of Swift we're installing, to make sure it matches the Xcode SDK we're compiling for, and have reproducible container builds.

Seems like this can be done with something like:

./swiftly init --platform ubi9 --quiet-shell-followup --skip-install -y
~/.local/share/swiftly/bin/swiftly install 6.3.0

And as suggested in godotengine/godot-build-scripts#156 (comment) I'd add a ENV SWIFT_VERSION=6.3.0 that can be used here and in the build scripts.

@Calinou Calinou added the enhancement New feature or request label Apr 14, 2026
@stuartcarnie
Copy link
Copy Markdown
Contributor Author

Closed in favour of the New Improved™

@stuartcarnie stuartcarnie deleted the apple-embedded-updates branch April 15, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants