react-native: iOS build error: Import of module 'glog.glog.log_severity' appears within namespace 'google'

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® Core™ 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

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 22 (6 by maintainers)

Most upvoted comments

i have fixed this issue …if anyone is still facing this issue reach me i will help u with it

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.

Closing as solved

If you’re still experiencing this issue, consider trying this StackOverflow answer.

@kelset I don’t have time to write up a new mini app with a repo case. I did get this working eventually by upgrading the GitHub actions runner from macos-latest (macOS 12) to macos-14.

Things I tried that worked, but weren’t necessary:

  • upgrading to Xcode 15
  • disabling flipper
  • using use_frameworks! :linkage => :static