expo: [SDK 50] Pod install error: The Swift pod `ExpoModulesCore` depends upon `glog`, which does not define modules.

Minimal reproducible example

https://github.com/NervJS/taro-native-shell/tree/0.73.0

Summary

error info

[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `ExpoModulesCore` depends upon `glog`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
Error: Process completed with exit code 1.

build action

https://github.com/NervJS/taro-native-shell/actions/runs/7194009870/job/19593603408

Environment

see actionlog

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Reactions: 13
  • Comments: 40 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Hey @zhiqingchen, looks like you have the expo-modules-core package in the dependencies, which is not recommended. That package should only be a transitive dependency of the expo package. By specifying it as your direct dependency, you’re using a different version that is intended to be used with SDK 50. Can you try removing it from your package.json, run yarn again and reinstall pods?

As I’m almost sure it’s the cause of the issue, I’m going to close it beforehand. Let me know if you’re still experiencing it even after going through my instructions.

Hey @zhiqingchen, looks like you have the expo-modules-core package in the dependencies, which is not recommended. That package should only be a transitive dependency of the expo package. By specifying it as your direct dependency, you’re using a different version that is intended to be used with SDK 50. Can you try removing it from your package.json, run yarn again and reinstall pods?

As I’m almost sure it’s the cause of the issue, I’m going to close it beforehand. Let me know if you’re still experiencing it even after going through my instructions.

I also have this issue +1 on expo sdk 50 (I don’t have expo-modules-core in my package.json)

removing node_modules, Pods, then reinstall everything seems works for me

Upgrading Xcode Command Line Tools to 15.1 fixed it for me. To do that, simply remove the old version and install the new one:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

yeah, this issue seems to be from the react native side. setting "DEFINES_MODULE" => "YES" helps.

I’m not fully sure, but I suspect this logic in glog.podspec might be the issue 👇 https://github.com/facebook/react-native/blob/7c5e4262d4657b00e535ce8c6cbf8c69771a79a1/packages/react-native/third-party-podspecs/glog.podspec#L37-L49

Can someone try to set DEFINES_MODULE config to "YES"?

I believe this has something to do with the Xcode version. After updating my project to the latest RN version(0.73.2) and updating Expo from 48 to 50, my builds stopped working on CircleCI due to this error. By bumping the Xcode version from 14.1 to 15, the builds began to work again. I think you actually may only need to go up to 14.2 or 14.3 as it also seemed to work on 14.3 for me(didn’t try 14.2 yet). Unfortunately for us, anything above 14.1 causes issues with our E2E tests, but thats a tale for another repo’s Github issues.

I’m getting the same error on a brand new react-native project. I’ve tried with react native 0.72.8 and 0.73.

I’m following this guide and when I run npx install-expo-modules@latest. I get the following error

The Swift pod `ExpoModulesCore` depends upon `glog`, which does not define modules. 
To opt into those targets generating module maps (which is necessary to import them 
from Swift when building as static libraries), you may set `use_modular_headers!` 
globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.'

For reference, my package.json looks like so

"dependencies": {
    "expo": ">=50.0.0-0 <51.0.0",
    "react": "18.2.0",
    "react-native": "0.73.1"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/babel-preset": "^0.73.18",
    "@react-native/eslint-config": "^0.73.1",
    "@react-native/metro-config": "^0.73.2",
    "@react-native/typescript-config": "^0.73.1",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.6.3",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "18.2.0",
    "typescript": "5.0.4"
}

Upgrading xcodeselect to 2405 and adding use_modular_headers! to my Podfile fixed it for me.

This solved the issue for me.

In case anyone still has problems after this long thread. After about two days of error analysis (because it worked in a fresh project), I deintegrated the pods pod deintegrate, then deleted the Podfile.lock and freshly integrate it (pod install). And lo and behold! It now works as expected. If I had tried that directly 🤪

Actually even “DEFINES_MODULE” => “YES” is giving the possibility to run pod install, but everything breaks when building. I think that expo comes with a lot of problems, for 3 years i decided to not use it, and letting it become more mature, but it seems that it’s not mature yet. for the first time after 3 years, i decided to use expo but i’m having a lot of headache. So my decision is to remove expo totally from my project, even this is too hard to do, so the solution is to init a new react-native-cli project and transfer all my code there.

Hi👋. Just to give some info related to this. This error doesn’t happen on my fresh RN 0.73.4 project. But then when i try to add Expo 50 modules to my app (by running npx install-expo-modules@latest) then this error happen.

So, i think the error does come from the Expo SDK 50 side that *idk somehow affecting the react-native dep, and not from the RN side.

How to reproduce:

  1. Create a new RN project.
  2. Install the iOS pods (At this step it should be successful).
  3. Add Expo 50 modules to the app by running npx install-expo-modules@latest.
  4. Install the iOS pods again and you will see the error
The Swift pod 'ExpoModulesCore' depends upon 'glog', which does not define modules ...

occurs.

This is a workaround for Xcode <14.3, but I would recommend upgrading to 15 anyway. If for some reason you can’t, then yeah, best you can do is to use patch-package 😞

Trying to handle this glog-define-modules problem I ended up having xcode build error:

“ExpoModulesCore” has a minimum deployment target of ios 13.4

where I was using 12.4. Changing minimum ios deployment target finally fixed the problem for me. Hope this helps.

Xcode: 14.2 cocoapods: 1.15.2

manually modify the glob podspec to “DEFINES_MODULE” => “YES” only make the pod install success, but the build failed with errors

/Users/andy/Workspace/ReactNativeApps/AwesomeProject/ios/Pods/Headers/Public/glog/glog/logging.h:512:1: Import of module 'glog.glog.log_severity' appears within namespace 'google'

@tsapeta I found the “error” in my setup. As i said, a clean expo sdk 50 project was working. I had this pod ref in my Podfile: pod 'react-native-google-cast/NoBluetoothArm', path: '../node_modules/react-native-google-cast/

After removing it, pods are getting installed again. So I would suggest to check if a clean expo project builds and then compare with the project that is not woring (libs and podfile config).

yeah, but it’s not only about ci/cd workflows. I can’t install pods locally to run the project on my macOS 12. and yes, not sure about the default, but the latest available XCode version on macOS 12 is 14.2

After reading all the comments, I’m guessing that the problem is with using the old version of Xcode. Looks like changing the workflow to run on macos-13 solved the issue for some people. macos-13 uses Xcode 14.3.1 by default, whereas macos-12 uses Xcode 14.2. Can someone confirm that?