Failed to load dynamic library

2020-10-16  本文已影响0人  居家杂谈

dart ffi 的 helloworld sample 跑不起来

Unhandled exception:

Invalid argument(s): Failed to load dynamic library (dlopen(./hello_library/libhello.dylib, 1): no suitable image found.  Did find:

        file system relative paths not allowed in hardened programs)

#0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:55)

#1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:20:12)

#2      main (file:///Users/chenjiangfeng/github/dart-samples/ffi/hello_world/hello.dart:18:36)

#3      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:301:19)

#4      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

签名问题。

dart sdk已经签名了,要调用dylib,被调用的dylib需要跟dart同签名才行,但你又没有dart sdk的签名。

解决方法:清除dart sdk的签名

codesign --remove-signature`which dart`

上一篇下一篇

猜你喜欢

热点阅读