Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expo-modules][expo-dev-client][SDK51] build error with useFrameworks: 'static' #28209

Closed
leonhh opened this issue Apr 15, 2024 · 32 comments · Fixed by #28451 or #28702
Closed

[expo-modules][expo-dev-client][SDK51] build error with useFrameworks: 'static' #28209

leonhh opened this issue Apr 15, 2024 · 32 comments · Fixed by #28451 or #28702
Assignees

Comments

@leonhh
Copy link
Contributor

leonhh commented Apr 15, 2024

Minimal reproducible example

https://github.com/leonhh/expo-reproducer/tree/4120ccfc4de5b1df55e284f76b4fc289339bf9a0

What platform(s) does this occur on?

iOS

Did you reproduce this issue in a development build?

Yes

Summary

Setting useFrameworks to true in combination with the new architecture will cause build errors on iOS:

app.json:

"plugins": [
  [
    "expo-build-properties",
    {
      "ios": {
        "useFrameworks": "static",
        "newArchEnabled": true
      }
    }
  ]
],

The following error:

› Compiling expo-modules-core Pods/ExpoModulesCore » EXJavaScriptWeakObject.mm
› Compiling expo-modules-core Pods/ExpoModulesCore » EXJavaScriptTypedArray.mm
› Compiling expo-modules-core Pods/ExpoModulesCore » EXJavaScriptRuntime.mm

❌  (node_modules/react-native/ReactCommon/cxxreact/JSExecutor.h:15:10)

  13 | #include <cxxreact/NativeModule.h>
  14 | #include <folly/dynamic.h>
> 15 | #include <jsinspector-modern/InspectorInterfaces.h>
     |          ^ 'jsinspector-modern/InspectorInterfaces.h' file not found
  16 | #include <jsinspector-modern/ReactCdp.h>
  17 | 
  18 | #ifndef RN_EXPORT

› Compiling expo-modules-core Pods/ExpoModulesCore » EXJSIUtils.mm
› Compiling expo-modules-core Pods/ExpoModulesCore » EXJSIInstaller.mm
› Compiling expo-modules-core Pods/ExpoModulesCore » EXJSIConversions.mm
› Compiling expo-modules-core Pods/ExpoModulesCore » EXAppDefines.m

Environment

expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.2.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v20.11.0/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
Watchman: 2024.04.08.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
IDEs:
Android Studio: 2023.1 AI-231.9392.1.2311.11330709
Xcode: 15.3/15E204a - /usr/bin/xcodebuild
npmPackages:
expo: ^51.0.0-canary-20240411-55a0085 => 51.0.0-canary-20240411-55a0085
react: 18.2.0 => 18.2.0
react-native: 0.74.0-rc.8 => 0.74.0-rc.8
npmGlobalPackages:
eas-cli: 7.3.0
Expo Workflow: bare

Expo Doctor Diagnostics

✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for issues with metro config
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✖ Check Expo config (app.json/ app.config.js) schema
Unexpected error while running 'Check Expo config (app.json/ app.config.js) schema' check:
TypeError: Cannot read properties of undefined (reading 'schema')
✔ Check that native modules use compatible support package versions for installed Expo SDK
✔ Check that native modules do not use incompatible support packages
✔ Check for legacy global CLI installed locally
✔ Check that packages match versions required by installed Expo SDK
✔ Check native tooling versions
One or more checks failed, indicating possible issues with the project.

@leonhh leonhh added the needs validation Issue needs to be validated label Apr 15, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels Apr 15, 2024
@leonhh leonhh changed the title [expo-modules][SDK51] build error with useFrameworks and new architecture enabled [expo-modules][SDK51] build error with 'useFrameworks' and new architecture enabled Apr 15, 2024
@leonhh leonhh changed the title [expo-modules][SDK51] build error with 'useFrameworks' and new architecture enabled [expo-modules][SDK51] build error with useFrameworks and new architecture enabled Apr 15, 2024
@leonhh
Copy link
Contributor Author

leonhh commented Apr 15, 2024

Also a somewhat related issue #27414 in a different expo package. Both work fine with the old architecture.

@Kudo Kudo added Issue accepted and removed needs review Issue is ready to be reviewed by a maintainer labels Apr 16, 2024
@Kudo Kudo self-assigned this Apr 16, 2024
@expo-bot
Copy link
Collaborator

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@efstathiosntonas
Copy link

efstathiosntonas commented Apr 22, 2024

having the same issue on 51.0.0-preview.0, expo-modules-core@1.12.0 and rn 0.74 stable.

Podfile:

	config = use_native_modules!
	use_frameworks! :linkage => :static

@DarrKing
Copy link

Same issue on "expo": "~50.0.17",

@MartinGambit
Copy link

MartinGambit commented Apr 24, 2024

Same issue with "expo": "^50.0.15" and RN 0.74 after updating RN from "react-native": "^0.73.4" to 0.74.0.

Downgrading solved the issue by removing these dependencies that were installed with RN 0.74:

RCTDeprecation
React-RuntimeApple
React-RuntimeCore
React-RuntimeHermes
React-featureflags
React-jsitracing

@DarrKing
Copy link

In what way did you remove those dependencies @MartinGambit

@MartinGambit
Copy link

MartinGambit commented Apr 24, 2024

@DarrKing Simply by downgrading react-native 0.74.0 back to 0.73.4 and then running pod install which should remove them.

@DarrKing
Copy link

Cool thanks @MartinGambit. Tried this already, didn't work for myself unfortunately.

@MartinGambit
Copy link

MartinGambit commented Apr 24, 2024

Well maybe there is a mismatch with your expo version. i am currently using "expo": "^50.0.15".
Also i would try cleaning build folder in xcode and try rebuilding your app. @DarrKing

@enchorb
Copy link

enchorb commented Apr 24, 2024

Same issue with RN 0.74 and Expo 50.0.17

@tmitchel2
Copy link

Unfortunately seeing this issue also after upgrading to react-native 0.74. In my case static frameworks is requirement for firebase.

@tmitchel2
Copy link

facebook/react-native#42747 seems to be the cause.

add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern')

The"React-jsinspector" pod will only be included if the framework_name is 'jsinspector_modern' ?

@tmitchel2
Copy link

And looks like it is being attended to on #27976

@MartinGambit
Copy link

Unfortunately seeing this issue also after upgrading to react-native 0.74. In my case static frameworks is requirement for firebase.

Yea same here

@leonhh
Copy link
Contributor Author

leonhh commented Apr 24, 2024

Please be aware that expo does not officially support react-native 0.74 yet. Support for 0.74 will most certainly only come out for SDK 51 and not for SDK 50.

@QuentinDanjou
Copy link

@leonhh is there a place to see ETA for the next SDK version? (especially that v51?)

facebook-github-bot pushed a commit to facebook/react-native that referenced this issue Apr 25, 2024
Summary:
Defines module for `React-jsinspector` that for swift modules to integrate with.

to fix expo/expo#28209, any podspec depends on HermesExecutorFactory should use ` add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern')` to add dependency. otherwise it will encounter the header not found issue because use_frameworks will change "jsinspector-modern" to "jsinspector_modern".

to depend on React-jsinspector from expo-modules-core, we need it to define as a module.
otherwise, it will have the error
```
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.
```

## Changelog:

[IOS] [CHANGED] - Add `DEFINES_MODULE` for React-jsinspector.podspec

Pull Request resolved: #44252

Test Plan: ci passed

Reviewed By: cortinico

Differential Revision: D56575102

Pulled By: cipolleschi

fbshipit-source-id: 9b7b4568a3e499f0a741a79a846263118ff2d112
cipolleschi pushed a commit to facebook/react-native that referenced this issue May 1, 2024
Summary:
Defines module for `React-jsinspector` that for swift modules to integrate with.

to fix expo/expo#28209, any podspec depends on HermesExecutorFactory should use ` add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern')` to add dependency. otherwise it will encounter the header not found issue because use_frameworks will change "jsinspector-modern" to "jsinspector_modern".

to depend on React-jsinspector from expo-modules-core, we need it to define as a module.
otherwise, it will have the error
```
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.
```

## Changelog:

[IOS] [CHANGED] - Add `DEFINES_MODULE` for React-jsinspector.podspec

Pull Request resolved: #44252

Test Plan: ci passed

Reviewed By: cortinico

Differential Revision: D56575102

Pulled By: cipolleschi

fbshipit-source-id: 9b7b4568a3e499f0a741a79a846263118ff2d112
Kudo added a commit that referenced this issue May 3, 2024
# Why

fix header not found issue when using frameworks on new architecture
fixes #28209

# How

the header search path is from `EXJavaScriptRuntime.mm ->
HermesExecutorFactory.h -> <jsinspector-modern/InspectorInterfaces.h>`.
the correct import should be underlined "jsinspector_modern" in the
import. the code is inside react-native core that we cannot touch.
this pr tries to use the `add_dependency()` from react-native core that
we specify extra ":framework_name".

also cleanup some unused search paths that are added through
`install_modules_dependencies()`.
we also have to wait 0.74.1 for
facebook/react-native#44252
kosmydel pushed a commit to kosmydel/react-native that referenced this issue May 6, 2024
Summary:
Defines module for `React-jsinspector` that for swift modules to integrate with.

to fix expo/expo#28209, any podspec depends on HermesExecutorFactory should use ` add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern')` to add dependency. otherwise it will encounter the header not found issue because use_frameworks will change "jsinspector-modern" to "jsinspector_modern".

to depend on React-jsinspector from expo-modules-core, we need it to define as a module.
otherwise, it will have the error
```
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.
```

## Changelog:

[IOS] [CHANGED] - Add `DEFINES_MODULE` for React-jsinspector.podspec

Pull Request resolved: facebook#44252

Test Plan: ci passed

Reviewed By: cortinico

Differential Revision: D56575102

Pulled By: cipolleschi

fbshipit-source-id: 9b7b4568a3e499f0a741a79a846263118ff2d112
@davidjbng
Copy link
Contributor

I still get the same error with Expo 51.0.0

Repro

davidjbng/expo-use-frameworks-static

Environment

expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.4.1
Shell: 3.7.1 - /opt/homebrew/bin/fish
Binaries:
Node: 22.1.0 - ~/.local/share/nvm/v22.1.0/bin/node
npm: 10.7.0 - ~/.local/share/nvm/v22.1.0/bin/npm
Managers:
CocoaPods: 1.14.3 - /Users/dj/.rvm/gems/ruby-2.7.8/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
Android SDK:
API Levels: 33, 34
Build Tools: 30.0.3, 33.0.0, 33.0.1, 33.0.2, 34.0.0
System Images: android-31 | Google Play ARM 64 v8a, android-33 | Google APIs ARM 64 v8a, android-33 | Google Play ARM 64 v8a, android-34 | Google APIs ARM 64 v8a, android-UpsideDownCakePrivacySandbox | Google Play ARM 64 v8a, android-VanillaIceCream | Google Play ARM 64 v8a
IDEs:
Xcode: 15.3/15E204a - /usr/bin/xcodebuild
npmPackages:
expo: 51.0.0 => 51.0.0
react: 18.2.0 => 18.2.0
react-native: 0.74.1 => 0.74.1
Expo Workflow: bare

@b0iq
Copy link

b0iq commented May 7, 2024

Expo 51 react native 0.74.1

Still same issue

@jingp-ofload
Copy link

Same here, can we reopen this issue?

@jingp-ofload
Copy link

facebook/react-native#42747 seems to be the cause.

add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern')

The"React-jsinspector" pod will only be included if the framework_name is 'jsinspector_modern' ?

This solution not working for me.

@dungphung
Copy link

dungphung commented May 8, 2024

Expo 51 react native 0.74.1
› Compiling expo-dev-menu Pods/expo-dev-menu » DevMenuRCTBridge.mm
› Compiling expo-dev-menu Pods/expo-dev-menu » DevMenuExtensions.m
› Compiling expo-dev-menu Pods/expo-dev-menu » DevClientRootViewFactory.mm

❌ (node_modules/react-native/ReactCommon/cxxreact/JSExecutor.h:15:10)

13 | #include <cxxreact/NativeModule.h>
14 | #include <folly/dynamic.h>

15 | #include <jsinspector-modern/InspectorInterfaces.h>
| ^ 'jsinspector-modern/InspectorInterfaces.h' file not found
16 | #include <jsinspector-modern/ReactCdp.h>
17 |
18 | #ifndef RN_EXPORT

› Compiling expo-dev-menu Pods/expo-dev-menu » DevClientAppDelegate.mm

Still same issue

@jingp-ofload
Copy link

I just realised that my issue is from expo-dev-menu not expo-modules-core

@voxlz
Copy link

voxlz commented May 8, 2024

Also facing this issue in SDK 51

@leonhh
Copy link
Contributor Author

leonhh commented May 8, 2024

I just realised that my issue is from expo-dev-menu not expo-modules-core

Yes, this is an issue with expo-dev-client and is not related to expo-modules. Removing expo-dev-client fixes the issue.

See #27414 for this issue

@sousaweb
Copy link

sousaweb commented May 8, 2024

Same problem here, after upgrading expo@50 to expo@51 and recreated the ios folder.
In order to solve i removed the changes made in package.json and yarn.lock, ran the yarn install, so it downgraded to expo@50 and now its working fine again as before. I will wait more weeks until a release that fixes this issue, this way i can use the new expo@51.

13 | #include <cxxreact/NativeModule.h>
14 | #include <folly/dynamic.h>

15 | #include <jsinspector-modern/InspectorInterfaces.h>
| ^ 'jsinspector-modern/InspectorInterfaces.h' file not found
16 | #include <jsinspector-modern/ReactCdp.h>
17 |
18 | #ifndef RN_EXPORT

@a-eid
Copy link

a-eid commented May 8, 2024

we're facing the same issue after upgrading from sdk 50, with or without newArchEnabled.

@hewad-mubariz
Copy link

hewad-mubariz commented May 8, 2024

I'm having the same issue while trying to upgrade from SDK 50 to 51

@hirbod
Copy link
Contributor

hirbod commented May 8, 2024

I'll add my +1 too - indeed breaking, also without newArch enabled

@brentvatne brentvatne reopened this May 8, 2024
@brentvatne brentvatne changed the title [expo-modules][SDK51] build error with useFrameworks and new architecture enabled [expo-modules][SDK51] build error with useFrameworks May 8, 2024
@brentvatne
Copy link
Member

brentvatne commented May 8, 2024

facebook/react-native#44252 was merged into 0.74.1 which was meant to fix this but I'm able to reproduce this on SDK 51 on projects with static frameworks, we'll investigate.

you can work around this by removing expo-dev-client from your dependencies for now, or disabling static frameworks (if possible for your app).

@brentvatne brentvatne changed the title [expo-modules][SDK51] build error with useFrameworks [expo-modules][expo-dev-client][SDK51] build error with useFrameworks: 'static' May 8, 2024
@Darren120
Copy link

Darren120 commented May 9, 2024

+1

a bit different

❌ error: SHA-1 for file /var/folders/dy/lzfv254j3x3xxxwykt7v63d80000gn/T/eas-build-local-nodejs/205af4f1-34af-4030-bd12-xxxxxx/build/node_modules/expo/AppEntry.js (/var/folders/dy/lzfv254j3x33cmwykt7v63d80000gn/T/eas-build-local-nodejs/205af4f1-34af-4030-bd12-xxxxxx/build/node_modules/expo/AppEntry.js) is not computed.

exit 65
building for development profile works,

running prod fails.,

going back to 50.0.17 this issue goes away.

@H4ck3r-x0
Copy link

i had smiler issue yesterday, #28676, and what i did is i installed fresh expo app, and i looked at the package.json file and i had to remove some of i think it is not unnecessary, that i do not really know what they are.

  "resolutions": {
    "react-refresh": "~0.14.0",
    "expo-modules-core": "~1.11.0"
  },
  "overrides": {
    "react-refresh": "~0.14.0",
    "expo-modules-core": "~1.11.0"
  },
  "expo": {
    "install": {
      "exclude": [
        "react-native-safe-area-context"
      ]
    }
  },

the above code is from my old package.json so i removed them, and rebuild the app

eas build --platform ios --profile preview

and the build went smoothly.

so this is my old package.json,

{
"name": "here is my app name :)",
"version": "1.0.0",
"scripts": {
  "android": "expo start --android",
  "format": "eslint \"**/*.{js,jsx,ts,tsx}\" --fix && prettier \"**/*.{js,jsx,ts,tsx,json}\" --write",
  "ios": "expo start --ios",
  "start": "expo start",
  "web": "expo start --web"
},
"dependencies": {
  "@expo/vector-icons": "^14.0.0",
  "@react-native-picker/picker": "2.7.5",
  "@react-navigation/native": "^6.1.7",
  "axios": "^1.6.5",
  "expo": "^51.0.0",
  "expo-font": "~12.0.4",
  "expo-image-picker": "~15.0.4",
  "expo-linking": "~6.3.1",
  "expo-localization": "~15.0.3",
  "expo-location": "~17.0.1",
  "expo-router": "~3.5.10",
  "expo-secure-store": "~13.0.1",
  "expo-status-bar": "~1.12.1",
  "expo-system-ui": "~3.0.4",
  "expo-updates": "~0.25.9",
  "expo-web-browser": "~13.0.3",
  "moment": "^2.30.1",
  "nativewind": "^2.0.11",
  "react": "18.2.0",
  "react-dom": "18.2.0",
  "react-native": "0.74.1",
  "react-native-gesture-handler": "~2.16.1",
  "react-native-reanimated": "3.10.0",
  "react-native-safe-area-context": "^4.6.3",
  "react-native-screens": "3.31.1",
  "react-native-web": "~0.19.6"
},
"devDependencies": {
  "@babel/core": "^7.20.0",
  "@types/react": "~18.2.14",
  "@typescript-eslint/eslint-plugin": "^6.7.2",
  "@typescript-eslint/parser": "^6.7.2",
  "eslint": "^8.50.0",
  "eslint-config-universe": "^12.0.0",
  "prettier": "^3.0.3",
  "tailwindcss": "3.3.2",
  "typescript": "~5.3.3"
},
"eslintConfig": {
  "extends": "universe/native"
},
"resolutions": {
  "react-refresh": "~0.14.0",
  "expo-modules-core": "~1.11.0"
},
"overrides": {
  "react-refresh": "~0.14.0",
  "expo-modules-core": "~1.11.0"
},
"expo": {
  "install": {
    "exclude": [
      "react-native-safe-area-context"
    ]
  }
},
"private": true
}

the new package.json

{
  "name": "this is my app name :)",
  "version": "1.0.0",
  "scripts": {
    "android": "expo start --android",
    "format": "eslint \"**/*.{js,jsx,ts,tsx}\" --fix && prettier \"**/*.{js,jsx,ts,tsx,json}\" --write",
    "ios": "expo start --ios",
    "start": "expo start",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/vector-icons": "^14.0.0",
    "@react-native-picker/picker": "2.7.5",
    "@react-navigation/native": "^6.1.7",
    "axios": "^1.6.5",
    "expo": "~51.0.0",
    "expo-font": "~12.0.4",
    "expo-image-picker": "~15.0.4",
    "expo-linking": "~6.3.1",
    "expo-location": "~17.0.1",
    "expo-router": "~3.5.10",
    "expo-secure-store": "~13.0.1",
    "expo-status-bar": "~1.12.1",
    "expo-system-ui": "~3.0.4",
    "expo-updates": "~0.25.9",
    "expo-web-browser": "~13.0.3",
    "moment": "^2.30.1",
    "nativewind": "^2.0.11",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.74.1",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-safe-area-context": "^4.6.3",
    "react-native-screens": "3.31.1",
    "react-native-web": "~0.19.6",
    "react-native-reanimated": "3.10.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/react": "~18.2.14",
    "@typescript-eslint/eslint-plugin": "^6.7.2",
    "@typescript-eslint/parser": "^6.7.2",
    "eslint": "^8.50.0",
    "eslint-config-universe": "^12.0.0",
    "prettier": "^3.0.3",
    "tailwindcss": "3.3.2",
    "typescript": "~5.3.3"
  },
  "eslintConfig": {
    "extends": "universe/native"
  },
  "private": true
}

also i changed the eas.json file

{
  "cli": {
    "version": ">= 9.0.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal",
      "channel": "development"
    },
    "preview": {
      "distribution": "internal",
      "ios": {
        "simulator": true
      },
      "channel": "preview"
    },
    "production": {
      "channel": "production"
    }
  },
  "submit": {
    "production": {}
  }
}

to use the version of eas cli to 9.0.0 it was something like 7.0.

@mikevercoelen
Copy link

Made it work with these patches based on this PR: #28702

expo-dev-launcher+4.0.13.patch
expo-dev-menu+5.0.13.patch

Kudo added a commit that referenced this issue May 9, 2024
# Why

fixes use_frameworks build errors on expo-dev-client
fixes #28209
close ENG-11972

# How

- use `add_dependency` for `React-jsinspector` (which is a dependency of
HermesExecutorFactory.h)
- add more framework search paths to fix build error with use_frameworks
and newArchEnabled=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment