It looks like https://github.com/dart-lang/sdk/issues/38288 has started happening again.
cd c && make dylibcd .. && dart hello.dartdart hello.dart
Unhandled exception:
Invalid argument(s): Failed to load dynamic library (dlopen(hello_world.dylib, 1): no suitable image found. Did find:
hello_world.dylib: code signature in (hello_world.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.)
#0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:10:55)
#1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:17:12)
#2 main (file:///Users/ryjohn/code/github/dart-lang/samples/ffi/hello_world/hello.dart:17:36)
#3 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:19)
#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
cc: @mit-mit @mjohnsullivan
I've tried using Apple's codesign tool to ad-hoc sign the library, but it's still not working:
codesign -f -s - hello_world.dylib
dart hello.dart
Unhandled exception:
Invalid argument(s): Failed to load dynamic library (dlopen(hello_world.dylib, 1): no suitable image found. Did find:
hello_world.dylib: code signature in (hello_world.dylib) not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?))
#0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:10:55)
#1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:17:12)
#2 main (file:///Users/ryjohn/code/github/dart-lang/samples/ffi/hello_world/hello.dart:17:36)
#3 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:19)
#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
cc @dcharkes I think this isn't #38288 , but rather #38314 ?
Yeah, this is a duplicate of #38314, please add more details there.
I have a slightly different error:
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)
Update:
Fixed with executing
codesign --remove-signature /usr/local/bin/dart
Most helpful comment
I have a slightly different error:
Update:
Fixed with executing
codesign --remove-signature /usr/local/bin/dart