Skip to content

fix(build): fix x86_64 simulator build and spm_dependency guard#531

Merged
eszlamczyk merged 2 commits into
mainfrom
fix/527-ios-simulator-build
Jul 9, 2026
Merged

fix(build): fix x86_64 simulator build and spm_dependency guard#531
eszlamczyk merged 2 commits into
mainfrom
fix/527-ios-simulator-build

Conversation

@eszlamczyk

Copy link
Copy Markdown
Collaborator

What/Why?

Fixes #527 — iOS builds fail when compiling universal simulator targets with LaTeX math (RaTeX) enabled (>= 0.7).

RaTeX's Swift wrapper is compiled from SPM source, so its RaTeX.swiftmodule is emitted only for the arch(es) the build requests. Under ONLY_ACTIVE_ARCH on Apple Silicon that's arm64 only, but universal simulator builds (archive, "Any iOS Simulator Device", Release) also compile this pod for x86_64 and then fail with:

could not find module 'RaTeX' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator

Two podspec fixes:

  • Exclude x86_64 for the simulator when math is enabled (EXCLUDED_ARCHS[sdk=iphonesimulator*]), applied to both the pod target and the app target (user_target_xcconfig) so their arch sets stay in sync. Apple Silicon only; Intel simulator builds aren't supported when math is on (consumers can disable math via ENV['ENRICHED_MARKDOWN_ENABLE_MATH'] = '0').
  • Fix the spm_dependency availability guard. defined?(:spm_dependency) uses a symbol literal, so it always returns "expression" (truthy) and never guards. On RN versions without spm_dependency, pod install crashed with NoMethodError. Changed to defined?(spm_dependency) for a clean fallback.

Testing

  • pod install + xcodebuild -sdk iphonesimulator -configuration Release -destination 'generic/platform=iOS Simulator' build in the example app — previously failed, now succeeds.

  • Verified the exclusion lands in both ReactNativeEnrichedMarkdown.*.xcconfig and Pods-*.xcconfig.

  • Verified the guard fix with a Ruby repro: old form passes even when the method is undefined (→ NoMethodError); new form skips cleanly when absent and still passes on RN 0.86. Full pod install re-run confirms no regression.

    PR Checklist

    • Code compiles and runs on iOS
    • Code compiles and runs on Android
    • Updated documentation/README if applicable
    • Ran example app to verify changes
    • E2E tests are passing
    • Required E2E tests have been added (if applicable)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses iOS build failures when LaTeX math rendering (RaTeX via SPM) is enabled, particularly for universal iOS Simulator builds, and fixes a Ruby guard intended to avoid calling spm_dependency when it isn’t available.

Changes:

  • Fixes the spm_dependency availability check in the podspec.
  • Adds simulator EXCLUDED_ARCHS settings when math is enabled to prevent x86_64 simulator module resolution failures.
  • Ignores the example app’s CocoaPods SPM cache directory (.spm.pods) in .gitignore.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/react-native-enriched-markdown/ReactNativeEnrichedMarkdown.podspec Fixes spm_dependency guard and adds simulator arch exclusions when math is enabled.
.gitignore Ignores the example iOS .spm.pods directory produced by CocoaPods/SPM integration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/react-native-enriched-markdown/ReactNativeEnrichedMarkdown.podspec Outdated
Comment thread packages/react-native-enriched-markdown/ReactNativeEnrichedMarkdown.podspec Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated no new comments.

@eszlamczyk eszlamczyk merged commit 99dfc50 into main Jul 9, 2026
10 checks passed
@eszlamczyk eszlamczyk deleted the fix/527-ios-simulator-build branch July 9, 2026 15:05
@eszlamczyk eszlamczyk mentioned this pull request Jul 10, 2026
6 tasks
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.

iOS RaTeX math dependency breaks x86_64 simulator builds in react-native-enriched-markdown >= 0.7

2 participants