Flutter Pi in Debian ARM/Raspbian 9 stretch

Recently I discovered the flutter-pi project thanks to a user that asked for help in a public telegram group. I like the idea of running flutter apps directly on RPi without X11. I’ll play with this project a bit in the future :-)

The problem that the user had was that flutter-pi depends on packages that are too old in a standard Debian/Raspbian 9 installation. These packages should be installed via the backports repository:

# Add the stretch-backports repository first, then:
apt-get install -t stretch-backports cmake pkg-config libsystemd-dev libdrm-dev

Now you can proceed with the instructions at the flutter-pi repository.

Undefined reference to libinput_device_touch_get_touch_count

However, if you’re using plain Debian 9 (and not Raspbian 9) you might have issues with the libinput version. EDIT: apparently, even Raspbian 9 has the same issue of Debian 9:

user_input.c:(.text+0x1094): undefined reference to `libinput_device_touch_get_touch_count'

This is because libinput, libwacom and other libraries are too old in standard Debian 9 (while Raspbian 9 seems to have newer versions), and they are not in the stretch-backports repository (so you need to built them yourself).

Be aware that you need to remove any previous libwacom version in your system, as the system-provided version will collide during the flutter-pi cmake build (you can remove the Debian-provided one by removing these packages: libwacom2:armhf libwacom-common libwacom-bin libwacom-dev).

Dockerfile

To test the reproducibility of these instructions, I wrote a Dockerfile (it’s not optimized at all):

FROM docker.io/debian:9

# See below for the file content
COPY .container-files/debian9.sources.list /etc/apt/sources.list

RUN apt-get update && apt-get install -y wget git curl

# Flutter-pi pre-requisites
RUN git clone --depth 1 https://github.com/ardera/flutter-engine-binaries-for-arm.git engine-binaries \
    && cd engine-binaries \
    && ./install.sh

# Flutter-pi requirements
RUN apt-get install -y cmake libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev \
    libdrm-dev libgbm-dev ttf-mscorefonts-installer fontconfig libsystemd-dev libinput-dev \
    libudev-dev libxkbcommon-dev build-essential \
    && fc-cache

# Flutter-pi requirements from backports
RUN apt-get install -y -t stretch-backports cmake pkg-config libsystemd-dev libdrm-dev

WORKDIR /src/

# libwacom/libinput pre-requisites (Debian 9 ARM only)
RUN apt-get install -y ninja-build libmtdev-dev libevdev-dev dh-autoreconf libgudev-1.0-dev libgtk-3-dev check
RUN apt-get install -y -t stretch-backports meson libwayland-dev

RUN apt-get remove -y libwacom2:armhf libwacom-common libwacom-bin libwacom-dev

# libwacom/libinput (Debian 9 ARM only)
RUN wget http://deb.debian.org/debian/pool/main/libw/libwacom/libwacom_0.32.orig.tar.gz -O libwacom_0.32.orig.tar.gz \
    && tar xvf libwacom_0.32.orig.tar.gz \
    && cd libwacom-libwacom-0.32 \
    && ./autogen.sh \
    && ./configure --prefix=/usr \
    && make \
    && make install

RUN git clone https://gitlab.freedesktop.org/libinput/libinput \
    && cd libinput \
    && meson --prefix=/usr -Ddocumentation=false builddir/ \
    && ninja -C builddir/ \
    && ninja -C builddir/ install

COPY . .

# flutter-pi build+install

WORKDIR /src/build/

RUN cmake ..

RUN make -j$(nproc)

RUN make install

The file .container-files/debian9.sources.list is actually a standard Debian sources list file:

deb http://deb.debian.org/debian stretch main contrib non-free
deb http://security.debian.org/debian-security stretch/updates main contrib non-free
deb http://deb.debian.org/debian stretch-updates main contrib non-free
deb http://deb.debian.org/debian stretch-backports main

You can find these files in this fork I made: https://github.com/Enrico204/flutter-pi/tree/experiments-with-debian-9