facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.22k stars 24.33k forks source link

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

Closed iArchin closed 1 year ago

iArchin commented 1 year ago

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:

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

github-actions[bot] commented 1 year ago
:warning: Newer Version of React Native is Available!
:information_source: 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.
github-actions[bot] commented 1 year ago
:warning: Missing Reproducible Example
:information_source: 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.
cortinico commented 1 year ago

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?

iArchin commented 1 year ago

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.2to 0.72.3 with XCode 14.2 it solved.

cortinico commented 1 year ago

Closing as solved

592da commented 10 months ago

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.
CapleaIonut-Alexandru commented 9 months ago

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

andres-dos-santos commented 9 months ago

same here

paulschreiber commented 9 months ago

@592da Did you figure this out for 0.73.x?

nagasailokesh-toddle commented 9 months ago

same issue. Somebody know how to fix it?

Mahdisaghroun commented 9 months ago
Screenshot 2024-02-12 at 09 38 43

react-native: 0.73.4

Import of module 'glog.glog.log_severity' appears within namespace 'google'

paulschreiber commented 9 months ago

@kelset Any suggestions? This is still a problem in 0.73.4 for several folks. (Previously: #38294)

See details in our GitHub actions log.

kelset commented 9 months ago

@paulschreiber I'm currently not on the release crew but I would recommend opening a new issue that provides a repro so that the team can look into this issue and why it keeps resurfacing

paulschreiber commented 9 months ago

@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:

Victor-Nyagudi commented 9 months ago

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

codding123vbf commented 8 months ago

Closing as solved

im still getting this error

codding123vbf commented 8 months ago

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

it didnt fix my error man...

codding123vbf commented 8 months ago

after installing pods and running my project on xcode i started getting this error and its not solved yet my xcode version is 14.0.1...pls help

codding123vbf commented 8 months ago

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

paulschreiber commented 8 months ago

@codding123vbf what was your fix? My fix was upgrading my GitHub runner form macos-12 to macos-14.

barrownicholas commented 6 months ago

If you're using a github action, it seems that macos-latest is still on v12 (despite the Docs saying otherwise); just use:

jobs:
  build:
    name: build
    runs-on: macos-14

Edit: based on @paulschreiber 's suggestion (many thanks for this @paulschreiber !!!)

barrownicholas commented 6 months ago

For visibility, I documented this a bit better here on SO: https://stackoverflow.com/a/78359974/14717625

bhandanyan-nomad commented 1 day ago

I'm getting this error for the first time on react-native v0.76.1