Repository navigation
iOS build error: Import of module 'glog.glog.log_severity' appears within namespace 'google' #41045
Description
Activity
⚠️ 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. - addedNeeds: ReproThis issue could be improved with a clear list of steps to reproduce the issue.This issue could be improved with a clear list of steps to reproduce the issue.
on Oct 18, 2023 ⚠️ 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.
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 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 from0.72.2to0.72.3withXCode 14.2it solved.Closing as solved
Reacted by Luke Brandon Farrell, Carlos Saiz Orteu, Rana-Usama, John Anisere, hamzadevtech1, andres, shyamsingla11, zoomc, Harsh Kumar, oz and 17 more- addedResolution: AnsweredWhen the issue is resolved with a simple answerWhen the issue is resolved with a simple answerand removedNeeds: ReproThis issue could be improved with a clear list of steps to reproduce the issue.This issue could be improved with a clear list of steps to reproduce the issue.
on Oct 24, 2023 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.Reacted by Truong Luu, Roji Philip, CE7, Roman D, Lucas Nicolas Pelloni, Carlos Saiz Orteu, wonkydd, ghatagetejashri and Kushal SainiReacted by QuaOs, odonnellpeter1999, Lucas Nicolas Pelloni, Jaeyoun Nam, Stan SARR, Damian Majsner, TonyYo, afifradzif and Carlos Saiz OrteuI have the same issue on my expo project. Somebody know how to fix it ?
Reacted by Fater726 remaining items
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
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.
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
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.
Reacted by Money JainReacted by Money JainReacted by Money JainI am also facing the same issue. React native version - 0.79.0
@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.
I am also facing the same issue. React native version - 0.79.0
[@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)
I am also facing the same issue. React native version - 0.79.0
[@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.
@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 ?
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 ) endReacted by Andrzej Wielski, Vito and BreezeThe 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 thepost_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 }
Reacted by Sam Ransom, Ajeet Maurya and rankApps@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.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-modulesflag 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
@quangcao-offerup, I'm on same boat as you, please let me know if you found a fix?
@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

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:
my package.json file:
React Native Version
0.72.2
Output of
npx react-native infoSystem:
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