Yadhu Krishna
Yadhu Krishna

Reputation: 368

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

I know this is duplicated, since the answered solution doesn't work for me, I'm asking again in case someone has come up with any new solution...

Already tried:

Unlinked all auto-linked modules and manually specified them in pod file.

Also tried

use_modular_headers!

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

Any suggestion is much appreciated.

Upvotes: 17

Views: 13810

Answers (4)

Nicholas Barrow
Nicholas Barrow

Reputation: 736

I was getting this error in a GitHub action, using:

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

I stumbled on this discussion, and a comment by @paulschreiber

My fix was upgrading my GitHub runner form macos-12 to macos-14.

Here's the wird thing: according to the GH Docs, this was in spite of the GH docs specifying that macos-latest and macos-14 being the same (they're not!!!). It seems like macos-latest is using an older version of xcode (14.1) where the bug exists (see here, the bug exists only < 14.3); using macos-14 fixed my error:

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

Upvotes: 0

Christian Peters
Christian Peters

Reputation: 109

I actually battled with this problem all night, eventually I cd into /ios/Pods/Headers/Public/glog/glog/logging.h

Then I changed

FROM

  • #include "glog/log_severity.h"
  • #include "glog/vlog_is_on.h"

TO

  • #include "glog/glog/log_severity.h"

  • #include "glog/glog/vlog_is_on.h"

  • force overwite

  • Save

  • then: npx expo run:ios again to restart

Upvotes: 6

Vicktor
Vicktor

Reputation: 368

After lots of digging, I suspected maybe the module being imported may be in a separate folder, so I double checked my folder structure to make sure everything was okay.

Here's what I found.

glog folder structure

log_severity.h is in a subfolder named glog, so I changed the import statement to import from the subfolder, and this worked for me.

#include "glog/glog/log_severity.h"

I did the same for any other import statements trying to import modules found in the glog subfolder.

I got a warning while doing so saying the file is read-only, but I chose to overwrite it anyway, and the project built succesfully.

Upvotes: 10

VecopWall
VecopWall

Reputation: 677

I also struggled with that issue and found came up with the solution. Actually, I tried the same thing as you did but I found it wrong.

use_modular_headers!

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

Adding this didn't solve the issue but I added only glog one and it worked. I mean

use_modular_headers!

pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false
Adding only above code snippet solved the issue.

Upvotes: 21

Related Questions