decentralized-identity / veramo

A JavaScript Framework for Verifiable Data
https://veramo.io
Apache License 2.0
414 stars 130 forks source link

Expo-managed react native "eject" (or prebuild) build error (duplicate symbols) #1381

Open aureat opened 2 months ago

aureat commented 2 months ago

Bug When you run on a physical device with expo run:ios, the error says ld: 12 duplicate symbols.

To Reproduce Steps to reproduce the behaviour:

  1. Follow the exact same steps from the official React Native Tutorial https://veramo.io/docs/react_native_tutorials/react_native_1_setup_identifiers
  2. Run npx expo prebuild --platform ios
  3. Change deployment target to > iOS 13.4
  4. Run npx expo run:ios --device, run on a physical device

Observed behaviour All of the build phases go through as below:

› Executing expo-random Pods/ExpoRandom » Copy generated compatibility header
› Compiling Pods/Pods-VaulletMobile » Pods-VaulletMobile-dummy.m
› Packaging Pods/Pods-VaulletMobile » libPods-VaulletMobile.a
› Executing VaulletMobile » [CP] Check Pods Manifest.lock
› Executing VaulletMobile » Start Packager on http://localhost:8081
› Executing VaulletMobile » [Expo] Configure project
› Copying   ios/VaulletMobile/Supporting/Expo.plist ➜ ./Expo.plist
› Compiling VaulletMobile » SplashScreen.storyboard
› Compiling VaulletMobile » main.m
› Compiling VaulletMobile » VaulletMobile_vers.c
› Compiling VaulletMobile » AppDelegate.mm
› Preparing VaulletMobile » Info.plist
› Linking   VaulletMobile » VaulletMobile

Until in the last phase it results in a build error with ld: 12 duplicate symbols.

Expected behaviour I have tested veramo with another expo-managed react native project, it worked, compiled, and ran perfectly. This error started popping up within the last 48-72 hours.

Details

❌  duplicate symbol '_EXExpiresKey' in
┌─ libExpoModulesCore.a[23](EXPermissionsService.o)
└─ UMReactNativeAdapter[3](EXPermissionsService.o)

❌  duplicate symbol '_EXGrantedKey' in
┌─ libExpoModulesCore.a[23](EXPermissionsService.o)
└─ UMReactNativeAdapter[3](EXPermissionsService.o)

❌  duplicate symbol '_OBJC_CLASS_$_EXReactNativeUserNotificationCenterProxy' in
┌─ libExpoModulesCore.a[35](EXReactNativeUserNotificationCenterProxy.o)
└─ UMReactNativeAdapter[4](EXReactNativeUserNotificationCenterProxy.o)

❌  duplicate symbol '_OBJC_IVAR_$_EXPermissionsService._requesters' in
┌─ libExpoModulesCore.a[23](EXPermissionsService.o)
└─ UMReactNativeAdapter[3](EXPermissionsService.o)

❌  duplicate symbol '_OBJC_IVAR_$_EXPermissionsService._requestersByClass' in
┌─ libExpoModulesCore.a[23](EXPermissionsService.o)
└─ UMReactNativeAdapter[3](EXPermissionsService.o)

❌  duplicate symbol '_EXStatusKey' in
┌─ libExpoModulesCore.a[23](EXPermissionsService.o)
└─ UMReactNativeAdapter[3](EXPermissionsService.o)

❌  duplicate symbol '_OBJC_IVAR_$_EXPermissionsService._moduleRegistry' in
┌─ libExpoModulesCore.a[23](EXPermissionsService.o)
└─ UMReactNativeAdapter[3](EXPermissionsService.o)

❌  duplicate symbol '_EXCanAskAgain' in
┌─ libExpoModulesCore.a[23](EXPermissionsService.o)
└─ UMReactNativeAdapter[3](EXPermissionsService.o)

❌  duplicate symbol '_OBJC_METACLASS_$_EXPermissionsService' in
┌─ libExpoModulesCore.a[23](EXPermissionsService.o)
└─ UMReactNativeAdapter[3](EXPermissionsService.o)

❌  duplicate symbol '_OBJC_METACLASS_$_EXReactNativeUserNotificationCenterProxy' in
┌─ libExpoModulesCore.a[35](EXReactNativeUserNotificationCenterProxy.o)
└─ UMReactNativeAdapter[4](EXReactNativeUserNotificationCenterProxy.o)

❌  duplicate symbol '_EXPermissionExpiresNever' in
┌─ libExpoModulesCore.a[23](EXPermissionsService.o)
└─ UMReactNativeAdapter[3](EXPermissionsService.o)

❌  duplicate symbol '_OBJC_CLASS_$_EXPermissionsService' in
┌─ libExpoModulesCore.a[23](EXPermissionsService.o)
└─ UMReactNativeAdapter[3](EXPermissionsService.o)

❌  ld: 12 duplicate symbols

❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » VaulletMobile/VaulletMobile » Build Phases » 'Start Packager'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script

⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » VaulletMobile/VaulletMobile » Build Phases » 'Bundle React Native code and images'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script

› 14 error(s), and 3 warning(s)

CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.

Versions: Exact versions as the official react native guide and the react native tutorial repository: https://veramo.io/docs/react_native_tutorials/react_native_1_setup_identifiers https://github.com/veramolabs/veramo-react-native-tutorial/blob/main/package.json

aureat commented 2 months ago

https://github.com/expo/expo/issues/15648

aureat commented 2 months ago

https://stackoverflow.com/questions/24298144/duplicate-symbols-for-architecture-x86-64-under-xcode

aureat commented 2 months ago

Update The duplicate symbols are coming from @unimodules/react-native-adapter, depended on by isomorphic-webcrypto. Here's the appropriate code from my package-lock.json:

    "node_modules/isomorphic-webcrypto": {
      "version": "2.3.8",
      "resolved": "https://registry.npmjs.org/isomorphic-webcrypto/-/isomorphic-webcrypto-2.3.8.tgz",
      "integrity": "sha512-XddQSI0WYlSCjxtm1AI8kWQOulf7hAN3k3DclF1sxDJZqOe0pcsOt675zvWW91cZH9hYs3nlA3Ev8QK5i80SxQ==",
      "optional": true,
      "dependencies": {
        "@peculiar/webcrypto": "^1.0.22",
        "asmcrypto.js": "^0.22.0",
        "b64-lite": "^1.3.1",
        "b64u-lite": "^1.0.1",
        "msrcrypto": "^1.5.6",
        "str2buf": "^1.3.0",
        "webcrypto-shim": "^0.1.4"
      },
      "optionalDependencies": {
        "@unimodules/core": "*",
        "@unimodules/react-native-adapter": "*",
        "expo-random": "*",
        "react-native-securerandom": "^0.1.1"
      }
    },
vadimchilinciuc commented 1 month ago

its possible to remove the dependecy of isomorphic-webcrypto in DidCom ? Cause its need to Migrate to Expo-Modules for Expo SDK 43 and newer, and not use unimodules-core but expo-modules instead.

mirceanis commented 5 days ago

its possible to remove the dependecy of isomorphic-webcrypto in DidCom ? Cause its need to Migrate to Expo-Modules for Expo SDK 43 and newer, and not use unimodules-core but expo-modules instead.

sadly we can't remove isomorphic-webcrypto as we don't have an alternative yet

mirceanis commented 5 days ago

@vadimchilinciuc @aureat maybe if enough people insist here: https://github.com/paulmillr/noble-ciphers/issues/12 we could get a pure JS implementation. I believe AESKW is the last algorithm for which we don't have multi-platform alternatives and that is a requirement in didcomm