Skip to content

iOS build error: Import of module 'glog.glog.log_severity' appears within namespace 'google' #41045

Description

@iArchin

Description

I already know that there are other similar issues of this with multiple way of fix but I'm pretty sure that I have tried them but not worked. this is how my pod file looks:

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

pod 'GoogleUtilities', :modular_headers => true

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
$RNMapboxMapsImpl = 'mapbox'

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'myAwesomeApp' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'myAwesomeAppTests' do
    inherit! :complete
    # Pods for testing
  end

  pre_install do |installer|
    $RNMapboxMaps.pre_install(installer)
  end

  post_install do |installer|
    $RNMapboxMaps.post_install(installer)
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

my package.json file:


{
  "name": "myAwesomeApp",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
    "start": "react-native start",
    "test": "jest",
    "postinstall": "patch-package"
  },
  "dependencies": {
    "@gorhom/bottom-sheet": "^4",
    "@microsoft/signalr": "^7.0.7",
    "@react-native-async-storage/async-storage": "^1.18.2",
    "@react-native-community/slider": "^4.4.2",
    "@react-native-firebase/app": "^18.0.0",
    "@react-native-firebase/auth": "^18.3.0",
    "@react-native-firebase/messaging": "^18.0.0",
    "@react-native/metro-config": "^0.72.11",
    "@react-navigation/bottom-tabs": "^6.5.7",
    "@react-navigation/native": "^6.1.6",
    "@react-navigation/native-stack": "^6.9.12",
    "@react-navigation/stack": "^6.3.16",
    "@reduxjs/toolkit": "^1.9.5",
    "@rnmapbox/maps": "^10.0.12",
    "@sentry/react-native": "^5.11.0",
    "@shopify/flash-list": "^1.5.0",
    "axios": "^1.4.0",
    "dotenv": "^16.3.1",
    "lodash.debounce": "^4.0.8",
    "moment": "^2.29.4",
    "qs": "^6.11.2",
    "react": "18.2.0",
    "react-native": "0.72.2",
    "react-native-calendar-picker": "^7.1.4",
    "react-native-config": "^1.5.1",
    "react-native-confirmation-code-field": "^7.3.1",
    "react-native-fast-image": "^8.6.3",
    "react-native-feather": "^1.1.2",
    "react-native-geolocation-service": "^5.3.1",
    "react-native-gesture-handler": "^2.10.2",
    "react-native-gradle-plugin": "^0.71.19",
    "react-native-image-viewing": "^0.2.2",
    "react-native-linear-gradient": "^2.7.3",
    "react-native-modal": "^13.0.1",
    "react-native-reanimated": "^3.3.0",
    "react-native-reanimated-carousel": "^3.4.0",
    "react-native-safe-area-context": "^4.5.3",
    "react-native-screens": "^3.20.0",
    "react-native-shared-element": "^0.8.8",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-svg": "^13.9.0",
    "react-native-toast-message": "^2.1.6",
    "react-navigation-shared-element": "^3.1.3",
    "react-query": "^3.39.3",
    "react-redux": "^8.1.0",
    "redux": "^4.2.1",
    "redux-persist": "^6.0.0",
    "remove": "^0.1.5"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native-community/eslint-config": "^3.2.0",
    "@tsconfig/react-native": "^3.0.2",
    "@types/jest": "^29.5.2",
    "@types/lodash.debounce": "^4.0.7",
    "@types/react": "^18.2.8",
    "@types/react-native-calendar-picker": "^7.0.3",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.2.1",
    "babel-plugin-module-resolver": "^5.0.0",
    "eslint": "^8.19.0",
    "eslint-plugin-import": "^2.27.5",
    "jest": "^29.2.1",
    "metro-react-native-babel-preset": "0.73.9",
    "patch-package": "^7.0.2",
    "postinstall-postinstall": "^2.1.0",
    "prettier": "^2.4.1",
    "react-native-flipper": "^0.211.0",
    "react-test-renderer": "18.2.0",
    "redux-flipper": "^2.0.2",
    "typescript": "^5.1.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

React Native Version

0.72.2

Output of npx react-native info

System:
OS: macOS 12.7
CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
Memory: 27.18 MB / 8.00 GB
Shell:
version: 5.8.1
path: /bin/zsh
Binaries:
Node:
version: 18.18.1
path: /usr/local/bin/node
Yarn:
version: 1.22.19
path: /usr/local/bin/yarn
npm:
version: 9.8.1
path: /usr/local/bin/npm
Watchman:
version: 2023.10.09.00
path: /usr/local/bin/watchman
Managers:
CocoaPods:
version: 1.13.0
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 22.2
- iOS 16.2
- macOS 13.1
- tvOS 16.1
- watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode:
version: 14.2/14C18
path: /usr/bin/xcodebuild
Languages:
Java: Not Found
Ruby:
version: 2.7.0
path: /Users/mac/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

Steps to reproduce

I provide my RN version and my packages also cocoapods version and ruby.

Snack, screenshot, or link to a repository

Screenshot from 2023-10-18 11-06-16

Activity

  1. github-actions commented on Oct 18, 2023

    @github-actions
    ⚠️ Newer Version of React Native is Available!
    ℹ️ You are on a supported minor version, but it looks like there's a newer patch available - 0.72.6. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
  2. added
    Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.
    on Oct 18, 2023
  3. github-actions commented on Oct 18, 2023

    @github-actions
    ⚠️ Missing Reproducible Example
    ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
    • If your bug is UI related: a Snack
    • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
  4. cortinico commented on Oct 18, 2023

    @cortinico
    Contributor

    I already know that there are other similar issues of this with multiple way of fix but I'm pretty sure that I have tried them but not worked. this is how my pod file looks:

    Which other issues are you referring to?

  5. iArchin commented on Oct 18, 2023

    @iArchin
    Author

    I already know that there are other similar issues of this with multiple way of fix but I'm pretty sure that I have tried them but not worked. this is how my pod file looks:

    Which other issues are you referring to?

    I meant This and #26217.
    but actually I found the solution in #38294. I upgrade my RN version from 0.72.2 to 0.72.3 with XCode 14.2 it solved.

  6. cortinico commented on Oct 24, 2023

    @cortinico
    Contributor

    Closing as solved

  7. added
    Resolution: AnsweredWhen the issue is resolved with a simple answer
    and removed
    Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.
    on Oct 24, 2023
  8. 592da commented on Jan 7, 2024

    @592da

    Also happened to me with 0.73.1
    XCode 14.3
    @cortinico any thoughts?

    In file included from /Users/.../packages/app/node_modules/react-native/ReactCommon/react/utils/RunLoopObserver.cpp:10:
    In file included from /Users/.../packages/app/ios/Pods/Headers/Public/React-debug/react/debug/react_native_assert.h:52:
    /Users/.../packages/app/ios/Pods/Headers/Public/glog/glog/logging.h:512:1: fatal error: import of module 'glog.glog.log_severity' appears within namespace 'google'
    #include "glog/log_severity.h"
    ^
    /Users/.../packages/app/ios/Pods/Headers/Public/glog/glog/logging.h:509:1: note: namespace 'google' begins here
    namespace google {
    ^
    1 error generated.
    
  9. CapleaIonut-Alexandru commented on Feb 7, 2024

    @CapleaIonut-Alexandru

    I have the same issue on my expo project. Somebody know how to fix it ?

  10. 26 remaining items

  11. anujsachan1990 commented on May 8, 2025

    @anujsachan1990

    I’m running into the same issue—it’s appeared across several versions already. Because I have to build with the -fcxx-modules flag for third-party compatibility, I can’t avoid it. Is there any fix or workaround?

    Would you happen to know which third party needs -fcxx-modules flag? If yes check their latest on the React Native version you are using, if they have a different way of implementation

  12. vinova-vito commented on May 13, 2025

    @vinova-vito

    Would you happen to know which third party needs -fcxx-modules flag? If yes check their latest on the React Native version you are using, if they have a different way of implementation

    the third-party library is a vendor-custom iOS framework that uses @import. The project won’t build unless I pass the -fcxx-modules flag. I’m currently on React Native 0.79.1.

  13. ankitpunchh commented on May 21, 2025

    @ankitpunchh

    Would you happen to know which third party needs -fcxx-modules flag? If yes check their latest on the React Native version you are using, if they have a different way of implementation

    the third-party library is a vendor-custom iOS framework that uses @import. The project won’t build unless I pass the -fcxx-modules flag. I’m currently on React Native 0.79.1.

    Did you got a fix. Facing same issue for weeks updating to version 0.79.2

  14. ankitpunchh commented on May 22, 2025

    @ankitpunchh

    Hello everyone,

    I encountered this issue while upgrading to React Native 0.79.2. I resolved it by removing -fcxx-modules from the build settings. However, this caused errors in libraries that depend on -fcxx-modules.

    I updated most of the affected libraries, but one still relies on Objective-C modules. To fix that, I had to replace @import ModuleName with #import <ModuleName/ModuleName.h>. This workaround may vary depending on the specific library you're using.

  15. tw-anuj commented on May 22, 2025

    @tw-anuj

    I am also facing the same issue. React native version - 0.79.0

    Image

    @ankitpunchh @anujsachan1990 Did you guys found any resolution ?

    In my case also, I cannot remove -fcxx-modules as adobe packages are dependent on it.

    This issue should be reopened.

  16. anujsachan1990 commented on May 23, 2025

    @anujsachan1990

    I am also facing the same issue. React native version - 0.79.0

    Image [@ankitpunchh](https://github.com/ankitpunchh) [@anujsachan1990](https://github.com/anujsachan1990) Did you guys found any resolution ?

    In my case also, I cannot remove -fcxx-modules as adobe packages are dependent on it.

    This issue should be reopened.

    Check this: #41045 (comment)

  17. ankitpunchh commented on May 23, 2025

    @ankitpunchh

    I am also facing the same issue. React native version - 0.79.0

    Image [@ankitpunchh](https://github.com/ankitpunchh) [@anujsachan1990](https://github.com/anujsachan1990) Did you guys found any resolution ?

    In my case also, I cannot remove -fcxx-modules as adobe packages are dependent on it.

    This issue should be reopened.

    Hi @tw-anuj , For me it has only compiled when we removed -fcxx-modules. You also have to remove it and for the dependencies which are getting error check for the updates from them.

  18. tw-anuj commented on May 23, 2025

    @tw-anuj

    @anujsachan1990 - I checked that. It's same with me. I am also using Adobe's AEPSDK React Native. and I can't remove that package. If I remove the -fcxx-modules flag,I start getting more issues.

    Any possible fix so that I don't remove -fcxx-modules flag and still this issue gets resolved.?

    @ankitpunchh Did Any other workarounds are not there ?

  19. vinova-vito commented on Jun 10, 2025

    @vinova-vito

    I resolved the issue by adding a script in the Podfile. I haven't found a better solution for now, but you could also try running USE_FRAMEWORKS=1 bundle exec pod install.

    post_install do |installer|
      require 'fileutils'
    
      installer.pods_project.targets.each do |t|
        next unless t.name == 'glog'
        UI.puts "🔧 Processing glog target: #{t.name}"
    
        root    = installer.sandbox.root
        pattern = File.join(root, 'glog', 'src', 'glog', '*.h')
        UI.puts "🔍 Searching for glog header files: #{pattern}"
    
        Dir.glob(pattern).each do |hfile|
          UI.puts "📄 Checking file: #{hfile}"
          FileUtils.chmod 'u+w', hfile
    
          text = File.read(hfile)
          new_text = if File.basename(hfile) == 'raw_logging.h'
            text
              .gsub(/^#include\s+"(?:glog\/)+log_severity\.h".*\n/, '')
              .gsub(%r{(?:glog/)+vlog_is_on\.h},    'glog/glog/vlog_is_on.h')
          else
            text
              .gsub(%r{(?:glog/)+log_severity\.h}, 'glog/glog/log_severity.h')
              .gsub(%r{(?:glog/)+vlog_is_on\.h},    'glog/glog/vlog_is_on.h')
          end
    
          if new_text != text
            File.write(hfile, new_text)
            UI.puts "    ✅ Updated: #{File.basename(hfile)}"
          else
            UI.puts "    ⏭️ No changes needed: #{File.basename(hfile)}"
          end
        end
    
        UI.puts "🔧 Finished processing glog target: #{t.name}\n\n"
      end
    
      react_native_post_install(
        installer,
        config[:reactNativePath],
        :mac_catalyst_enabled => false
      )
    end
    
  20. duncannz commented on Oct 1, 2025

    @duncannz

    The only thing that successfully resolved the issue for me was to remove the usage of glog from react_native_assert.h, using the following code inside the post_install do |installer| block:

    file_path = 'Pods/Headers/Public/React-debug/react/debug/react_native_assert.h'
    lines = File.readlines(file_path)
    lines_to_remove = [
      "#include <glog/logging.h>\n",
      "    LOG(ERROR) << \"react_native_assert failure: \" << #cond; \\\n",
      "    google::FlushLogFiles(google::GLOG_INFO);               \\\n",
    ]
    lines.reject! { |line| lines_to_remove.include?(line) }
    File.open(file_path, 'w') { |f| f.puts lines }
  21. ajeetfancode commented on Oct 27, 2025

    @ajeetfancode

    @duncannz Did you noticed any issues in logging by doing the above said changes?
    Your change successfully resolved mine, just wanted to know any other popped up issues due to this.

  22. quangcao-offerup commented on Dec 19, 2025

    @quangcao-offerup

    I got same error when upgrading react native from 0.77.3 to 0.81.5 or even one minor up as 0.78.3. the project is still under old architecture and AppDelegate.mm that working just fine on 0.77.3. Tried all possible solutions above comment in this thread but not working. hoping someone has better idea to get this working. same many people in here, I could not remove -fcxx-modules flag since many required dependencies need this. when comparing glog(0.3.5) when running react native 0.77 vs 0.78 or 0.81.5, they are the same under Pods folder.
    my project is run with

    • XCode 26.2
    • COCOAPODS: 1.16.2
  23. punith-js commented on Jan 12, 2026

    @punith-js

    @quangcao-offerup, I'm on same boat as you, please let me know if you found a fix?

  24. quangcao-offerup commented on Jan 26, 2026

    @quangcao-offerup

    @punith-js so here what I get it to work by updating Podfile to update build settings and telling cocoapod to not treat glob as a module

    installer.pods_project.targets.each do |target|
          target.build_configurations.each do |config|
                # Fix glob build issue in rn 0.78+ to CocoaPods not to treat glob as a module
                if target.name == 'glog' 
                    config.build_settings['DEFINES_MODULE'] = 'NO'
                end
           end
    end
    
  25. TarasenkoArtem commented on Feb 9, 2026

    @TarasenkoArtem

    Same issue while upgrading rn from 0.77 to 0.81.5

    use_modular_headers!
    pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false

    this solves the issue but brings a lot of new issue.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions