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

Library not loaded: @rpath/hermes.framework/hermes on iOS #34601

Closed
allemanfredi opened this issue Sep 6, 2022 · 20 comments
Closed

Library not loaded: @rpath/hermes.framework/hermes on iOS #34601

allemanfredi opened this issue Sep 6, 2022 · 20 comments
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Triage 🔍 Platform: iOS iOS applications.

Comments

@allemanfredi
Copy link

Description

As soon as the app starts, it crashes.

Version

0.70.0

Output of npx react-native info

System:
    OS: macOS 12.5.1
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 299.79 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
    Watchman: 2022.02.14.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6953283
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.16 - /Library/Java/JavaVirtualMachines/jdk-11.0.16.jdk/Contents/Home/bin/javac
  npmPackages:
    @react-native-community/cli: 8.0.4 => 8.0.4 
    react: 18.2.0 => 18.2.0 
    react-native: 0.70.0 => 0.70.0 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

Just launch npx react-native run-ios --simulator "iPhone 12" with hermes_enabled => true

Snack, code example, screenshot, or link to a repository

none

@ch3rn1k
Copy link

ch3rn1k commented Sep 6, 2022

#34599 same?

@allemanfredi
Copy link
Author

#34599 same?

it could be!

@Bayramito
Copy link

working if i disable hermes on Podfile

@allemanfredi
Copy link
Author

working if i disable hermes on Podfile

Thanks but i would like to keep it enabled!

@niyati-tanna-tark
Copy link

I solved it by adding hermes.xcframework file to

xcode > build phases > Link binary with Libraries

just press to + sign and search for hermes

Screenshot 2022-09-07 at 7 03 52 PM

Add it and rebuild your app.

@allemanfredi
Copy link
Author

allemanfredi commented Sep 7, 2022

@niyati-tanna-tark I solved by doing this.

@rafaelmaeuer
Copy link

I solved it by adding hermes.xcframework file to

xcode > build phases > Link binary with Libraries

just press to + sign and search for hermes

Screenshot 2022-09-07 at 7 03 52 PM

Add it and rebuild your app.

This works for builds with xcode, but not for cmd-builds like react-native uses: npx react-native run-ios any fix for this?

@niyati-tanna-tark
Copy link

niyati-tanna-tark commented Sep 12, 2022

I solved it by adding hermes.xcframework file to
xcode > build phases > Link binary with Libraries
just press to + sign and search for hermes
Screenshot 2022-09-07 at 7 03 52 PM
Add it and rebuild your app.

This works for builds with xcode, but not for cmd-builds like react-native uses: npx react-native run-ios any fix for this?

Screenshot 2022-09-12 at 10 54 00 AM

Yes in xCode you will need to Embed & Sign hermes framework and then build again using command. It will work.

@kelset
Copy link
Collaborator

kelset commented Sep 13, 2022

As I commented here, based on the repro steps I don't get the error: #34612 (comment)

I'm going to close this issue unless someone can provide proper repro steps

@kelset kelset added the Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. label Sep 13, 2022
@github-actions
Copy link

⚠️ Missing Reproducible Example
ℹ️ It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.

@allemanfredi
Copy link
Author

I have fixed by putting this code within Podfile after __apply_Xcode_12_5_M1_post_install_workaround(installer)

def fix_hermes()
  path = "Pods/Target Support Files/Pods-AppName/Pods-AppName-frameworks.sh"
  lines = File.readlines(path)
  lines.insert(177, 'install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"'+"\n")
  File.write(path, lines.join, mode: "w")
end

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Sep 13, 2022
@kelset
Copy link
Collaborator

kelset commented Sep 13, 2022

@allemanfredi could you help me understand why that is needed/what it does? 🤔

@allemanfredi
Copy link
Author

@kelset it adds the following code to Pods-Eidoo-frameworks

install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"

@Gnative
Copy link

Gnative commented Sep 14, 2022

See #34608 for fix.

Ldoppea added a commit to cozy/cozy-flagship-app that referenced this issue Oct 31, 2022
When doing a fresh build from scratch, the app would crash on startup
with the following error
`Library not loaded: @rpath/hermes.framework/hermes`

To fix this we need to add Hermes to project's linked libraries

More info: facebook/react-native#34601 (comment)
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this issue Nov 2, 2022
When doing a fresh build from scratch, the app would crash on startup
with the following error
`Library not loaded: @rpath/hermes.framework/hermes`

To fix this we need to add Hermes to project's linked libraries and
into embedded libraries

More info: facebook/react-native#34601 (comment)
Ldoppea added a commit to cozy/cozy-flagship-app that referenced this issue Nov 2, 2022
When doing a fresh build from scratch, the app would crash on startup
with the following error
`Library not loaded: @rpath/hermes.framework/hermes`

To fix this we need to add Hermes to project's linked libraries and
into embedded libraries

More info: facebook/react-native#34601 (comment)
@noumantahir
Copy link

#34608

In my case app was running fine for first launch but if I close and open from launcher app was failing with same error.

Setting hermes to Embed & Sign as suggested in this comment did the trick for me. Thanks.!

@Aure77
Copy link

Aure77 commented Dec 1, 2022

To fix this issue you need to use the good version of ruby (used to install cocoapods...). It will fix pod dependencies linkage during pod install command. Check .ruby-version file in your repo.
Ensure to re-run pod install + rebuild iOS after upgrade ruby.

You can run bundle install to check if you are running good version of ruby.

Please see RN 0.69 changelog:
https://reactnative.dev/blog/2022/06/21/version-069#upgrades
Ruby upgrade:
2c87b74

@kopax-polyconseil
Copy link

  • We have the same error with RN0.68.5 when building iOS simulator within github action.
  • We have a ruby version file and we use setup ruby action.
  • We tested image macos-11 and macos-12 to do the build, tried multiple version of xcode. all your fix didn't work, we can only upgrade react-native and so far it is very painful due to the size of our application, I have opened an issue here : How to succeed React Native upgrade 0.68.5 to 0.70.6 #35588

I am out of idea that doesn't involve react-native upgrade, if you guys have any idea to share.

@hokimtam
Copy link

I solved it by adding hermes.xcframework file to

xcode > build phases > Link binary with Libraries

just press to + sign and search for hermes

Screenshot 2022-09-07 at 7 03 52 PM

Add it and rebuild your app.

Still work with react-native 0.70.10. Thank you so much.

@shubhamguptadream11
Copy link

Cause: In node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec from react-native 0.70.0 minimum iOS deployment target is upgraded to 12.4 from 11.0.

Solution: So, I just upgraded my minimum iOS deployment target to 12.4 and it works.

I hope this helps someone!

@reichert621
Copy link

Updating cocoapods to the latest version solved this issue for me! (just had to run sudo gem install cocoapods and check that pod --version was 1.15.x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Triage 🔍 Platform: iOS iOS applications.
Projects
None yet
Development

No branches or pull requests