본문으로 건너뛰기

Build Flutter app for linux-arm/arm64

Native Build

Target(Linux ARM/ARM64)

git clone https://github.com/flutter/flutter.git $HOME/development/flutter
cd $HOME/development/flutter \
&& git checkout stable
mkdir -p $HOME/development/flutter/bin/cache
export PATH=$PATH:$HOME/development/flutter/bin

Host(Linux x86_64)

정보

Read Build engine for linux-arm64 for out/linux_<profile/release>_<arm/arm64>

cd $HOME/flutter-engine/engine/src/out/linux_release_arm64
rsync -a dart-sdk  <target user>@<target ip>:~/development/flutter/bin/cache

Target(Linux ARM/ARM64)

cp $HOME/development/flutter/bin/internal/engine.version \
$HOME/development/flutter/bin/cache/engine-dart-sdk.stamp
$ flutter doctor
Building flutter tool...

╔════════════════════════════════════════════════════════════════════════════╗
║ Welcome to Flutter! - https://flutter.dev ║
║ ║
║ The Flutter tool uses Google Analytics to anonymously report feature usage ║
║ statistics and basic crash reports. This data is used to help improve ║
║ Flutter tools over time. ║
║ ║
║ Flutter tool analytics are not sent on the very first run. To disable ║
║ reporting, type 'flutter config --no-analytics'. To display the current ║
║ setting, type 'flutter config'. If you opt out of analytics, an opt-out ║
║ event will be sent, and then no further information will be sent by the ║
║ Flutter tool. ║
║ ║
║ By downloading the Flutter SDK, you agree to the Google Terms of Service. ║
║ Note: The Google Privacy Policy describes how data is handled in this ║
║ service. ║
║ ║
║ Moreover, Flutter includes the Dart SDK, which may send usage metrics and ║
║ crash reports to Google. ║
║ ║
║ Read about data we send with crash reports: ║
║ https://flutter.dev/docs/reference/crash-reporting ║
║ ║
║ See Google's privacy policy: ║
║ https://policies.google.com/privacy ║
╚════════════════════════════════════════════════════════════════════════════╝


Downloading Material fonts... 2,337ms
Downloading Gradle Wrapper... 64ms
Downloading package sky_engine... 1,139ms
Downloading flutter_patched_sdk tools... 3.1s
Downloading flutter_patched_sdk_product tools... 2,334ms
Downloading linux-x64 tools... 4.7s
Downloading linux-x64/font-subset tools... 1,701ms
Doctor summary (to see all details, run flutter doctor -v):
[] Flutter (Channel master, 1.25.0-9.0.pre.57, on Linux, locale C.UTF-8)
[] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.

[] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[!] Connected device
! No devices available

! Doctor found issues in 4 categories.
flutter config --enable-linux-desktop

Host(Linux x86_64)

cd $HOME/flutter-engine/engine/src/out/linux_debug_arm64
rsync -a flutter_linux \
flutter_tester \
font-subset \
icudtl.dat \
libflutter_linux_gtk.so \
gen/const_finder.dart.snapshot \
gen/frontend_server.dart.snapshot \
gen/flutter/lib/snapshot/isolate_snapshot.bin \
gen/flutter/lib/snapshot/vm_isolate_snapshot.bin \
<target user>@<target ip>:~/development/flutter/bin/cache/artifacts/engine/linux-arm64
rsync -a flutter_patched_sdk \
<target user>@<target ip>:~/development/flutter/bin/cache/artifacts/engine/common
cd $HOME/flutter-engine/engine/src/out/linux_profile_arm64
rsync -a flutter_linux gen_snapshot libflutter_linux_gtk.so \
<target user>@<target ip>:~/development/flutter/bin/cache/artifacts/engine/linux-arm64-profile
cd $HOME/flutter-engine/engine/src/out/linux_release_arm64
mv flutter_patched_sdk flutter_patched_sdk_product
rsync -a flutter_patched_sdk_product \
<target user>@<target ip>:~/development/flutter/bin/cache/artifacts/engine/common
rsync -a flutter_linux gen_snapshot libflutter_linux_gtk.so \
<target user>@<target ip>:~/development/flutter/bin/cache/artifacts/engine/linux-arm64-release

Target(Linux ARM/ARM64)

flutter create sample \
&& cd sample

Run debug mode

flutter run -d linux

Run release mode

flutter build linux
./build/linux/release/bundle/sample

Build-troubleshoot

flutter build linux --verbose

Run Without Xwindow(On console mode)

xinit /path/to/sample/build/linux/release/bundle/sample
정보

Run export DISPLAY=:0 when accessing target from host using ssh. Then execute flutter run.