react-native: [v0.75.2] macOS (Catalyst) builds fail with `hermes.framework: bundle format is ambiguous (could be app or framework)`
Description
Migrating my libraries / app from RN@0.74 to the latest RN@0.75.2. When building for macOS (Catalyst) target my build fails with that error hermes.framework: bundle format is ambiguous (could be app or framework). I first posted the issue to the Hermes repo (https://github.com/facebook/hermes/issues/1492), but I was told there, it must be an issue on RN side, how it packages stuff.
Steps to reproduce
N/A
React Native Version
0.75.2
Affected Platforms
Build - MacOS
Output of npx react-native info
N/A
Stacktrace or Logs
N/A
Reproducer
N/A
Screenshots and Videos
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 41 (36 by maintainers)
nono, you have to download the tarball locally first! 😄
Hello there! I think I fixed the issue in the above PR. Can some of you (@birdofpreyru @hsjoberg) please try it? 🙏
You can download the hermes tarball from this link
And then you can install pods using this command:
and try to build again.
Looking in the
upload-artifactsrepo, there are quite a few issues related to symlinks. It looks like that the default behavior forupload-artifactsis to follow symlinks and copy the file/folder the symlink points to. 🤦I guess we have to add a custom step to revert those changes before creating the archive.
@hsjoberg that’s expected, as the
frameworkformat for Catalyst and MacOS is the same@robertying Thanks for your investigation. That helps a lot.
React Native is responsible to package and distribute Hermes, so that’s actually a React Native issue.
What we changes w.r.t. 0.74 is that we had to move the whole build and release pipeline from CircleCI to GitHub Actions. The upload artifact action has some issues with symlinks, sadly and it has given us headaches already in
mainas well.I’ll try to double check and do some extra checks today, but with React Universe coming up I’m not sure whether a fix will arrive soon. It might have to wait for a week or so.
Meanwhile, I’ll reopen the issue.
Well, I’m currently seeing the same symptoms as OP on react-native-macos 0.75.
From what I can tell react-native-macos pulls in iOS Hermes, so I thought this was related to OPs issue: https://github.com/microsoft/react-native-macos/blob/042cd6c36b23c21d20de628bc9756793e01ce282/packages/react-native/sdks/hermes-engine/hermes-utils.rb#L237-L257
Ok I think the symlinks are broken in the 0.75 hermes build.
To fix the symlinks, go to your project root and run:
Verify hermes.framework looks like this:
@cipolleschi does RN do the packaging for hermes or is this indeed a hermes issue (that we should forward back to the hermes repo)?
I guess, that stripping step does not take place if you target new Apple Silicon hardware? Btw, although the build fails, it turns out the app bundle it creates before the failure, runs seemingly fine 0.o
Yes, I just verified, a clean app created with
@react-native-community/cli, macCatalyst build fails exactly this same way for me.@sunshinezxq that looks likes an attempt to trick users into downloading a malware, I got it reported to GitHub 😃