Fix tvOS NativeReference targets to split device/simulator frameworks#3563
Merged
mattleibow merged 1 commit intomainfrom Mar 15, 2026
Merged
Fix tvOS NativeReference targets to split device/simulator frameworks#3563mattleibow merged 1 commit intomainfrom
mattleibow merged 1 commit intomainfrom
Conversation
The tvOS ItemGroup in IncludeNativeAssets targets was using a single NativeReference pointing to the device framework for all tvOS builds. This caused linker failures when building for the tvOS Simulator because the device framework contains arm64 binaries compiled for tvOS, not the x86_64/arm64 binaries compiled for tvOS Simulator. Split the tvOS NativeReference to match the existing iOS pattern: - tvossimulator RID → tvossimulator/ framework - tvos device RID → tvos/ framework - Guard on RuntimeIdentifier != '' to avoid evaluation during outer builds where RID is not yet resolved Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
tvOS builds targeting the tvOS Simulator fail at link time with architecture mismatch errors. The native framework included during build is the device framework (arm64 compiled for tvOS), but the simulator expects binaries compiled for the tvOS Simulator platform (x86_64 and/or arm64 with simulator platform tag).
Root Cause
Both
IncludeNativeAssets.SkiaSharp.targetsandIncludeNativeAssets.HarfBuzzSharp.targetshad a singleNativeReferencefor all tvOS builds:This means building for
tvossimulator-arm64ortvossimulator-x86_64would link against the device framework, which has the wrong Mach-O platform load command (LC_BUILD_VERSION with platform=tvos instead of platform=tvossimulator). The linker rejects this with errors like:The Fix
Split the tvOS
ItemGroupto conditionally select the correct framework based onRuntimeIdentifier, matching the existing iOS pattern exactly:Why the
RuntimeIdentifier != ''guard?MSBuild evaluates
ItemGroupconditions during the outer build (before RID dispatch) whenRuntimeIdentifieris empty. Without this guard, bothNativeReferenceitems would be evaluated with an empty RID —This is the same guard used by the iOS targets.
Files Changed
binding/IncludeNativeAssets.SkiaSharp.targetsbinding/IncludeNativeAssets.HarfBuzzSharp.targetsComparison with iOS (already correct)
The iOS targets already follow this pattern — this PR simply brings tvOS into alignment:
Context
This is a companion fix to #3561 which added the tvOS simulator native build pipeline. That PR produces separate
tvos/andtvossimulator/framework directories — this PR ensures MSBuild selects the right one at build time.