expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
https://docs.expo.dev
MIT License
33.39k stars 5.34k forks source link

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

Closed zhiqingchen closed 10 months ago

zhiqingchen commented 10 months ago

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

tsapeta commented 10 months ago

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.

zhiqingchen commented 10 months ago

i don't have expo-modules-core package in the dependencies. After using macos-13, there is no longer this problem.

chanphiromsok commented 9 months ago

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)

normenster commented 9 months ago

I have a similar issue - no expo-modules-core in dependencies. Error after pod install: The Swift pod ExpoModulesCore depends upon RCT-Folly.common, 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.

it works if i use my package.json deps with a fresh expo sdk 50 bare-minimum project. I think its something in my iOS / xcode setup.

zhiqingchen commented 9 months ago

Have you tried using the new version of xcode?

roebuk commented 9 months ago

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"
}
normenster commented 9 months ago

Have you tried using the new version of xcode?

Yes, makes no difference.

muhamad-rizki commented 9 months ago

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

fossage commented 9 months ago

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.

normenster commented 9 months ago

@fossage I`m on XCode 15 and it works in a fresh expo sdk bare-minimum repo. I stopped upgrading, i will give it another try soon.

fossage commented 9 months ago

@normenster just out of curiosity, what do you get when you run xcodebuild -version and xcode-select --version?

GJKrupa commented 8 months ago

I was having the same issue building with Microsoft Visual Studio App Center. It works when I switch to building with MacOS 13/XCode 15.1 but that configuration is in a 'preview' state on App Center and the latest stable configuration is MacOS 12.7.2/XCode 14.2.

normenster commented 8 months ago

@fossage i currently switched to a new M3, but didnt tried the update again yet. I will keep you updated when I give it another try.

tmKnight01 commented 8 months ago

i was have the same issue MacOS 13.2.1/ Xcode 14.2 version

`[!] 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.`

karlhorky commented 8 months ago

@zhiqingchen did you get this working eventually for your project?

It seems like the GitHub Actions runs are succeeding on your 0.73.0 branch:

Was your only change to change the runner to runs-on: macos-13?

zhiqingchen commented 8 months ago

@karlhorky yes

pod install error (tag v0.73.0-5) log: https://github.com/NervJS/taro-native-shell/actions/runs/7204271154/job/19625441734

pod install success(tag v0.73.0-6) log: https://github.com/NervJS/taro-native-shell/actions/runs/7206623790/job/19631822473

diff: https://github.com/NervJS/taro-native-shell/compare/v0.73.0-5...v0.73.0-6

only change to change the runner to runs-on: macos-13!

kuzkokov commented 8 months ago

hey, @tsapeta so it seems that the issue has nothing to do with expo-modules-core, and instead it somehow connected to the XCode version. would it be possible to re-open it?

tsapeta commented 8 months ago

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?

kuzkokov commented 8 months ago

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

normenster commented 8 months ago

@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).

anis-18 commented 8 months ago

did anyone find a solution how to run it in macos 12 and xcode 14.2 ?

tsapeta commented 8 months ago

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"?

anis-18 commented 8 months ago

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"?

It's working, i tried it , thanks

chanphiromsok commented 8 months ago

M1 and intel Xcode 15 are work fine for Xcode14 I got an error glog on SDK50 the same project build on 3diff mac machine

kuzkokov commented 8 months ago

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

7dp commented 8 months ago

I am experiencing this issue too. Changing "DEFINES_MODULE" => should_define_modules to "DEFINES_MODULE" => "YES" solve it.

So, this mean i should local patch my react-native dep, folks?

P.S: I am running XCode 14.1, and this error happen after i initialize a new Expo project using Dan's create-expo-stack, and when i run yarn expo prebuild --clean.

tsapeta commented 8 months ago

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 😞

7dp commented 8 months ago

Yea my Mac doesn't meet the criteria to use XCode 15 (😭), and i ended up patching my lovely react-native dep although it feels bad. If you guys has a capability to really fix this issue, I will appreciate that so much 🥹.

Keanu2431 commented 8 months ago

Hello @tsapeta , I was running the command RCT_NEW_ARCH_ENABLED=1 bundle exec pod install and was getting this error

"The Swift pod ExpoModulesCore depends upon RCT-Folly.common, 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."

I used a spin-off of the working solution here, to modify my node_modules/react-native/third-party-podspecs/RCT-Folly.podspec and add the line “DEFINES_MODULE" => “YES”. This got it working but I have one question.

You say that this is a workaround for Xcode <14.3 however I'm running Xcode 15 on a M1 MacBook Pro, so I'm under the impression that this is an error "exclusive" to versions <14.3 however I'm experiencing it myself. If possible I'd like to not patch my react-native dependency.

Do you have any suggestions for me? Is it possible that this is because of my RN version?

System: OS: macOS 14.2.1 CPU: (8) arm64 Apple M1 Pro Memory: 82.20 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.10.0 path: /opt/homebrew/opt/node@20/bin/node Yarn: version: 1.22.21 path: /opt/homebrew/bin/yarn npm: version: 10.2.3 path: /opt/homebrew/opt/node@20/bin/npm Watchman: version: 2023.12.04.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.14.3 path: /Users/keanu/.rvm/gems/ruby-3.2.0/bin/pod SDKs: iOS SDK: Platforms:

7dp commented 8 months ago

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.

kuzkokov commented 8 months ago

hey, @7dp it happens not only with expo-sdk, but with some other libs that define modules as well. check out this comment.

btw, can you try to install latest cocoapods (1.15.2) and then install pods again? it seems that upgrading cocapods helped me with this issue

7dp commented 8 months ago

Thanks for the suggestion @kuzkokov! I followed your advice to upgrade Cocoapods (1.15.2), but no luck when i try to install my RN project pods. Still errors.

amiroucheoussama commented 7 months ago

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.

andy380743909 commented 7 months ago

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'
sidvenu commented 7 months ago

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

michaelvdang commented 6 months ago

@sidvenu where can I find the Podfile? I've read it is in the project root directory but I don't see it anywhere (if it helps, I'm using VSCode and the built-in terminal) and I only have a starter project. I'm new to Expo and iOS dev.

alexjegor commented 6 months ago

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.

sniperosx commented 6 months ago

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 🤪

CostinBiserica commented 5 months ago

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

This solved the issue for me.

vishaljnimblechapps commented 5 months ago

@CostinBiserica Not working for me. I'm using the 2046 version. The pod has been installed properly after that I'm getting the error while installing the build.

Does anyone have a solution that is working and not mentioned here?

wkbia commented 5 months ago

@vishaljnimblechapps for me the issue was "expo": "^51.0.0". It did come with ExpoModulesCore 1.12.10 (was 1.11.13). I lowered the version to "expo": "^50.0.0" in the package.json and it solved the issue.

olofd commented 5 months ago

Same here. Issue happens on "expo": "^51.0.0" downgrading to "expo": "^50.0.0" makes it go away.

My error was:

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

The Swift pod ExpoModulesCore depends upon React-jsinspector, 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.

vishaljnimblechapps commented 5 months ago

@wkbia I am using only "expo": "^50.0.0" but still getting issues while installing pods.

@olofd If I use use_modular_headers! or :modular_headers => true method then pods will be installed successfully but getting run time errors.

wkbia commented 5 months ago

@vishaljnimblechapps can you check the ExpoModulesCore version in your Podfile.lock? Mine is 1.11.13 now but was 1.12.10 and I believe that was an issue for me.

vishaljnimblechapps commented 5 months ago

@wkbia I have 1.11.13 version. can you please suggest now how to resolve this ?

wkbia commented 5 months ago

@vishaljnimblechapps double check if you don't have expo-modules-core in your dependencies in package.json. If yes, remove it.

vishaljnimblechapps commented 5 months ago

@wkbia I don't have expo-modules-core in package.json. Even though I downgraded the expo version to ^49.0.0, still got the same error while installing pods after cleaning everything.

wkbia commented 5 months ago

@vishaljnimblechapps one last suggestion is to use yarn instead of npm.

ljukas commented 5 months ago

For me the problem was that I created a new expo module which depended on expo-modules-core. This dependency in my monorepo seems to have tainted my node-modules folder. By removing that dependenncy and instead using it via the expo peer dependency the error was removed for me

vishaljnimblechapps commented 5 months ago

@wkbia I'm already using yarn. I would like to give you more detail that I have a react-native-cli project which has react-native 0.73.6 version and then I'm trying to install expo using install-expo-modules.