Skip to content

Installing dependent libraries

Hidenori Matsubayashi edited this page Jun 3, 2024 · 12 revisions

You need to install the following dependent libraries to build and run. Here introduce how to install the libraries on Debian-based systems like Ubuntu.

Mandatory

  • clang (for building)
  • cmake (for building)
  • build-essential (for building)
  • pkg-config (for building)
  • EGL
  • xkbcommon
  • OpenGL ES (>=2.0)
sudo apt install clang cmake build-essential pkg-config libegl1-mesa-dev libxkbcommon-dev libgles2-mesa-dev

Only when using Wayland backend

  • libwayland
  • wayland-protocols (to generate the source files of Wayland protocols)
sudo apt install libwayland-dev wayland-protocols

Only when using DRM backend

  • libdrm
  • libgbm
  • libinput
  • libudev

DRM backend requires either libsystemd or libuv. If both libsystemd and libuv exist, libsystemd will be used when building the embedder. See also https://github.com/sony/flutter-embedded-linux/pull/420

  • libsystemd
  • libuv
sudo apt install libdrm-dev libgbm-dev libinput-dev libudev-dev libsystemd-dev

Or

sudo apt install libdrm-dev libgbm-dev libinput-dev libudev-dev libuv-dev

Only when using x11 backend

  • x11
sudo apt install libx11-dev

Install the Flutter Engine library

This embedder requres libflutter_engine.so (Pre-build library of the Flutter Engine). You need to install it in <path_to_cmake_build_directory> to build. See: Building Flutter Engine embedder

Quick start (Use pre-built image)

You can download a specific pre-built Flutter Engine (libflutter_engine.so) version from https://github.com/sony/flutter-embedded-linux/releases/latest without building it yourself. See also: Use pre-build image

Use the flutter official image (Not recommend)

Or you can download a specific pre-built Flutter Engine from Google's infra by the following steps, but it's limited to debug mode and x64 targets.

Step 1)

Check the version (SHA) of the channel you want to use. You can also get the version from ${path_to_flutter_sdk_install}/flutter/bin/internal/engine.version of the Flutter SDK which you are currently using.

Step 2)

Download Flutter Engine embedder library. Note that replace FLUTTER_ENGINE with the SHA of the Flutter engine you want to use.

curl -O https://storage.googleapis.com/flutter_infra/flutter/FLUTTER_ENGINE/linux-x64/linux-x64-embedder

Step 3)

Install the library. Note that the downloaded library is only debug mode and for x64 targets.

unzip ./linux-x64-embedder
cp ./libflutter_engine.so <path_to_cmake_build_directory>