meta-flutter / meta-flutter

Google Flutter for Yocto
MIT License
137 stars 64 forks source link

Unable to build on a linux arm64 host #575

Open Simone-RM opened 1 day ago

Simone-RM commented 1 day ago

I'm trying to compile a flutter app on a linux arm64 host (using the kirkstone branch).

Compile fails when invoking:

NOTE: Running [...build/tmp/work/armv8a-poky-linux/myapp/git+.../recipe-sysroot-native/usr/share/flutter/sdk/bin/cache/dart-sdk/bin/dartaotruntime --disable-analytics --disable-dart-dev ...build/tmp/work/armv8a-poky-linux/myapp/git+.../recipe-sysroot-native/usr/share/flutter/sdk/bin/cache/artifacts/engine/linux-arm64/frontend_server_aot.dart.snapshot --sdk-root ...build/tmp/work/armv8a-poky-linux/myapp/git+.../recipe-sysroot-native/usr/share/flutter/sdk/bin/cache/artifacts/engine/common/flutter_patched_sdk_product/ --target=flutter -Ddart.vm.profile=false -Ddart.vm.product=true --aot --tfa --target-os linux --packages ...build/tmp/work/armv8a-poky-linux/myapp/git+.../git//.dart_tool/package_config.json --output-dill ...build/tmp/work/armv8a-poky-linux/myapp/git+.../git//.dart_tool/flutter_build/0b9b511f3403fbcc9d48f37b9714668c/app.dill --depfile ...build/tmp/work/armv8a-poky-linux/myapp/git+.../git//.dart_tool/flutter_build/0b9b511f3403fbcc9d48f37b9714668c/kernel_snapshot_program.d --source file://...build/tmp/work/armv8a-poky-linux/myapp/git+.../git//.dart_tool/flutter_build/dart_plugin_registrant.dart --source package:flutter/src/dart_plugin_registrant.dart -Dflutter.dart_plugin_registrant=file://...build/tmp/work/armv8a-poky-linux/myapp/git+.../git//.dart_tool/flutter_build/dart_plugin_registrant.dart --native-assets ...build/tmp/work/armv8a-poky-linux/myapp/git+.../git//.dart_tool/flutter_build/0b9b511f3403fbcc9d48f37b9714668c/native_assets.yaml --verbosity=error package:myapp/main.dart] in ...build/tmp/work/armv8a-poky-linux/myapp/git+.../git/
NOTE: Output:
  Loading failed: Architecture mismatch.
  VM initialization failed: Invalid vm isolate snapshot seen

After some digging, I found this:

# file ...build//tmp/work/armv8a-poky-linux/myapp/git+.../recipe-sysroot-native/usr/share/flutter/sdk/bin/cache/artifacts/engine/linux-arm64/frontend_server_aot.dart.snapshot
...build//tmp/work/armv8a-poky-linux/myapp/git+.../recipe-sysroot-native/usr/share/flutter/sdk/bin/cache/artifacts/engine/linux-arm64/frontend_server_aot.dart.snapshot: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=7d7673e2df1d68aa1222110aef3343b6, with debug_info, not stripped

I suspect the problem is that snapshot which seems to be in the wrong architecture...

jwinarske commented 1 day ago

Yes, frontend_server_aot.dart.snapshot: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[md5/uuid]= is the clue.

In the case of arm64 host it should not reportx86-64. Tested PRs are welcome

jwinarske commented 1 day ago

Note there are a couple of other open issues related to arm64 host building.

andryblack commented 1 day ago

same issue with build with docker image on Mac with M1 processor

jwinarske commented 11 hours ago

Note at this time arm64 host builds are the lowest priority.

Tested PRs are welcome; would require a full test pass for both x86_64 and arm64 host.

andryblack commented 2 hours ago

https://storage.googleapis.com/flutter_infra_release/flutter/a6bd3f1de158bb61090e0c8053df93a10cb548e1/linux-arm64/artifacts.zip downloaded by flutter sdk include frontend_server_aot.dart.snapshot for x86-64

jwinarske commented 2 hours ago

If you build on an arm64 host the native host tools in the engine SDK would be arm64. If you want to run tools on a x64 host, then you have to build on x64 host.

Or fetch engine SDK from here: https://github.com/meta-flutter/flutter-engine