react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Unresolved `dSYMs` path for hermes.xcframework on React Native `0.71.0`

Open gvarandas opened this issue 1 year ago โ€ข 34 comments

New Version

0.71.0

Old Version

0.70.6

Build Target(s)

iOS simulator in debug flavor (but the issue will likely happen on any iOS build flavor).

Output of react-native info

System:
    OS: macOS 13.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 78.59 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.9.0 - /var/folders/b5/5157q_1923jffgs5kk5ycn9c0000gn/T/yarn--1673979783677-0.35373539239086704/node
    Yarn: 1.22.19 - /var/folders/b5/5157q_1923jffgs5kk5ycn9c0000gn/T/yarn--1673979783677-0.35373539239086704/yarn
    npm: 8.19.1 - /opt/homebrew/bin/npm
    Watchman: 2022.09.19.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /Users/gvarandas/.gem/ruby/3.1.2/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
    Android SDK:
      API Levels: 24, 25, 26, 28, 29, 30, 31, 32, 33
      Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0
      System Images: android-29 | Google APIs ARM 64 v8a, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-31 | Google APIs ARM 64 v8a, android-31 | Google APIs Intel x86 Atom_64, android-33 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9123335
    Xcode: 14.0/14A309 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.13 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.0 => 0.71.0
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Issue and Reproduction Steps

Due to a specific requirement, our brownfield project needs to depend on hermes.xcframework directly in order to resolve the Hermes runtime path when building the app for an iOS target.

After upgrading to 0.71.0, we've noticed that builds started to fail with a unresolved path error:

error: Missing path (project/ios/Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-simulator/dSYMs) from XCFramework 'hermes.xcframework' as defined by 'DebugSymbolsPath' in its `Info.plist` file (in target 'iOSTarget' from project 'Project')
ios/Pods/hermes-engine/destroot/Library/Frameworks/universal/dSYMs

The path reference seems to be generated by the following Plist file:

ios/Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/Info.plist
<dict>
  <key>AvailableLibraries</key>
  <array>
    <dict>
      <!-- this entry -->
      <key>DebugSymbolsPath</key>
      <string>dSYMs</string>
      <!--  -->
      <key>LibraryIdentifier</key>
      <string>ios-arm64</string>
      <key>LibraryPath</key>
      <string>hermes.framework</string>
      <key>SupportedArchitectures</key>
      <array>
        <string>arm64</string>
      </array>
      <key>SupportedPlatform</key>
      <string>ios</string>
    </dict>
    <!-- Other architectures -->
  </array>
</dict>

The folder, however, doesn't exist, as debug symbols don't seem to be shipped with the prebundled version of Hermes.

I'm wondering if the DebugSymbolsPath plist entry should be suppressed if debug symbols aren't being generated, as the path doesn't actually exists and just providing an empty folder seems to suffice, signalling that the reference isn't used beyond validating it's existence.

gvarandas avatar Jan 17 '23 18:01 gvarandas

The folder, however, doesn't exist, as debug symbols don't seem to be shipped with the prebundled version of Hermes.

You're right, we don't ship dSYM for Hermes.

Due to a specific requirement, our brownfield project needs to depend on hermes.xcframework directly in order to resolve the Hermes runtime path when building the app for an iOS target.

Can you clarify your setup? What's the requirement you're talking about. (cc @cipolleschi)

cortinico avatar Jan 18 '23 10:01 cortinico

@cortinico I'm also facing the same problem while upgrading.

I guess, what @gvarandas (Correct me if I'm wrong) means, that they cannot disable hermes in order to proceed.

ankitjainOfficial avatar Jan 18 '23 12:01 ankitjainOfficial

@cortinico we have a brownfield app that's being progressively ported over to React Native. Our iOS setup has multiple frameworks within the same workspace and our React Native configurations are all embedded into one of these frameworks (that isn't the main target), including the pods.

  graph LR;;
      A[Main Target]-->B[React Native Framework];
      A-->F
      B-->C[libPods.a];
      C-->F[hermes.xcframework]
      A-->D[Framework #1];
      A-->E[Framework #2];

Since enabling Hermes on iOS, we had to add a direct reference to the hermes.xcframework to Main Target, otherwise React Native wouldn't be able to resolve it's path and would crash with an unresolved path error:

Library not loaded: @rpath/hermes.framework/hermes
Referenced from: <4C39F48E-982D-3AB5-AAC2-043DB3748E96> /Users/USER/Library/Developer/CoreSimulator/Devices/D1B619FA-D012-473E-A2F1-931C410D5A16/data/Containers/Bundle/Application/E96877C9-046A-4BFB-81A2-23ADD37F7DC2/Project.app/Frameworks/ReactNativeProject.framework/ReactNativeProject

We haven't been able to solve this issue and the workaround was to reference the framework in the main target, effectively duplicating it. It's not great but it works. ๐Ÿคทโ€โ™‚๏ธ

gvarandas avatar Jan 18 '23 17:01 gvarandas

For the record, this is what we've setup in our Podfile to avoid the issue for the time being, confirming that removing the Info.plist does, in fact, solve the issue:

post_install do |installer|
  PLIST_BUDDY_PATH = '/usr/libexec/PlistBuddy'

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.name == "hermes-engine"
        installer.pods_project.files.each do |fileref|
          if fileref.path.end_with? "hermes.xcframework"
            hermes_plist_file = "#{fileref.real_path}/Info.plist"
            # Patch Hermes to remove the debug symbols entry from the Info.plist (as it's not shipped with it)
            # This might be removed once Hermes starts to ship with Debug symbols or we remove our
            # direct dependency from the Main iOS target on "hermes.xcframework"
            Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:0:DebugSymbolsPath', hermes_plist_file)
            Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:1:DebugSymbolsPath', hermes_plist_file)
            Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:2:DebugSymbolsPath', hermes_plist_file)
          end
        end
      end
    end
  end

end

gvarandas avatar Jan 18 '23 17:01 gvarandas

mmh... I wonder what would happen if we just remove that entry from the hermes-engine.xcframework plist...

For the time being, could you try to use the hermes-engine framework from here: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.71.0/react-native-artifacts-0.71.0-hermes-ios-debug.tar.gz

This should download the debug version which may have the dSYMs.

cipolleschi avatar Jan 18 '23 17:01 cipolleschi

mmh... I wonder what would happen if we just remove that entry from the hermes-engine.xcframework plist

It seems to work fine, as that's what we're effectively doing in our Podfile post_install hook.

gvarandas avatar Jan 18 '23 17:01 gvarandas

Can you help with the post_install hook, that youโ€™re using.

On Wed, 18 Jan 2023 at 11:27 PM, Guilherme Varandas < @.***> wrote:

mmh... I wonder what would happen if we just remove that entry from the hermes-engine.xcframework plist

It seems to work fine, as that's what we're effectively doing in our Podfile post_install hook.

โ€” Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/35863#issuecomment-1387484158, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACD4FMQ2JOOKAFHGDWZDF3TWTAVJRANCNFSM6AAAAAAT6GGTRE . You are receiving this because you commented.Message ID: @.***>

-- Thanks,

Ankit Choraria

ankitjainOfficial avatar Jan 18 '23 18:01 ankitjainOfficial

@ankitjainOfficial It's this one posted above.

gvarandas avatar Jan 18 '23 18:01 gvarandas

For the record, this is what we've setup in our Podfile to avoid the issue for the time being, confirming that removing the Info.plist does, in fact, solve the issue:

post_install do |installer|
  PLIST_BUDDY_PATH = '/usr/libexec/PlistBuddy'

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.name == "hermes-engine"
        installer.pods_project.files.each do |fileref|
          if fileref.path.end_with? "hermes.xcframework"
            hermes_plist_file = "#{fileref.real_path}/Info.plist"
            # Patch Hermes to remove the debug symbols entry from the Info.plist (as it's not shipped with it)
            # This might be removed once Hermes starts to ship with Debug symbols or we remove our
            # direct dependency from the Main iOS target on "hermes.xcframework"
            Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:0:DebugSymbolsPath', hermes_plist_file)
            Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:1:DebugSymbolsPath', hermes_plist_file)
            Open3.capture3(PLIST_BUDDY_PATH, '-c', 'Delete :AvailableLibraries:2:DebugSymbolsPath', hermes_plist_file)
          end
        end
      end
    end
  end

end

Hey @gvarandas, thanks for posting this. I tried to integrating, but always get the outcome uninitialized constant Pod::Podfile::PLIST_BUDDY_PATH when running the post install hooks and is unable to have the pod build.

Did you also encounter this error?

zallanx avatar Feb 03 '23 00:02 zallanx

@zallanx did you declare the PLIST_BUDDY_PATH' constant on the first line of the post_install` block?

PLIST_BUDDY_PATH = '/usr/libexec/PlistBuddy'

It seems like it's either missing or not being properly populate on your end.

gvarandas avatar Feb 03 '23 15:02 gvarandas

Having the same issue RN 0.71.3 but above solution did not work.

jkolivuo avatar Mar 09 '23 16:03 jkolivuo

I had to remove Hermes from BuildPhases -> Link Binary With Libraries

kiprijonas avatar Mar 10 '23 06:03 kiprijonas

Can I ask if some of you have some time to set up a small repro for us? We would like to have this fixed, but so far we are not encountering the problem, so it's a little hard to verify if we are solving it properly. ๐Ÿ˜…

cipolleschi avatar Mar 10 '23 13:03 cipolleschi

Can I ask if some of you have some time to set up a small repro for us? We would like to have this fixed, but so far we are not encountering the problem, so it's a little hard to verify if we are solving it properly. ๐Ÿ˜…

https://github.com/adbs1/35863

This is the result of manually upgrading from 0.70.6 to 0.71.5

image

Let me know if anyone else needs access to it.

adbs1 avatar Mar 29 '23 23:03 adbs1

An update, the problem in my case was old references to hermes.xcframework in the project.pbx.proj file.

There are no references to hermes in the project.pbx.proj file with any new build, nor in the upgrade diff

I removed these lines and it now builds fine:

4909123929060FDB00E97F47 /* hermes.xcframework in Frameworks / = {isa = PBXBuildFile; fileRef = 4909123829060FDB00E97F47 / hermes.xcframework */; };

4909123829060FDB00E97F47 /* hermes.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = hermes.xcframework; path = "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework"; sourceTree = ""; };

4909123929060FDB00E97F47 /* hermes.xcframework in Frameworks */,

4909123829060FDB00E97F47 /* hermes.xcframework */,

adbs1 avatar Mar 30 '23 01:03 adbs1

๐Ÿ˜ฎ Well spotted @adbs1! Thank you for the update!

cipolleschi avatar Mar 30 '23 08:03 cipolleschi

I remove dsym from my infoplist and it worked but I don't know what would be future considerations to fix this problem :)

adnaneghalem avatar Apr 13 '23 20:04 adnaneghalem

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Oct 13 '23 05:10 github-actions[bot]

Can I ask if some of you have some time to set up a small repro for us? We would like to have this fixed, but so far we are not encountering the problem, so it's a little hard to verify if we are solving it properly. ๐Ÿ˜…

https://github.com/adbs1/35863

This is the result of manually upgrading from 0.70.6 to 0.71.5

image

Let me know if anyone else needs access to it.

Any chance of getting ahold of this?

donutdognut avatar Oct 24 '23 17:10 donutdognut

Sorry for this issue. I'll try to have a look at it. I'm still confused as a new app, created from the template, does not suffer from the issue. How do you trigger this?

cipolleschi avatar Oct 25 '23 09:10 cipolleschi

I got the same error, and I found the resolution in a Stackoverflow post:

Basically, the solution is to have everything updated, ruby, gem, and cocoapods. reinstall native dependencies and that it.

Here is the reference: https://stackoverflow.com/questions/70875239/library-not-loaded-rpath-hermes-framework-hermes

AngeeelD avatar Nov 07 '23 17:11 AngeeelD

Hello, Removing the DebugSymbolsPath does not work in 0.73.0-rc.4, also removing references to hermes in the project.pbx.proj does not work either, it gives this error for a release build

PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/runner/Library/Developer/Xcode/DerivedData/mobile-bzmfiinyqlftpnbwrbdhgsnapzrz/Build/Intermediates.noindex/ArchiveIntermediates/mobile/IntermediateBuildFilesPath/mobile.build/Release-iphoneos/mobile.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'mobile' from project 'mobile')

Any ideas?

daviddamilola avatar Nov 28 '23 17:11 daviddamilola

@daviddamilola do you happen to have an easy way to repro the problem? I never hit this issue and without being able to reproduce it, it is very hard for me to work on a durable fix.

cipolleschi avatar Nov 30 '23 13:11 cipolleschi

@daviddamilola Double check your NODE_BINARY variable. I resolved this by setting manually the NODE_BINARY env variable in .xcode.env (or .xcode.env.local). Mine was set automatically by Ruby during pod install to a broken path. Execute which node in a terminal and paste it in the .xcode.env.local

nwilmet-vivlio avatar Dec 07 '23 14:12 nwilmet-vivlio

Not working for me either, im trying to upgrade from 0.72.1 to 0.73.0 and im having this error "Command PhaseScriptExecution failed with a nonzero exit code" which i used to fix it usually by deleting and clean pods and reinstall them but now its not working and keeps giving me this error.

essamabuissa avatar Dec 13 '23 08:12 essamabuissa

@essamabuissa Command PhaseScriptExecution failed with a nonzero exit code this is a pretty generic error output by Xcode. Can you provide the full error for it? You can see it by expanding the error clicking on the 5 horizontal bars at the far right of the error.

OR either, can you provide a reproducer using https://github.com/react-native-community/reproducer-react-native

cipolleschi avatar Dec 18 '23 14:12 cipolleschi

This fails only in CI after upgrading to RN 0.73.2 with the error even after running pod install --repo-update

error: Missing path (/Users/runner/work/app-main/app-main/apps/mobile/ios/Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/dSYMs) from XCFramework 'hermes.xcframework' as defined by 'DebugSymbolsPath' in its `Info.plist` file

@cipolleschi could it be github caches already installed pods from the previous version?

nomadbrine avatar Jan 23 '24 11:01 nomadbrine

RN version: 0.72.6

I ran into this error today. I am able to solve it SIMPLY by deleting hermes under my project > Frameworks

At first I ran into another error: Library not loaded: @rpath/hermes.framework/hermes. Then it brought me to https://github.com/facebook/react-native/issues/34601. Then the error became this one.

So after deleting hermes framework reference under Frameworks folder, Xcode automatically removes hermes framework linking too in project main target config. And finally the app runs normally.

laishere avatar Jan 24 '24 09:01 laishere

This fails only in CI after upgrading to RN 0.73.2 with the error even after running pod install --repo-update

error: Missing path (/Users/runner/work/app-main/app-main/apps/mobile/ios/Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/dSYMs) from XCFramework 'hermes.xcframework' as defined by 'DebugSymbolsPath' in its `Info.plist` file

@cipolleschi could it be github caches already installed pods from the previous version?

Hey,I am also facing the same issue. Any idea on how you solved it?

tshedawa avatar Mar 04 '24 10:03 tshedawa

An update, the problem in my case was old references to hermes.xcframework in the project.pbx.proj file.

There are no references to hermes in the project.pbx.proj file with any new build, nor in the upgrade diff

I removed these lines and it now builds fine:

4909123929060FDB00E97F47 /* hermes.xcframework in Frameworks / = {isa = PBXBuildFile; fileRef = 4909123829060FDB00E97F47 / hermes.xcframework */; };

4909123829060FDB00E97F47 /* hermes.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = hermes.xcframework; path = "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework"; sourceTree = ""; };

4909123929060FDB00E97F47 /* hermes.xcframework in Frameworks */,

4909123829060FDB00E97F47 /* hermes.xcframework */,

@adbs1 which file has these lines? i cant find.

sgshy1995 avatar Mar 14 '24 06:03 sgshy1995