-
Notifications
You must be signed in to change notification settings - Fork 1.7k
dart-ext loading does not work when using package urls #6264
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
Comments
This looks like an issue with the package manager. We need to decide if extensions will be hosted by pub, and how it will download their native libraries. A dart-ext:foo URL for a library import means that the loader will look for a native shared library named foo.dll, libfoo.so, or libfoo.dylib, load it, and run the init_foo function from it. So if we want the package manager to handle this, it must download the appropriate shared library. and place it in the right directory relative to the importing library. In the example, even if the library is in the right place in the packages cache, the relative URL is not being found correctly. That is an issue that will need to be fixed in IO - perhaps just recognizing the package: scheme. So there is an IO component to this as well. cc @munificent. |
Marked this as blocking #6290. |
I have separated out the package manager aspect of this problem, and filed issue dart:6290 about it. So this bug is just tracking the handling of dart-ext imports into a library that has been loaded with a package: scheme in its URL. Changing the area back to IO. |
This comment was originally written by @mezoni
You have an interesting approach to what you do defective. It is interesting to know your opinion. extensions.cc Dart_Handle Extensions::LoadExtension(const char* extension_url, return Dart_Error("unexpected error in library path"); May be change this to Let's discuss this new error message in the mail list? |
Added Fixed label. |
This comment was originally written by @mezoni I do not agree with the premise that fixed. cannot find extension library'package:sample/src/sample_extension.dart': Error: line 3 pos 1: library handler failed Previously, it was "unexpected error in library path". Tested on on the bleeding edge (15292) P.S. |
If it works to import '../lib/sample.dart' the package import should probably be 'package:sample/lib/sample.dart' since the file is in a lib directory? I haven't been following how pub deals with these. However, I did change more than just the error message. ;-) On the VM, the 'package:' URIs are resolved relative to the package-root given to the VM. As far as I know, put uses symlinks to bind that with the layout of package, but maybe Bob can help more there? Here is how I tested this patch: Right after building, copy the test extension to a new directory.
Create the file /tmp/test/test.dart with the following contents: import 'package:test_extension.dart'; main() { Now, test it from the command-line passing in the package-root to the VM.
So, the basic VM support seems to be working. |
Hey, Mads. When I try your repro steps, I get: dyld: lazy symbol binding failed: Symbol not found: _Dart_IsError dyld: Symbol not found: _Dart_IsError Is there something I'm missing? |
Yes, I think you are building with the wrong target SDK. Are you using the same SDK for building and for target deployment: { You will see that issue if you only set mac_sdk and not mac_deployment_target. |
Oh, and in any case that means that the system did find the extension and loaded it properly. Something then went wrong with looking up symbols from the Dart C embedding API from the extension code. |
This comment was originally written by @mezoni Here is answers to your questions. Attachment: |
This comment was originally written by @mezoni Agree fixed. |
Issue #6924 has been merged into this issue. |
Removed Area-IO label. |
From email thread on misc mailing list:
Here is pseudo-code.
------------- package 'some'---------------
==lib/src/some_extension.dart
import "dart-ext:some_extension";
==EOF
==lib/some.dart
library some;
import 'src/some_extension.dart';
export 'src/some_extension.dart';
==EOF
Inside package all works fine.
--------- application 'mayapp'-------------
Variant #1 (WORKING, NO PROBLEM)
==myapp.dart
import '../path/to/some/package/some.dart';
Variant #2 (NOT WORKING, PROBLEMATIC)
==myapp.dart
import 'package:some/some.dart';
unexpected error in library path'package:some/src/some_extension.dart': Error: line 1 pos 1: library handler failed
import 'dart-ext:some_extension';
^
'package:some/some.dart': Error: line 3 pos 1: library handler failed
import 'src/some_extension.dart';
^
The text was updated successfully, but these errors were encountered: