ammarahm-ed / react-native-mmkv-storage

An ultra fast (0.0002s read/write), small & encrypted mobile key-value storage framework for React Native written in C++ using JSI
https://rnmmkv.now.sh
MIT License
1.56k stars 109 forks source link

[Bug] Duplicate symbol for architecture x86_64 issue due to conflict of same method name as another library #323

Closed Alka1703 closed 8 months ago

Alka1703 commented 1 year ago

Describe the bug Add react-native-secure-key-store and react-native-mmkv-storage to a project and compile it for iOS.

When running the project we get the error: › Linking injiexpo2 » injiexpo2

❌ duplicate symbol '_secureKeyStoreError' in ┌─ libreact-native-mmkv-storage.a(SecureStorage.o) └─ libreact-native-secure-key-store.a(RNSecureKeyStore.o)

❌ ld: 1 duplicate symbol for architecture x86_64

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

To Reproduce Steps to reproduce the behavior:

  1. Create a empty react native project.
  2. Add react-native-secure-key-store and react-native-mmkv-storage to a project.
  3. Run the command npm run
  4. See the error Screenshot 2023-04-18 at 12 54 30 PM

Platform Information:

Additional context The error is due to the conflicting method name secureKeyStoreError in both the libraries. The same method is present in SecureStorage.m file in mmkv-storage library and in RNSecureKeyStore.m file in secure-key-store library. We have tried to understand the usage of this method in the mmkv-storage code and couldn't find any usages/references for the same.

In order to resolve the issue, we tried removing the method and also tried renaming it, both seems to work.

  1. Can you confirm if this is an unused method, if so, do you have plans to remove it in the upcoming releases.
  2. If this is a method used somewhere which we couldn't figure out as of now. We would like understand about it and a way to resolve this conflict.
ravikp commented 1 year ago

Or are there any other solutions to resolve name conflicts when building react native app with different libraries?

ammarahm-ed commented 8 months ago

This has been fixed in v0.10.0