From b1ad9b26741bb19788759e395cdc5e55f38c8b24 Mon Sep 17 00:00:00 2001 From: Christian Falch Date: Fri, 17 Jul 2026 10:01:51 +0200 Subject: [PATCH 1/2] fix(iOS): replace racy RaTeXFFI modulemap-strip script with explicit-modules opt-out Xcode materializes the RaTeX binary target's module.modulemap into both the platform-wide products dir and the pod's own build dir. Xcode 26's default explicit-modules dependency scanner hard-errors on the duplicate ("redefinition of module 'RaTeXFFI'"), and the before_compile script that sed-stripped one copy races the scanner: it loses on Xcode 26.3 (the nightly-tests failure against react-native 0.88.0-nightly-20260717) and only happens to win on 26.6. Opt the pod target out of explicit modules via pod_target_xcconfig instead - implicit modules tolerate the duplicate definition, no build products need patching mid-build, and the fix is declarative and works on every React Native version. Drop the now-redundant strip script; the signature-dedup phase stays. Co-Authored-By: Claude Opus 4.8 --- .../ReactNativeEnrichedMarkdown.podspec | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/packages/react-native-enriched-markdown/ReactNativeEnrichedMarkdown.podspec b/packages/react-native-enriched-markdown/ReactNativeEnrichedMarkdown.podspec index 4d31a7af..5a856361 100644 --- a/packages/react-native-enriched-markdown/ReactNativeEnrichedMarkdown.podspec +++ b/packages/react-native-enriched-markdown/ReactNativeEnrichedMarkdown.podspec @@ -61,6 +61,18 @@ Pod::Spec.new do |s| 'DEFINES_MODULE' => 'YES' } + if enable_math + # Xcode materializes the RaTeX binary target's module.modulemap into BOTH + # the platform-wide products dir and this pod's own build dir, and both are + # on this target's search paths. Xcode 26's default explicit-modules + # dependency scanner hard-errors on the duplicate ("redefinition of module + # 'RaTeXFFI'"); stripping the modulemap from a script phase races the + # scanner (loses on Xcode 26.3, happens to win on 26.6). Implicit modules + # tolerate the duplicate definition, so opt this target out of explicit + # modules instead of patching build products mid-build. + pod_xcconfig['SWIFT_ENABLE_EXPLICIT_MODULES'] = 'NO' + end + # Detect Apple Silicon on the host running `pod install`. `sysctl hw.optional.arm64` # reports the real hardware even under a Rosetta-translated Ruby, unlike `uname -m`. apple_silicon = `sysctl -n hw.optional.arm64 2>/dev/null`.strip == '1' @@ -81,22 +93,13 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = pod_xcconfig if enable_math - # React Native's spm_dependency generates a module.modulemap at - # ${BUILT_PRODUCTS_DIR}/include/ that re-declares RaTeXFFI, but the RaTeX - # XCFramework already ships its own definition. Strip the duplicate to - # prevent "redefinition of module 'RaTeXFFI'" during compilation. + # NOTE: the RaTeXFFI duplicate-modulemap problem is handled via + # SWIFT_ENABLE_EXPLICIT_MODULES=NO in pod_xcconfig above. The previous + # approach (a before_compile script sed-stripping the duplicate out of the + # platform products dir) mutated a build product mid-build and raced the + # explicit-modules dependency scanner: on Xcode 26.3 the scanner reads the + # modulemap before the script phase's edit and the build fails anyway. s.script_phases = [ - { - name: 'Fix RaTeXFFI Module Redefinition', - script: <<~'SCRIPT', - # The shared module.modulemap lives in the platform build-products dir, - # one level above the per-target BUILT_PRODUCTS_DIR that CocoaPods sets. - MODULEMAP="${BUILT_PRODUCTS_DIR}/../include/module.modulemap" - [ -f "$MODULEMAP" ] || exit 0 - sed -i '' -E '/^(framework )?module RaTeXFFI /,/^\}/d' "$MODULEMAP" - SCRIPT - execution_position: :before_compile - }, { name: 'Dedupe RaTeX XCFramework Signature', script: <<~'SCRIPT', From 0f34b3d11f4ce58a90656ad0ce525bf8d19bff4a Mon Sep 17 00:00:00 2001 From: Gregory Moskaliuk Date: Fri, 17 Jul 2026 13:24:45 +0200 Subject: [PATCH 2/2] ci: bump Xcode from 26.3 to 26.6 for iOS build The explicit-modules fix in the podspec requires Xcode 26.6 where the Clang dependency scanner correctly respects SWIFT_ENABLE_EXPLICIT_MODULES. On 26.3 the scanner still hard-errors on the duplicate RaTeXFFI modulemap. Co-authored-by: Cursor --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e5435ad..8841c876 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -148,7 +148,7 @@ jobs: - name: Set up Xcode uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0 with: - xcode-version: '26.3' + xcode-version: '26.6' - name: Reset build folder and pods run: rm -rf apps/react-native-example/build apps/react-native-example/ios/Pods apps/react-native-example/ios/Podfile.lock