Skip to content

iOS build fails since 0.37.0 without use_frameworks! on RN <= 0.83: import of module 'glog.glog.log_severity' appears within namespace 'google' — could not build module 'NitroModules' #1573

Description

@mfazekas

How were you trying to build the app?

Any bare React Native app on RN <= 0.83 with CocoaPods static libraries (the default, no use_frameworks!) fails to build for iOS since react-native-nitro-modules 0.37.0 (still broken in 0.37.1). No nitro library is needed - nitro's own Swift files are enough to trigger it.

Repro:

  1. npx @react-native-community/cli init TestApp --version 0.80.3
  2. npm install react-native-nitro-modules@0.37.1
  3. cd ios && pod install && xcodebuild -workspace TestApp.xcworkspace -scheme TestApp -sdk iphonesimulator build

The first failing step is SwiftEmitModule normal arm64 Emitting module for NitroModules. A faster targeted check is building just the pod target: xcodebuild -project Pods/Pods.xcodeproj -target NitroModules -sdk iphonesimulator -configuration Debug build (fails identically).

0.36.5 builds fine in the same app; 0.37.0 and 0.37.1 fail.

Root cause: 0.37.0 (#1517 and friends) added ReactProp.hpp, ViewComponentDescriptor.hpp and ViewPropsHolderState.hpp to public_header_files, so they are part of the CocoaPods-generated NitroModules clang modulemap (the podspec sets DEFINES_MODULE => YES). When Swift imports NitroModules, clang compiles every umbrella header as part of the module; those three headers include <react/renderer/*> headers which reach <glog/logging.h>. React Native <= 0.83 builds glog from source with DEFINES_MODULE => YES, and glog's logging.h does #include "glog/log_severity.h" from inside namespace google - fine textually, but a hard clang error once it becomes a module import. React Native 0.84+ ships a hand-written textual-headers glog modulemap exactly to avoid this (see scripts/ios-configure-glog.sh in RN 0.84), which is why newer RN versions - and the nitro example app - don't see it. #1521 fixed the sibling use_frameworks!/cxxreact variant only; the renderer includes are still in the modulemap.

Swift never uses these C++ view types (only nitrogen-generated C++ includes them, textually), so they don't need to be in the Swift-facing modulemap at all.

I'm opening two PRs: one that pins this in CI (builds the NitroModules pod inside a bare RN 0.80.3 app, red on main), and one with a fix (hide the three renderer-including headers from the NitroModules module via __building_module(), keeping them fully includable from C++ - verified to turn the repro green, A/B/A tested).

As a control experiment: stripping glog's -fmodule-map-file flag from the generated pod xcconfigs (making glog a textual include again) also makes 0.37.x build - confirming the modulemap interaction is the whole problem.

Full build logs

SwiftEmitModule normal arm64 Emitting module for NitroModules (in target 'NitroModules' from project 'Pods')

~/TestApp/ios/Pods/Headers/Public/glog/glog/logging.h:512:1: error: import of module 'glog.glog.log_severity' appears within namespace 'google'
#include "glog/log_severity.h"
^
~/TestApp/ios/Pods/Headers/Public/glog/glog/logging.h:509:1: note: namespace 'google' begins here
namespace google {
^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "NitroModules-umbrella.h"
        ^
~/TestApp/ios/Pods/Headers/Public/NitroModules/NitroModules-umbrella.h:32:9: note: in file included from ~/TestApp/ios/Pods/Headers/Public/NitroModules/NitroModules-umbrella.h:32:
#import "ReactProp.hpp"
        ^
~/TestApp/ios/Pods/Headers/Public/NitroModules/ReactProp.hpp:15:10: note: in file included from ~/TestApp/ios/Pods/Headers/Public/NitroModules/ReactProp.hpp:15:
#include <react/renderer/core/RawProps.h>
         ^
~/TestApp/ios/Pods/Headers/Public/React-Fabric/react/renderer/core/RawProps.h:16:10: note: in file included from ~/TestApp/ios/Pods/Headers/Public/React-Fabric/react/renderer/core/RawProps.h:16:
#include <react/renderer/core/PropsParserContext.h>
         ^
~/TestApp/ios/Pods/Headers/Public/React-Fabric/react/renderer/core/PropsParserContext.h:13:10: note: in file included from ~/TestApp/ios/Pods/Headers/Public/React-Fabric/react/renderer/core/PropsParserContext.h:13:
#include <react/utils/ContextContainer.h>
         ^
~/TestApp/ios/Pods/Headers/Public/React-utils/react/utils/ContextContainer.h:18:10: note: in file included from ~/TestApp/ios/Pods/Headers/Public/React-utils/react/utils/ContextContainer.h:18:
#include <react/debug/react_native_assert.h>
         ^
~/TestApp/ios/Pods/Headers/Public/React-debug/react/debug/react_native_assert.h:54:10: error: could not build module 'glog'
#include <glog/logging.h>
         ^
<unknown>:0: error: could not build Objective-C module 'NitroModules'

** BUILD FAILED **

After the NitroModules pod target fails, the same three errors repeat in every pod whose Swift code imports NitroModules.

Project dependencies

"dependencies": {
  "react": "19.1.0",
  "react-native": "0.80.3",
  "react-native-nitro-modules": "0.37.1"
}

Nitro Modules Version

0.37.1 (also 0.37.0; 0.36.5 is fine)

Nitrogen Version

not used (no nitro library needed to reproduce)

Target platforms

iOS

Operating system

MacOS

Can you build the Nitro Modules Example app?

Yes, I can successfully build the Example app here

(The example can't reproduce this: it runs React Native 0.85, whose glog ships the textual-headers modulemap. I verified the example also builds fine with RCT_USE_RN_DEP=0 / RCT_USE_PREBUILT_RNCORE=0, i.e. glog built from source, on RN 0.85. The break requires RN <= 0.83.)

Additional information

Environment: Xcode 26.5/26.6, CocoaPods 1.16.2, iOS simulator arm64. Related: #1520 (the use_frameworks! + cxxreact sibling), #1521 (its fix - does not cover this), #1517 (where the headers became public).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions