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.61k stars 114 forks source link

[ios] Undefined symbols for architecture x86_64 #96

Open troZee opened 3 years ago

troZee commented 3 years ago

When I added this library to my project, I can't built it, due below error:

Undefined symbols for architecture x86_64:
  "facebook::jsi::Value::Value(facebook::jsi::Runtime&, facebook::jsi::Value const&)", referenced from:
      facebook::jsi::detail::toValue(facebook::jsi::Runtime&, facebook::jsi::Value const&) in YeetJSIUtils.o
  "facebook::jsi::Value::Value(facebook::jsi::Value&&)", referenced from:
      void std::__1::allocator<facebook::jsi::Value>::construct<facebook::jsi::Value, facebook::jsi::Value>(facebook::jsi::Value*, facebook::jsi::Value&&) in YeetJSIUtils.o
  "facebook::jsi::Object::getPropertyAsFunction(facebook::jsi::Runtime&, char const*) const", referenced from:
      createPromiseAsJSIValue(facebook::jsi::Runtime&, std::__1::function<void (facebook::jsi::Runtime&, std::__1::shared_ptr<Promise>)>) in YeetJSIUtils.o
  "facebook::jsi::Value::~Value()", referenced from:
      void facebook::jsi::Object::setProperty<facebook::jsi::Function>(facebook::jsi::Runtime&, facebook::jsi::String const&, facebook::jsi::Function&&) in MMKVNative.o
      facebook::jsi::Value::Value(facebook::jsi::Runtime&, facebook::jsi::Object const&) in MMKVNative.o
      facebook::jsi::Value::Value<facebook::jsi::String>(facebook::jsi::String&&) in MMKVNative.o
      facebook::jsi::Value::Value<facebook::jsi::Array>(facebook::jsi::Array&&) in MMKVNative.o
      convertNSDictionaryToJSIObject(facebook::jsi::Runtime&, NSDictionary*) in YeetJSIUtils.o
      convertNSArrayToJSIArray(facebook::jsi::Runtime&, NSArray*) in YeetJSIUtils.o
      convertNSArrayToStdVector(facebook::jsi::Runtime&, NSArray*) in YeetJSIUtils.o
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Below you can find a pod file

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'
use_frameworks!

def shared_dependencies()
    # Other pods
    pod 'AppCenter', '1.13.1'
    pod 'PromiseKit', '~> 6.0'
end

target 'MyApp' do
    config = use_native_modules!
    use_react_native!(:path => config["reactNativePath"])
    shared_dependencies()

end

Maybe it is related to use_frameowork issue ?

ammarahm-ed commented 3 years ago

I will investigate. I haven't used the lib with use_frameworks!

sejoDjoseon commented 3 years ago

I'm having the same issue.

react-native: 0.65.1 react-native-mmkv-storage: 0.6.3

using use_frameworks!

i814u2 commented 2 years ago

This is failing for me, as well.

Some setup details...

Podfile:

platform :ios, '14.0'
use_frameworks! 

Installed versions:

react-native: 0.67.1
react-native-mmkv-storage: 0.6.12

I'm on a machine with Apple Silicon, in case that matters.

I also tried to specifically set the deployment target, just to be sure:

config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'

I've tried various deployment target versions, but with no luck. If there are any other details that I can provide, please let me know.

nathantqn commented 2 years ago

Hi @ammarahm-ed , do you have any news on this, I just installed the latest version of react-native-mmkv-storage and got the same issue.

image

I'm also using use_framework!

lungisa-yoco commented 2 years ago

Hi, we had a similar problem in one of our older apps that use use_framework, and we solved the problem by marking the specific framework as static. Maybe this will help.

# An example list of static frameworks
$static_frameworks = [
  'react-native-mmkv-storage'
]

# Pre install that looks through a list of static frameworks
pre_install do |installer|
  Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

  installer.pod_targets.each do |target|
    if $static_frameworks.include?(target.name)
      puts "Overriding the static_framework method for #{target.name}"
      def target.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end
devonbrackbill commented 2 years ago

Note that you may need to change the above response to refer to react-native-mmkv-storage, not react-native-mmkv. So I think this line should be:

$static_frameworks = [
  'react-native-mmkv-storage'
]
ammarahm-ed commented 2 years ago

Maybe this should be added to the docs.

shadyashraf96 commented 2 years ago

Hi, we had a similar problem in one of our older apps that use use_framework, and we solved the problem by marking the specific framework as static. Maybe this will help.

# An example list of static frameworks
$static_frameworks = [
  'react-native-mmkv-storage'
]

# Pre install that looks through a list of static frameworks
pre_install do |installer|
  Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

  installer.pod_targets.each do |target|
    if $static_frameworks.include?(target.name)
      puts "Overriding the static_framework method for #{target.name}"
      def target.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end

This solution created another issue for me.

Details

This app could not be installed at this time.
Domain: IXUserPresentableErrorDomain
Code: 1
Failure Reason: Could not install at this time.
Recovery Suggestion: Failed to load Info.plist from bundle at path /Users/shady/Library/Developer/CoreSimulator/Devices/77AA2D18-DF74-48B2-94A1-CA4E8842FAE1/data/Library/Caches/com.apple.mobile.installd.staging/temp.OeJrGX/extracted/Payload/gofabrekaclient.app/Frameworks/RCTVibration.framework; Extra info about plist: ACL=<not found> 
User Info: {
    DVTErrorCreationDateKey = "2022-09-21 23:57:55 +0000";
    IDERunOperationFailingWorker = IDELaunchiPhoneSimulatorLauncher;
}
--
Failed to load Info.plist from bundle at path /Users/shady/Library/Developer/CoreSimulator/Devices/77AA2D18-DF74-48B2-94A1-CA4E8842FAE1/data/Library/Caches/com.apple.mobile.installd.staging/temp.OeJrGX/extracted/Payload/gofabrekaclient.app/Frameworks/RCTVibration.framework; Extra info about plist: ACL=<not found> 
Domain: MIInstallerErrorDomain
Code: 35
User Info: {
    FunctionName = "-[MIBundle _validateWithError:]";
    LegacyErrorString = PackageInspectionFailed;
    SourceFileLine = 128;
}
--

Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : {
    "device_model" = "iPhone12,1";
    "device_osBuild" = "13.7 (17H22)";
    "device_platform" = "com.apple.platform.iphonesimulator";
    "launchSession_schemeCommand" = Run;
    "launchSession_state" = 1;
    "launchSession_targetArch" = "x86_64";
    "operation_duration_ms" = 1087;
    "operation_errorCode" = 1;
    "operation_errorDomain" = IXUserPresentableErrorDomain;
    "operation_errorWorker" = IDELaunchiPhoneSimulatorLauncher;
    "operation_name" = IDERunOperationWorkerGroup;
    "param_consoleMode" = 0;
    "param_debugger_attachToExtensions" = 0;
    "param_debugger_attachToXPC" = 1;
    "param_debugger_type" = 3;
    "param_destination_isProxy" = 0;
    "param_destination_platform" = "com.apple.platform.iphonesimulator";
    "param_diag_MainThreadChecker_stopOnIssue" = 0;
    "param_diag_MallocStackLogging_enableDuringAttach" = 0;
    "param_diag_MallocStackLogging_enableForXPC" = 1;
    "param_diag_allowLocationSimulation" = 1;
    "param_diag_gpu_frameCapture_enable" = 0;
    "param_diag_gpu_shaderValidation_enable" = 0;
    "param_diag_gpu_validation_enable" = 0;
    "param_diag_memoryGraphOnResourceException" = 0;
    "param_diag_queueDebugging_enable" = 1;
    "param_diag_runtimeProfile_generate" = 0;
    "param_diag_sanitizer_asan_enable" = 0;
    "param_diag_sanitizer_tsan_enable" = 0;
    "param_diag_sanitizer_tsan_stopOnIssue" = 0;
    "param_diag_sanitizer_ubsan_stopOnIssue" = 0;
    "param_diag_showNonLocalizedStrings" = 0;
    "param_diag_viewDebugging_enabled" = 1;
    "param_diag_viewDebugging_insertDylibOnLaunch" = 1;
    "param_install_style" = 0;
    "param_launcher_UID" = 2;
    "param_launcher_allowDeviceSensorReplayData" = 0;
    "param_launcher_kind" = 0;
    "param_launcher_style" = 0;
    "param_launcher_substyle" = 0;
    "param_runnable_appExtensionHostRunMode" = 0;
    "param_runnable_productType" = "com.apple.product-type.application";
    "param_runnable_swiftVersion" = "5.6.1";
    "param_runnable_type" = 2;
    "param_testing_launchedForTesting" = 0;
    "param_testing_suppressSimulatorApp" = 0;
    "param_testing_usingCLI" = 0;
    "sdk_canonicalName" = "iphonesimulator15.5";
    "sdk_osVersion" = "15.5";
    "sdk_variant" = iphonesimulator;
}
--

System Information

macOS Version 12.0.1 (Build 21A559)
Xcode 13.4 (20503) (Build 13F17a)
Timestamp: 2022-09-22T01:57:55+02:00

I'd be really grateful if anyone can help me. @ammarahm-ed

mkilincaslan commented 2 years ago

Hi, we had a similar problem in one of our older apps that use use_framework, and we solved the problem by marking the specific framework as static. Maybe this will help.

# An example list of static frameworks
$static_frameworks = [
  'react-native-mmkv-storage'
]

# Pre install that looks through a list of static frameworks
pre_install do |installer|
  Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

  installer.pod_targets.each do |target|
    if $static_frameworks.include?(target.name)
      puts "Overriding the static_framework method for #{target.name}"
      def target.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end

Thank you that worked for me! 🙏