kevlened / isomorphic-webcrypto

:game_die: webcrypto library for Node, React Native and IE11+
https://www.w3.org/TR/WebCryptoAPI/
MIT License
116 stars 43 forks source link

Migrate to Expo-Modules for Expo SDK 43 and newer #65

Open Termtime opened 2 years ago

Termtime commented 2 years ago

Using React : 17.0.2 react-native: 0.67.0 Expo SDK: 44 (Bare)

We are using this library due to the webcrypto polyfill.

This library is using expo unimodules, which causes a duplicate symbol issue on iOS, UMReactNativeAdapter belongs to expo unimodules. Could we get a version in which we don't depend on unimodules please? I would contribute but I currently have no idea how you have it set up for react-native support. No issues on Android

linking ProjectName

❌  duplicate symbol '_EXCanAskAgain' in
> libExpoModulesCore.a(EXPermissionsService.o)
> UMReactNativeAdapter(EXPermissionsService.o)

❌  duplicate symbol '_EXExpiresKey' in
> libExpoModulesCore.a(EXPermissionsService.o)
> UMReactNativeAdapter(EXPermissionsService.o)

❌  duplicate symbol '_EXGrantedKey' in
> libExpoModulesCore.a(EXPermissionsService.o)
> UMReactNativeAdapter(EXPermissionsService.o)

❌  duplicate symbol '_EXPermissionExpiresNever' in
> libExpoModulesCore.a(EXPermissionsService.o)
> UMReactNativeAdapter(EXPermissionsService.o)

❌  duplicate symbol '_EXStatusKey' in
> libExpoModulesCore.a(EXPermissionsService.o)
> UMReactNativeAdapter(EXPermissionsService.o)

❌  duplicate symbol '_OBJC_CLASS_$_EXPermissionsService' in
> libExpoModulesCore.a(EXPermissionsService.o)
> UMReactNativeAdapter(EXPermissionsService.o)

❌  duplicate symbol '_OBJC_IVAR_$_EXPermissionsService._moduleRegistry' in
> libExpoModulesCore.a(EXPermissionsService.o)
> UMReactNativeAdapter(EXPermissionsService.o)

❌  duplicate symbol '_OBJC_IVAR_$_EXPermissionsService._requesters' in
> libExpoModulesCore.a(EXPermissionsService.o)
> UMReactNativeAdapter(EXPermissionsService.o)

❌  duplicate symbol '_OBJC_IVAR_$_EXPermissionsService._requestersByClass' in
> libExpoModulesCore.a(EXPermissionsService.o)
> UMReactNativeAdapter(EXPermissionsService.o)

❌  duplicate symbol '_OBJC_METACLASS_$_EXPermissionsService' in
> libExpoModulesCore.a(EXPermissionsService.o)
> UMReactNativeAdapter(EXPermissionsService.o)

❌  duplicate symbol '_OBJC_CLASS_$_EXReactNativeUserNotificationCenterProxy' in
> libExpoModulesCore.a(EXReactNativeUserNotificationCenterProxy.o)
> UMReactNativeAdapter(EXReactNativeUserNotificationCenterProxy.o)

❌  duplicate symbol '_OBJC_METACLASS_$_EXReactNativeUserNotificationCenterProxy' in
> libExpoModulesCore.a(EXReactNativeUserNotificationCenterProxy.o)
> UMReactNativeAdapter(EXReactNativeUserNotificationCenterProxy.o)

❌  ld: 12 duplicate symbols for architecture x86_64

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

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening ProjectName.xcworkspace.
info Run CLI with --verbose flag for more details.
olivierpascal commented 2 years ago

+1

marcato15 commented 2 years ago

+1

charlestbell commented 2 years ago

+1

charlestbell commented 2 years ago

I found a temporary workaround, which is to use Expo's classic build service, instead of their newer EAS build service. Unfortunately, the classic build service is deprecated and goes offline in about 160 days. So I'm reaching out to them and see if they can get EAS build to work like classic in this regard, or hold off on deprecating classic.

charlestbell commented 1 year ago

Update: The EAS guys gave a kind of "not my problem" response. I also reached out to the guys in charge of microsoft's @azure/cosmos package and they're investigating finding a replacement for this package.

TimoGlastra commented 1 year ago

For yarn I found the following resolutions 'hack' to be working:

{
  // ... other package.json options ...
  "resolutions": {
    "@unimodules/react-native-adapter": "./node_modules/expo"
  }
}
TimoGlastra commented 1 year ago

I think this should be fixable by removing the dependency on the unimodules and instead updating to the expo modules. Not sure why it is needed to depend on the unimodules in the first place, couldn't we directly depend on expo-random?

@kevlened would you accept a PR for this change?

czy0729 commented 1 year ago

@TimoGlastra i solve the problem right now. I've been trying to fix this for 50 hours, any solution that can be found is invalid. at last i just remove @unimodules/core and @unimodules/react-native-adapter in package.json which tell you to migrating expo under 44 to expo modules at first https://github.com/expo/fyi/blob/master/expo-modules-migration.md#migrating-to-expo-modules. then the build pass oh god.