Skip to content

iOS: livekit-react-native-webrtc links no React under dynamic frameworks + prebuilt React-Core (undefined RCTEventEmitter/RCTView/RCTRegisterModule); Swift companion needs the non-modular include allowance #436

Description

@joedeleeuw

Describe the bug

One report covering the two podspecs because the failures are coupled (@livekit/react-native@2.11.1 + @livekit/react-native-webrtc@144.1.1, both re-verified today; podspecs unchanged on main/master).

Under use_frameworks! :linkage => :dynamic with Expo SDK 56's precompiled React-Core (prebuilt React.framework distribution):

  1. livekit-react-native-webrtc builds a dylib that never links React. The podspec declares s.dependency 'React-Core', but with the prebuilt React-Core pod that dependency contributes framework search paths only — no -framework React makes it onto the link line of this pod's dynamic framework. Release builds fail at link time with undefined React symbols referenced by the pod's ObjC sources: RCTEventEmitter, RCTView, RCTRegisterModule (from RCT_EXPORT_MODULE).

  2. With the link fixed, module verification then rejects the pod's non-modular React includes — the longstanding #import <React/RCTConvert.h>-style includes every classic RN pod ships (same class of errors as Android Fails to build #60 shows on livekit/react-native-webrtc: "Include of non-modular header inside framework module 'livekit_react_native_webrtc...'"). The Swift companion pod livekit-react-native compiles the webrtc framework module from Swift, so it needs CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES as well — stock RN pods set exactly this.

To Reproduce

  1. Expo SDK 56 app with expo-build-properties"useFrameworks": "static" off, i.e. dynamic frameworks (use_frameworks! :linkage => :dynamic), precompiled React-Core enabled (SDK 56 default when available).
  2. Add @livekit/react-native + @livekit/react-native-webrtc, pod install, build Release for device.
  3. Link step for livekit-react-native-webrtc.framework fails: undefined symbols RCTEventEmitter, RCTView, RCTRegisterModule.
  4. Add -framework React to that pod (e.g. via post_install) and rebuild → non-modular-header module verification errors surface next, in both pods.

Expected behavior

Both pods build out of the box under dynamic frameworks + prebuilt React-Core.

Suggested fix

We run these podspec changes as local patches; they make the stack build cleanly:

--- a/livekit-react-native-webrtc.podspec
+++ b/livekit-react-native-webrtc.podspec
@@
   # Swift/Objective-C compatibility
   s.pod_target_xcconfig = {
-    'DEFINES_MODULE' => 'YES'
+    'DEFINES_MODULE' => 'YES',
+    # Under a prebuilt React-Core the framework search paths are present but
+    # React is never linked into this dylib, leaving
+    # RCTEventEmitter/RCTView/RCTRegisterModule undefined at link time.
+    'OTHER_LDFLAGS' => '$(inherited) -framework React',
+    # The (upstream, longstanding) non-modular React header includes are the
+    # same includes every classic RN pod ships. Match the stock RN pod settings.
+    'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES'
   }
--- a/livekit-react-native.podspec
+++ b/livekit-react-native.podspec
@@
   # Swift/Objective-C compatibility
-  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
+  s.pod_target_xcconfig = {
+    # Its webrtc dependency's framework module carries non-modular React
+    # includes; allow them when this Swift pod builds that module.
+    'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
+    'DEFINES_MODULE' => 'YES' }

Notes:

  • Guarding -framework React behind an env/React-Core-variant check may be desirable if plain (non-prebuilt) React-Core setups need -framework React-Core instead; in our testing $(inherited) -framework React is what the prebuilt distribution requires.
  • Locally we additionally set ENABLE_MODULE_VERIFIER=NO on both pods; that part is our own choice for build-time reasons and deliberately not part of this ask — the allowance flag above is what stock RN pods use.

Device Info:

  • iOS, Release device builds (Xcode 26/27 toolchains)
  • Expo SDK 56 / React Native 0.85, new architecture, dynamic frameworks, precompiled React-Core
  • @livekit/react-native 2.11.0–2.11.1, @livekit/react-native-webrtc 144.1.0–144.1.1

Related: livekit/react-native-webrtc#60 (the non-modular-header symptom, reported against static-frameworks setups).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions