-
-
Notifications
You must be signed in to change notification settings - Fork 169
flutter-pi AOT support #65
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
Yep, that's a good idea. Unfortunately, the wiki page you linked is outdated, dart AOT snapshots no longer work that way. However, the API flutter provides to embedders doesn't support the new way AOT snapshots work either. So right now it's impossible / very hard to get AOT to work, until the features from this issue become available in flutter stable. |
Thanks to @ardera . 1. choose one flutter version, for example I used 1.17.22. download the engine source code according to the flutter version.
If the engine mismatch with the flutter tool, it will encounter the following error.
3. build the engine source for my target device.4. following the hard way stepsTake the myapp as example, cd flutter-engine/engine/src We get build/kernel_snapshot.dill now. out/linux_release_arm/clang_x64/gen_snapshot --causal_async_stacks --deterministic --snapshot_kind=app-aot-elf --elf=myapp/build/aot/app.so --strip --sim_use_hardfp --no-use-integer-division build/kernel_snapshot.dill We get app.so for our target device. 5. readelf -a app.soI only paste the information we need as below.
As @ardera told me by email:
For now I hard code the section sizes, which can be parsed by code like "readelf" does. Then flutter project myapp works in AOT mode on my target device. References |
Thanks @stonezju ! I haven't thought of just hardcoding the section sizes or letting the user specify them. That's a great idea actually. |
I haven't got too much time to parse the sizes by code, so just use hardcode hex numbers now. |
... Do you have any problem with ldd and dlopen("libapp.so",RTLD_LAZY)? |
The issue with ldd might be that the so built is a ARM library and you are trying ldd from Linux system. try file on your so and verify that it's an ARM library. Also try the below command to list the symbols in your binary. nm -gD |
Yes i ran ldd on RaPi4. |
@limbouser
|
why use
I'm not sure that's the case, format of the
Why, when there's |
@ardera because dlopen doesn't open libapp.so. It is same problem meta-flutter/flutter_embedded#36 |
I found solution:
Output:
|
The reason one would use The engineers behind the flutter engine themselves suggested to use |
@ardera Yes, it is not run
I don't understand why dlopen doesn't work. (clang 8.0?) |
@DisDis Can you try running |
strace /lib/ld-linux-armhf.so.3 --verify ./libapp.so
|
readelf -S ./libapp.so
section (.ARM.attributes [ARM_ATTRIBUTES] )is missing |
readelf -A ./libapp.so For example:
|
Ok finally, i copy section '.ARM.attributes' from ./libflutter_engine.so to libapp.so Change '.ARM.attributes' type to 0x70000003 (ARM_ATTRIBUTES) @ardera
Instruction:
|
Yes it is AOT, i run old flutter-pi w/o AOT config and i got output:
I'm preparing MR |
I also just noticed these comments in the Also, you can also compile a dart kernel snapshot to assembly using |
@DisDis can you try if AOT works for you with the newest version of flutter-pi? I'm getting a SIGBUS somehow (an alignment exception to be precise) but I don't know if that's caused by flutter-pi, the engine, or the AOT snapshot |
@ardera
whereis libdrm UPDATE: |
@ardera
|
Thanks @DisDis Then the issue was probably caused by way to workaround the |
Can flutter-pi be modified to include AOT support?
The text was updated successfully, but these errors were encountered: