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

Linux on aarch64 support for Flutter #1064

Closed
leclairem opened this issue Dec 16, 2022 · 1 comment
Closed

Linux on aarch64 support for Flutter #1064

leclairem opened this issue Dec 16, 2022 · 1 comment
Assignees
Labels
O-Community Waiting-For-Reporter Waiting for more information from the reporter before we can proceed

Comments

@leclairem
Copy link

leclairem commented Dec 16, 2022

Description

Submitted per Ian Ward's request.
Working on a project using a Raspberry pi4 to run a flutter application that requires realm with flexible sync to retrieve data and persist transactions.
Installation steps to build and load application:

  1. Application directory is opened in a docker container with balenalib/raspberrypi4-64 base image
  2. App is built with "flutter build linux"
  3. Release folder is uploaded to rpi4

When the app is started it immediately crashes with the following:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'librealm_dart.so': librealm_dart.so: cannot open shared object file: No such file or directory
#0 _openRealmLib (package:realm/src/init.dart:81)
#1 initRealm (package:realm/src/init.dart:105)
#2 new RealmCore. (package:realm/src/native/realm_core.dart:68)
#3 new _RealmCore (package:realm/src/native/realm_core.dart:76)
#4 realmCore (package:realm/src/native/realm_core.dart:49)

The .so file packaged in the release folder is x86_64
~/Desktop/release/bundle/lib $ file librealm_dart.so
librealm_dart.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=e82f6eae35d31178157e461cd12e7dc9fdedce11, not stripped

Our project requires a aarch64 librealm_dart.so

How important is this improvement for you?

Dealbreaker

@fealebenpae
Copy link
Member

Hey @leclairem,

AFAICT Flutter doesn't support Raspberry Pi (or Linux cross-compilation in general). But it should be possible to compile the Realm SDK for aarch64. I'm not familiar with the balenalib/raspberrypi4-64 image, but a cursory search through their documentation reveals that there are extra steps necessary to enable cross-compilation.

In any case, I don't know enough about the Balena images to be able to offer specific guidance, but if you use something like https://github.com/Pro/raspi-toolchain to build the Realm SDK from source then it's just a matter of setting the CMAKE_TOOLCHAIN_FILE environment variable to point to the toolchain file and then run scripts/build-linux.sh to manually produce the aarch64 librealm_dart.so you need.

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Dec 20, 2022
@sync-by-unito sync-by-unito bot closed this as completed Jan 31, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
O-Community Waiting-For-Reporter Waiting for more information from the reporter before we can proceed
Projects
None yet
Development

No branches or pull requests

3 participants