Flutter Snap: include dependencies for dart FFI

Hello all,

I built an app using flutter and now I am trying to create a package with snapcraft. I am using tf lite to do some machine learning inference. However, at runtime I encounter this exception: failed to load dynamic library '/snap/dakanji/x1/bin/blobs/libtensorflowlite_c-linux.so': /lib/x86_64-linux-gnu/libm.so.6: version 'GLIBC_2.29' not found (required by /snap/dakanji/x1/bin/blobs/libtensorflowlite_c-linux.so

What do I need to bundle with my app so that it can find this dependency?

I could solve this problem by building my library on a ubuntu 18.04 system. Now it finds the correct GLIBC when running the snap.

1 Like

Is your snap using core18? Could you post the snapcraft.yaml?

Yes, it is and the flutter plugin does not allow something else.

name: dakanji
version: ${VERSION}
summary: DaKanji helps you learn and use Japanese.
description: DaKanji helps you learn and use Japanese.

confinement: strict
base: core18
grade: stable

    interface: dbus
    bus: session
    name: org.daapplab.dakanji
    command: da_kanji_mobile
    extensions: [flutter-master]
    - network
      - dbus-dakanji


    plugin: dump
    source: ./blobs
    - bin/blobs/libtensorflowlite_c-linux.so
      libtensorflowlite_c-linux.so: bin/blobs/libtensorflowlite_c-linux.so

    source: .
    plugin: flutter
    flutter-target: lib/main.dart

I asked here and it seems like support for core20 is on the roadmap.

Also the flutter snap tutorial includes a .desktop example. There is indentation in that file can that cause problems? For me it is not working like the file is in that example.