Repository: facebook/react-native (language: cpp)

Issue:
[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`

```text
N/A
```


### Stacktrace or Logs

```text
N/A
```


### Reproducer

N/A

### Screenshots and Videos

_No response_


Discussion / hints:
| :warning: | Missing Reproducible Example |
| --- | --- |
| :information_source: | We could not detect a reproducible example in your issue report. Please provide either: <br /><ul><li>If your bug is UI related: a [Snack](https://snack.expo.dev)</li><li> If your bug is build/update related: use our [Reproducer Template](https://github.com/react-native-community/reproducer-react-native/generate). A reproducer needs to be in a GitHub repository under your username.</li></ul> |
| :warning: | Missing Reproducible Example |
| --- | --- |
| :information_source: | We could not detect a reproducible example in your issue report. Please provide either: <br /><ul><li>If your bug is UI related: a [Snack](https://snack.expo.dev)</li><li> If your bug is build/update related: use our [Reproducer Template](https://github.com/react-native-community/reproducer-react-native/generate)</li></ul> |
@sunshinezxq that looks likes an attempt to trick users into downloading a malware, I got it reported to GitHub :)
Thanks for reporting the user.

QQ: How do I repro it?
I create a new app and try to archive for macCatalyst?
> _QQ: How do I repro it?_
> _I create a new app and try to archive for macCatalyst?_

Yes, I just verified, a clean app created with `@react-native-community/cli`, macCatalyst build fails exactly this same way for me.
Yeah same thing is happening here

I just created a new app with 0.75.2 and I can't reproduce the issue for catalyst (See the screenshot).

We had a [similar report](https://github.com/reactwg/react-native-releases/issues/390) back then, but I couldn't repro either.

Can you try run `pod deintegrate` and try again. I'm afraid that cocoapods cached a wrong version of hermes in your system and tries to use that one to run macCatalyst for some reason.

<img width="2301" alt="Screenshot 2024-08-29 at 11 26 25" src="https://github.com/user-attachments/assets/910a6e15-6027-43d0-9f53-49aa4fd6c128">

@cipolleschi 

`pod deintegrate` did not help.

I tried to remove all caches I may think of &mdash; all installed / generated files in the clean app template, entire `~/Library/Caches/CocoaPods`, and `~/Library/Developer/Xcode/DerivedData` folders &mdash; it did not help either.

Have you tested it with the new architecture build? May it be caused by me still having an old Intel-based mac mini, rather than latest Apple Silicon one?
I tried both New Arch and Old Arch and it works. Although it should not make a difference for Hermes which is architecture agnostic.

The intel-based mac mini could be an option, I have not thought about the possibility, honestly. 🤔 
Also, I'm not sure how I could test that hypothesis... What is strange is that we didn't really changed anything in the Hermes build logic that could make that fail. And the catalyst architecture we build for CatalystMacOS is arm64_x86_64, so it should support both silicon (arm64) and intel (x86_64)...

<img width="1170" alt="Screenshot 2024-08-29 at 15 30 35" src="https://github.com/user-attachments/assets/290ecac0-96b1-444c-aeb6-86ec417fdd08">




@cipolleschi Here is the detailed error I get:
<img width="872" alt="image" src="https://github.com/user-attachments/assets/b8f638a8-cd9e-49df-a189-3418d06bd1dd">
and here is the archived content of that `hermes.framework` folder within the bundled app:
[hermes.framework.zip](https://github.com/user-attachments/files/16801293/hermes.framework.zip)
if you see anything unexpected about these?

Anything else I can check?
Interestingly it might be a symlink issue: https://stackoverflow.com/questions/25969946/osx-10-9-5-code-signing-v2-signing-a-framework-with-bundle-format-is-ambiguou
the Catalyst slice of a xcframework has a structure that is similar to the one used by a desktop app.
<img width="659" alt="Screenshot 2024-08-29 at 16 22 03" src="https://github.com/user-attachments/assets/0a4eb6b5-3bcc-4b7d-8721-358d9a347fd6">
The various `hermes` files with the empty doc icon are symlink to executable. I think your system does not interpret them properly and see them just as files with a link inside... 🤔 

I need to spend more time looking at how we move stuff around to see if, perhaps we can solve this at build time.

well, the [Anatomy of Framework Bundle](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html), referenced in the StackOverflow thread you referred to, says that _Resources_ folder on top level of a proper framework bundle should be a symlink, and _Versions_ should be the only real directory... that's not what I end up with - in my case _Resources_ is just a regular folder with _Info.plist_ file inside it. Not sure, if/how I can manually force it to be a symlink, to double-check it is the problem, though.
in my case it is a folder as well, but it is working fine. could you confirm that the folder structure is the same?

<img width="561" alt="Screenshot 2024-08-29 at 17 36 30" src="https://github.com/user-attachments/assets/349da71b-20e8-4025-8dee-c94a17d0cc8b">

The only difference I see is that `hermes` file in the root has 7MB size in my bundle. The ones under `Versions/X` have 13.6MB, the same as on your screenshot.
> The only difference I see is that hermes file in the root has 7MB size in my bundle

That's weird. They should all have the same size.

When you run `pod install`, do you have this line?
<img width="920" alt="Screenshot 2024-08-30 at 10 50 15" src="https://github.com/user-attachments/assets/d80e0cd1-fa7b-462d-9a14-6648d287a495">

Also, are you building for Debug or Release?

Yes, I have that line:
<img width="1140" alt="image" src="https://github.com/user-attachments/assets/c76181e6-823c-415b-9305-b8db24c5ddc6">

I am trying it all with Debug build.

~Looking into .tgz archive it pulls, I see there are different versions of hermes binary for different architecture variants, some have 13 MB, but there are several, _e.g._ under `universal/hermes.framework/ios-arm64/hermes.framework`, that have 6.5 MB size. I guess something caused my Xcode to pick and try to bundle a wrong one? I don't know much about toolchains, but I guess it evaluates on my machine it needs a toolchain that does not match any of the intended one, then it attempts to fallback to `ios-arm64` or `xros-arm64`, whatever these mean, and then fails?~
I looked more into my logs, I believe it copies the correct 13.6 MB into the app bundle (I found it says `Selected xcframework slice ios-arm64_x86_64-maccatalyst`), I guess it shrinks it down to ~7MB when it does this:
<img width="1284" alt="image" src="https://github.com/user-attachments/assets/7dcbad12-502d-41e2-9c41-0328b6cb1e34">

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
> 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

Wut! if that's the case, it feels like an Xcode issue more than a RN one. Do you have any chance to test on a Silicon machine?
> _Do you have any chance to test on a Silicon machine?_

Not yet; but I guess if I am starting to run into such problems, it is a high time to get myself a new Apple machine, which I'll probably do :)
The same error happens on my Apple Silicon mac as well, both for debug and archive.
Something definitely has changed from 0.74 to 0.75. These are the different hermes.tar.gz file structures after unzipping:

`ls -al ~/Downloads/0.74.5/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework`:
```
drwxr-xr-x@ 5 rying  staff  160 Aug  5 06:55 .
drwxr-xr-x@ 3 rying  staff   96 Aug  5 06:55 ..
lrwxr-xr-x@ 1 rying  staff   26 Aug  5 06:55 Resources -> Versions/Current/Resources
drwxr-xr-x@ 4 rying  staff  128 Aug  5 06:55 Versions
lrwxr-xr-x@ 1 rying  staff   23 Aug  5 06:55 hermes -> Versions/Current/hermes
```

`ls -al ~/Downloads/0.75.2/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework`:
```
drwxr-xr-x@ 5 rying  staff       160 Aug 20 02:49 .
drwxr-xr-x@ 3 rying  staff        96 Aug 20 02:49 ..
drwxr-xr-x@ 3 rying  staff        96 Aug 20 02:49 Resources
drwxr-xr-x@ 4 rying  staff       128 Aug 20 02:49 Versions
-rw-r--r--@ 1 rying  staff  13564883 Aug 20 02:49 hermes
```
Ok I think the symlinks are broken in the 0.75 hermes build.

To fix the symlinks, go to your project root and run:

```sh
cd ios/Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework
rm -r hermes Resources
ln -s Versions/Current/Resources Resources
ln -s Versions/Current/hermes hermes
cd Versions && rm -r Current && ln -s 0 Current # this is important
```

Verify hermes.framework looks like this:

```
drwxr-xr-x@ 5 rying  staff  160 Aug  5 06:55 .
drwxr-xr-x@ 3 rying  staff   96 Aug  5 06:55 ..
lrwxr-xr-x@ 1 rying  staff   26 Aug  5 06:55 Resources -> Versions/Current/Resources
drwxr-xr-x@ 4 rying  staff  128 Aug  5 06:55 Versions
lrwxr-xr-x@ 1 rying  staff   23 Aug  5 06:55 hermes -> Versions/Current/hermes
```

@cipolleschi does RN do the packaging for hermes or is this indeed a hermes issue (that we should forward back to the hermes repo)?
> does RN do the packaging for hermes or is this indeed a hermes issue (that we should forward back to the hermes repo)?

@robertying I believe OP was referred to the react-native github project by Hermes devs due to them not doing the packaging (https://github.com/facebook/hermes/issues/1492).


FWIW, I'm seeing the same symptoms, but for react-native-macos. I'll try the symlink fixes soon.
@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 `main` as 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.
Thanks @cipolleschi! Thankfully we have a workaround so it's not too urgent I guess.
For (my) future references, Nightlies has the same issue. 🤔 

```
➜  Nightly076 git:(main) ✗ ls -al /Users/cipolleschi/Tests/Nightly076/ios/Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework
total 26512
drwxr-xr-x  5 cipolleschi  staff       160 Aug 27 12:21 .
drwxr-xr-x  3 cipolleschi  staff        96 Aug 27 12:21 ..
drwxr-xr-x  3 cipolleschi  staff        96 Aug 27 12:21 Resources
drwxr-xr-x  4 cipolleschi  staff       128 Aug 27 12:21 Versions
-rw-r--r--  1 cipolleschi  staff  13573923 Aug 27 12:21 hermes
```
Looking in the `upload-artifacts` repo, there are quite a few issues related to [symlinks](https://github.com/actions/upload-artifact/issues?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen+symlinks). It looks like that the default behavior for `upload-artifacts` is 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 `framework` format for Catalyst and MacOS is the same 

Fix patch:
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 582b7f3c4f0dc9..5d1c7610cd273b 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -109,7 +109,7 @@ jobs:
         uses: actions/cache/restore@v4.0.0
         with:
           path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }}
-          key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }}
+          key: v5-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }}
       - name: Build the Hermes ${{ matrix.slice }} frameworks
         run: |
           cd ./packages/react-native/sdks/hermes || exit 1
@@ -163,17 +163,21 @@ jobs:
             echo "Please try again"
             exit 1
           fi
+      - name: Compress slices to preserve Symlinks
+        run: |
+          cd ./packages/react-native/sdks/hermes
+          tar -czv -f build_${{ matrix.slice }}_${{ matrix.flavor }}.tar.gz build_${{ matrix.slice }}_${{ matrix.flavor }}
       - name: Upload Artifact for Slice (${{ matrix.slice }}, ${{ matrix.flavor }}}
         uses: actions/upload-artifact@v4.3.1
         with:
           name: slice-${{ matrix.slice }}-${{ matrix.flavor }}
-          path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }}.tar.gz
       - name: Save slice cache
         if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode.
         uses: actions/cache/save@v4.0.0
         with:
           path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }}
-          key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }}
+          key: v5-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }}
 
   build_hermes_macos:
     runs-on: macos-13
@@ -198,7 +202,7 @@ jobs:
       - name: Restore Cached Artifacts
         uses: actions/cache/restore@v4.0.0
         with:
-          key: v2-hermes-osx-bin-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
+          key: v3-hermes-artifacts-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
           path: |
             /tmp/hermes/osx-bin/${{ matrix.flavor }}
             /tmp/hermes/dSYM/${{ matrix.flavor }}
@@ -227,38 +231,49 @@ jobs:
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_macosx_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-macosx-${{ matrix.flavor }}
       - name: Slice cache iphoneos
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_iphoneos_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-iphoneos-${{ matrix.flavor }}
       - name: Slice cache iphonesimulator
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_iphonesimulator_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-iphonesimulator-${{ matrix.flavor }}
       - name: Slice cache catalyst
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_catalyst_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-catalyst-${{ matrix.flavor }}
       - name: Slice cache xros
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_xros_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-xros-${{ matrix.flavor }}
       - name: Slice cache xrsimulator
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_xrsimulator_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-xrsimulator-${{ matrix.flavor }}
+      - name: Unzip slices
+        if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
+        run: |
+          cd ./packages/react-native/sdks/hermes
+          ls -l .
+          tar -xzv -f build_catalyst_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_iphoneos_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_iphonesimulator_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_macosx_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_xros_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_xrsimulator_${{ matrix.flavor }}.tar.gz
       - name: Move back build folders
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         run: |
@@ -358,7 +373,7 @@ jobs:
         uses: actions/cache/save@v4.0.0
         if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode.
         with:
-          key: v2-hermes-artifacts-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
+          key: v3-hermes-artifacts-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
           path: |
             /tmp/hermes/osx-bin/${{ matrix.flavor }}
             /tmp/hermes/dSYM/${{ matrix.flavor }}
diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml
index 06560a2c848cde..18e5f058d33751 100644
--- a/.github/workflows/publish-release.yml
+++ b/.github/workflows/publish-release.yml
@@ -106,7 +106,7 @@ jobs:
         uses: actions/cache/restore@v4.0.0
         with:
           path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }}
-          key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }}
+          key: v5-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }}
       - name: Build the Hermes ${{ matrix.slice }} frameworks
         run: |
           cd ./packages/react-native/sdks/hermes || exit 1
@@ -160,17 +160,21 @@ jobs:
             echo "Please try again"
             exit 1
           fi
+      - name: Compress slices to preserve Symlinks
+        run: |
+          cd ./packages/react-native/sdks/hermes
+          tar -czv -f build_${{ matrix.slice }}_${{ matrix.flavor }}.tar.gz build_${{ matrix.slice }}_${{ matrix.flavor }}
       - name: Upload Artifact for Slice (${{ matrix.slice }}, ${{ matrix.flavor }}}
         uses: actions/upload-artifact@v4.3.1
         with:
           name: slice-${{ matrix.slice }}-${{ matrix.flavor }}
-          path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }}.tar.gz
       - name: Save slice cache
         if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode.
         uses: actions/cache/save@v4.0.0
         with:
           path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }}
-          key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }}
+          key: v5-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }}
 
   build_hermes_macos:
     runs-on: macos-13
@@ -195,7 +199,7 @@ jobs:
       - name: Restore Cached Artifacts
         uses: actions/cache/restore@v4.0.0
         with:
-          key: v2-hermes-osx-bin-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
+          key: v3-hermes-artifacts-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
           path: |
             /tmp/hermes/osx-bin/${{ matrix.flavor }}
             /tmp/hermes/dSYM/${{ matrix.flavor }}
@@ -224,38 +228,49 @@ jobs:
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_macosx_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-macosx-${{ matrix.flavor }}
       - name: Slice cache iphoneos
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_iphoneos_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-iphoneos-${{ matrix.flavor }}
       - name: Slice cache iphonesimulator
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_iphonesimulator_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-iphonesimulator-${{ matrix.flavor }}
       - name: Slice cache catalyst
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_catalyst_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-catalyst-${{ matrix.flavor }}
       - name: Slice cache xros
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_xros_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-xros-${{ matrix.flavor }}
       - name: Slice cache xrsimulator
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_xrsimulator_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-xrsimulator-${{ matrix.flavor }}
+      - name: Unzip slices
+        if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
+        run: |
+          cd ./packages/react-native/sdks/hermes
+          ls -l .
+          tar -xzv -f build_catalyst_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_iphoneos_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_iphonesimulator_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_macosx_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_xros_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_xrsimulator_${{ matrix.flavor }}.tar.gz
       - name: Move back build folders
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         run: |
@@ -355,7 +370,7 @@ jobs:
         uses: actions/cache/save@v4.0.0
         if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode.
         with:
-          key: v2-hermes-artifacts-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
+          key: v3-hermes-artifacts-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
           path: |
             /tmp/hermes/osx-bin/${{ matrix.flavor }}
             /tmp/hermes/dSYM/${{ matrix.flavor }}


Test patch:
diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml
index 6daedc97a77316..33b8485c6e781b 100644
--- a/.github/workflows/test-all.yml
+++ b/.github/workflows/test-all.yml
@@ -117,7 +117,7 @@ jobs:
         uses: actions/cache/restore@v4.0.0
         with:
           path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }}
-          key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }}
+          key: v5-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }}
       - name: Build the Hermes ${{ matrix.slice }} frameworks
         run: |
           cd ./packages/react-native/sdks/hermes || exit 1
@@ -171,17 +171,21 @@ jobs:
             echo "Please try again"
             exit 1
           fi
+      - name: Compress slices to preserve Symlinks
+        run: |
+          cd ./packages/react-native/sdks/hermes
+          tar -czv -f build_${{ matrix.slice }}_${{ matrix.flavor }}.tar.gz build_${{ matrix.slice }}_${{ matrix.flavor }}
       - name: Upload Artifact for Slice (${{ matrix.slice }}, ${{ matrix.flavor }}}
         uses: actions/upload-artifact@v4.3.1
         with:
           name: slice-${{ matrix.slice }}-${{ matrix.flavor }}
-          path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }}.tar.gz
       - name: Save slice cache
         if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode.
         uses: actions/cache/save@v4.0.0
         with:
           path: ./packages/react-native/sdks/hermes/build_${{ matrix.slice }}_${{ matrix.flavor }}
-          key: v4-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }}
+          key: v5-hermes-apple-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}-${{ hashfiles('packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh') }}-${{ matrix.slice }}-${{ matrix.flavor }}
 
   build_hermes_macos:
     runs-on: macos-13
@@ -206,7 +210,7 @@ jobs:
       - name: Restore Cached Artifacts
         uses: actions/cache/restore@v4.0.0
         with:
-          key: v3-hermes-artifacts-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
+          key: v4-hermes-artifacts-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
           path: |
             /tmp/hermes/osx-bin/${{ matrix.flavor }}
             /tmp/hermes/dSYM/${{ matrix.flavor }}
@@ -235,38 +239,50 @@ jobs:
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_macosx_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-macosx-${{ matrix.flavor }}
       - name: Slice cache iphoneos
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_iphoneos_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-iphoneos-${{ matrix.flavor }}
       - name: Slice cache iphonesimulator
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_iphonesimulator_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-iphonesimulator-${{ matrix.flavor }}
       - name: Slice cache catalyst
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_catalyst_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-catalyst-${{ matrix.flavor }}
       - name: Slice cache xros
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_xros_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-xros-${{ matrix.flavor }}
       - name: Slice cache xrsimulator
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         uses: actions/download-artifact@v4.1.3
         with:
-          path: ./packages/react-native/sdks/hermes/build_xrsimulator_${{ matrix.flavor }}
+          path: ./packages/react-native/sdks/hermes/
           name: slice-xrsimulator-${{ matrix.flavor }}
+      - name: Unzip slices
+        if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
+        run: |
+          cd ./packages/react-native/sdks/hermes
+          ls -l .
+
+          tar -xzv -f build_catalyst_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_iphoneos_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_iphonesimulator_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_macosx_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_xros_${{ matrix.flavor }}.tar.gz
+          tar -xzv -f build_xrsimulator_${{ matrix.flavor }}.tar.gz
       - name: Move back build folders
         if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
         run: |
@@ -366,7 +382,7 @@ jobs:
         uses: actions/cache/save@v4.0.0
         if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, '-stable') }} # To avoid that the cache explode.
         with:
-          key: v3-hermes-artifacts-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
+          key: v4-hermes-artifacts-${{ matrix.flavor }}-${{ needs.prepare_hermes_workspace.outputs.hermes-version }}-${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
           path: |
             /tmp/hermes/osx-bin/${{ matrix.flavor }}
             /tmp/hermes/dSYM/${{ matrix.flavor }}