Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFI fails loading dynamic library in 2.5.0 #38288

Closed
mit-mit opened this issue Sep 10, 2019 · 5 comments · Fixed by dart-lang/samples#3
Closed

FFI fails loading dynamic library in 2.5.0 #38288

mit-mit opened this issue Sep 10, 2019 · 5 comments · Fixed by dart-lang/samples#3
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends.

Comments

@mit-mit
Copy link
Member

mit-mit commented Sep 10, 2019

Repro steps:

Error:

$ dart macos.dart
Unhandled exception:
Invalid argument(s): Failed to load dynamic library (dlopen(libSystem.dylib, 1): image not found)
#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      system (file:///Users/mit/tmp/samples/ffi/system-command/macos.dart:28:36)
#3      main (file:///Users/mit/tmp/samples/ffi/system-command/macos.dart:9:16)
#4      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:19)
#5      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
| ~/tmp/samples/ffi/system-command @ mit-macbookpro3 (mit)
@sjindel-google
Copy link
Contributor

@mit-mit -- you said it's fixed on master, right?

@mraleph mraleph added the area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. label Sep 10, 2019
@mit-mit
Copy link
Member Author

mit-mit commented Sep 10, 2019

This is fixed on master, and we're working on publishing a Dart 2.6.0-dev build that should also have a fix. I logged this to ensure those that encounter issues could search for it, and fine the workaround (use 2.6 dev).

@mit-mit
Copy link
Member Author

mit-mit commented Sep 10, 2019

@sjindel-google can you check if we have an integration test to prevent this from happening again?

@sjindel-google
Copy link
Contributor

It doesn't appear to be an issue with 2.5.0 vs 2.6.0-dev; the problem is that after dart is signed, the system load path is changed. You can use DynamicLibrary.open('/usr/lib/libSystem.dylib') instead.

@mit-mit
Copy link
Member Author

mit-mit commented Sep 10, 2019

Yes, confirmed that this works as expected on Windows

mit-mit added a commit to dart-lang/samples that referenced this issue Sep 10, 2019
Ensure lib-system lookup works in signed Dart SDK builds

Fixes dart-lang/sdk#38288
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants