TinoGuo / r_crypto

🦀🦀 High performance Crypto library of Rust implementation for Flutter
MIT License
31 stars 8 forks source link

Invalid argument(s): Failed to lookup symbol (dlsym(RTLD_DEFAULT, rust_cstr_free): symbol not found) #23

Closed mikeooye closed 3 years ago

mikeooye commented 3 years ago

Code below work fine on iOS simulator and Android devices, but throw exception on iOS devices.

var ret = rHash.filePath(HashType.SHA3_224, path);

The stack is

[VERBOSE-2:ui_dart_state.cc(199)] Unhandled Exception: Invalid argument(s): Failed to lookup symbol (dlsym(RTLD_DEFAULT, rust_cstr_free): symbol not found)
#0      DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:31)
dart-lang/ffi#1      _Loader.freeCString (package:r_crypto/src/basic/loader.dart)
package:r_crypto/…/basic/loader.dart:1
dart-lang/ffi#2      _GrowableList.forEach (dart:core-patch/growable_array.dart)
dart-lang/ffi#3      _Loader.freeCStrings (package:r_crypto/src/basic/loader.dart:72)
dart-lang/ffi#4      _Hash.filePath (package:r_crypto/src/hash.dart:142)
dart-lang/ffi#5      ObjectNameGenerator.getKey (package:aliyun_oss/src/name_generator.dart:10)
dart-lang/ffi#6      ObjectNameGenerator.getName (package:aliyun_oss/src/name_generator.dart:33)
dart-lang/ffi#7      AliyunOss.getObjectName (package:aliyun_oss/src/aliyun_oss.dart:345)
dart-lang/ffi#8      _MessageSessionDetailPageState._uploadFile (package:flutter_yuanling_app/message_module/view/message_session_detail_page.dart:1391)
dart-lang/ffi#9      _MessageSessionDetailPageState._buildChatInput.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter_yuanling_app/message_module/view/message_session_detail_page.dart:712)
<asynchronous suspension>
TinoGuo commented 3 years ago

@mikeooye can u follow example? I used the iPhone device, all looks good

mikeooye commented 3 years ago

Sorry,I just saw your email. I missed a condition, you should run the example in release mode.

TinoGuo commented 3 years ago

https://github.com/dart-lang/native/issues/897 I added dummy method to avoid swift optimisation, I verified in profile, it should work from 0.5.0