Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Building Embedded Linux embedding for Flutter

Hidenori Matsubayashi edited this page Aug 20, 2022 · 16 revisions

There are several build ways, so please use the one you like.

Self-build

Build for Wayland backend (Stand-alone Wayland app)

$ mkdir build
$ cd build
$ cmake -DUSER_PROJECT_PATH=examples/flutter-wayland-client -DCMAKE_BUILD_TYPE=Release ..
$ cmake --build .

Build for DRM backend

Use GBM

$ mkdir build
$ cd build
$ cmake -DUSER_PROJECT_PATH=examples/flutter-drm-gbm-backend -DCMAKE_BUILD_TYPE=Release ..
$ cmake --build .

Use EGLStream

$ mkdir build
$ cd build
$ cmake -DUSER_PROJECT_PATH=examples/flutter-drm-eglstream-backend -DCMAKE_BUILD_TYPE=Release ..
$ cmake --build .

Build for x11 backend (Stand-alone X11 app)

Basically, the x11 backend is just only for debugging and developing Flutter apps on desktops. And it's still being implemented now.

$ mkdir build
$ cd build
$ cmake -DUSER_PROJECT_PATH=examples/flutter-x11-client -DCMAKE_BUILD_TYPE=Release ..
$ cmake --build .

Build shared library for flutter-elinux

See also: Release building options for flutter-elinux

Wayland / Debug mode

$ cmake -DBUILD_ELINUX_SO=ON -DBACKEND_TYPE=WAYLAND -DCMAKE_BUILD_TYPE=Release \
 -DENABLE_ELINUX_EMBEDDER_LOG=ON -DFLUTTER_RELEASE=OFF ..

Wayland / Release mode

$ cmake -DBUILD_ELINUX_SO=ON -DBACKEND_TYPE=WAYLAND -DCMAKE_BUILD_TYPE=Release \
 -DENABLE_ELINUX_EMBEDDER_LOG=OFF -DFLUTTER_RELEASE=ON ..

Cross-build

You need to create a toolchain file to cross compile using the Yocto SDK for aarch64 on x64 hosts. cross-toolchain-aarch64-template.cmake is the templete file for aarch64 toolchain. Also, you need to modify <path_to_user_target_sysroot> appropriately for your environment if you want to use the template file.

$ cmake -DUSER_PROJECT_PATH=<path_to_user_project> -DCMAKE_TOOLCHAIN_FILE=<toolchain-template-file> ..

Yocto-build

If you want to build using Yocto, see: meta-flutter

How to debug the embedder

You need to build the embedder with CMAKE_BUILD_TYPE=Debug option if you want to debug the embedder. Using this option, you can get gather logs and debug them with debuggers such as gdb / lldb.

$ cmake -DUSER_PROJECT_PATH=<path_to_user_project> -DCMAKE_BUILD_TYPE=Debug ..

User configuration parameters (CMAKE options)

Please edit cmake/user_config.cmake file.

Option Description Default
BACKEND_TYPE Select WAYLAND, DRM-GBM, DRM-EGLSTREAM, or X11 as the display backend type WAYLAND
USE_GLES3 Use OpenGLES3 instead of OpenGLES2 OFF
ENABLE_EGL_ALPHA_COMPONENT_OF_COLOR_BUFFER Use alpha component of the EGL color buffor ON
ENABLE_VSYNC Enable embedder vsync OFF

Release building options for flutter-elinux

Option Description Default
BUILD_ELINUX_SO Build .so file of elinux embedder OFF
ENABLE_ELINUX_EMBEDDER_LOG Enable logger of eLinux embedder ON
FLUTTER_RELEASE Build Flutter Engine with release mode OFF
Clone this wiki locally

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /