This repo is used for CI automation to build flutter-engine embedder for Linux.
x86_86 and aarch64 functional
No external toolchain is required, it uses toolchain pulled as part of engine build - Clang Toolchain.
If your are using a sysroot different than that included as default, you will need to override a few variables. See examples below.
The original Yocto Layer to build Engine with variety of Flutter embedders: meta-flutter
See CI build jobs here: https://github.com/jwinarske/flutter_embedded/blob/ci/.github/workflows/blank.yml
To switch channels add variable CHANNEL to cmake invocation. Like this
cmake .. -DCHANNEL=beta
make package -j8
To build all channels of Engine/GLFW shell for Raspberry Pi armv7 in your nightly CI build job, you could do this
git clone https://github.com/jwinarske/flutter_embedded
cd flutter_embedded
mkdir build && cd build
cmake ..
make package -j8
cmake .. -DCHANNEL=beta
make package -j8
cmake .. -DCHANNEL=dev
make package -j8
cmake .. -DCHANNEL=master
make package -j8
cmake .. -DCHANNEL=stable -DENGINE_RUNTIME_MODE=release
make package -j8
cmake .. -DCHANNEL=beta
make package -j8
cmake .. -DCHANNEL=dev
make package -j8
cmake .. -DCHANNEL=master
make package -j8
To use the override variables, pass them in with the cmake command. One example
cmake -DTOOLCHAIN_DIR=~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64 -DTARGET_SYSROOT=~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -DENGINE_REPO=https://github.com/jwinarske/engine -DCMAKE_BUILD_TYPE=Release
This is the location of the target sysroot. The default value is "${CMAKE_SOURCE_DIR}/sdk/sysroot". One approach would be to download target image such as a Raspberry Pi image, and mount it. Setting TARGET_SYSROOT to the rootfs directory.
This is the target architecture of your build. It must match your toolchain, and that which the flutter engine build supports.
This is the repo of the flutter engine. The default value is https://github.com/flutter/engine.git. If you want to use your own fork, set this variable to point to your fork's url.
Unoptimized flag, defaults to OFF
If ENGINE_RUNTIME_MODE is not set to debug
, profile
, or release
, it defaults to debug
.
Enable simulator, defaults to OFF
Enable interpreter, defaults to OFF
Enable dart-debug, defaults to OFF
Enable clang, defaults to ON
Enable goma, defaults to OFF
Enable link-time optimization, defaults to ON
Embedder for Target, defaults to ON
Enable Vulkan, defaults to OFF
I am successfully able to single step the Flutter Embedder using Host Side gdb-multiarch, and latest Eclipse release. Target side requires gdbserver installed. LLDB will be at a later date.
sudo apt-get install gdbserver
Change build flags in this file
{build folder}/engine-prefix/src/engine/src/build/config/compiler/BUILD.gn
To include
if (is_linux) {
if (current_cpu != "x86") {
cflags_cc += [
"-ggdb",
"-ggdb3",
Rebuild Engine
Copy Artifact
scp {absolute build folder}/engine-prefix/src/engine/src/out/linux_debug_arm/so.unstripped/libflutter_engine.so pi@raspberrypi.local:/home/pi/lib
Inside Eclipse - Import C/C++ Executable, and select the Flutter binary.
Configuration - via Debugger Dialog
Main / C/C++ Application: flutter
Main / Connection: Remote Host
Main / Remote Absolute File Path for C/C++ Application: /home/pi/bin/flutter
Main / Commands to execute before application
export LD_LIBRARY_PATH=/home/pi/lib
Main / Skip download to target path [TRUE]
Arguments: /home/pi/build/flutter_assets/
Debugger / Main / GDB Debugger
gdb-multiarch
Debugger / Shared Libraries
{absolute build folder}/engine-prefix/src/engine/src/out/linux_debug_arm/so.unstripped
{absolute sdk folder}/sysroot/lib
{absolute sdk folder}/toolchain/lib
Debugger / Shared Libraries / Load shared library symbols automatically [TRUE]
Set breakpoint at FlutterEngineRun().
Run the debugger, once breakpoint hits, change to the Debugger Console window, and issue
set step-mode on
Step into FlutterEngineRun()