Skip to content

emb: build the example apps for embedded Linux - #1

Open
jwinarske wants to merge 2 commits into
mainfrom
jw/emb-embedded-linux
Open

emb: build the example apps for embedded Linux#1
jwinarske wants to merge 2 commits into
mainfrom
jw/emb-embedded-linux

Conversation

@jwinarske

Copy link
Copy Markdown

Summary

Builds the six example apps for embedded Linux with
emb, against the ivi-homescreen
embedder and the Firebase C++ SDK its plugins are backed by.

Two commits:

  1. emb: build the example apps for embedded Linux — the manifests and the
    firebase-cpp-sdk patch series.
  2. example: use the android options on Linux — one platform case per
    example app.

The manifest

emb cross <ivi-homescreen> --app <example> builds the embedder from that
project and the app from here. The project owns the board profile every app on a
board shares; this states only what these apps add on top — and that is the same
for all six, since they differ in Dart code, not in native dependencies.

So there is one manifest and each example carries a .emb symlink to it,
rather than six copies to keep in step:

.emb/base.emb.yaml            plugins on, the SDK as an augment
.emb/raspberry-pi.emb.yaml    what a Pi adds: libsecret, libuuid, libabsl
.emb/patches/firebase-cpp-sdk/000{1..5}-*.patch
packages/<pkg>/example/.emb -> ../../../.emb

There is no distro package for the Firebase C++ SDK on any target, so it is
built from source against the same profile as the embedder and staged into the
prefix the embedder searches. That takes the better part of an hour the first
time — the SDK fetches and compiles its own boringssl, curl, zlib, libuv,
flatbuffers and, for Firestore, the firebase-ios-sdk core with gRPC and
protobuf. emb skips it afterwards once pkg-config finds the installed
firebase-cpp-sdk.pc.

The patches

Five, against firebase-cpp-sdk v13.12.0, applied by emb to its own fetched
tarball so the checkout stays pristine.

0001 disable compiler options clang rejects
0002 leveldb inherits another dependency's patch file — every non-MSVC desktop build fails its patch step
0003 the pinned dependencies do not build with a current toolchain (CMake 4 policy floor, -Werror on warnings newer than the pins, libstdc++ transitive includes)
0004 add install rules — the SDK ships none, so consumers are expected to reach into a source tree and a build tree, which a cross build cannot do
0005 recognize arm on desktop Linux — the arch check knows only x86/x86_64

0002, 0003 and 0005 are upstream bugs or gaps rather than local policy and are
worth sending to firebase/firebase-cpp-sdk.

The platform case

DefaultFirebaseOptions threw UnsupportedError for TargetPlatform.linux, so
every example died at startup. Linux here means ivi-homescreen, whose Firebase
plugins are backed by the Firebase C++ SDK — the same client the android entry
describes: an api key, an app id and a project id, no store listing involved. So
linux joins the existing android case, which windows already shares for the same
reason. This is the edit ivi-homescreen-plugins documents for every firebase
plugin's example app.

Testing

All six apps build for both targets. The auth example was deployed and run:

  • Raspberry Pi 5 (trixie, aarch64, drm-kms-egl), on its DSI panel
  • x86_64 host (wayland-egl)
DEBUG: Creating Firebase App [DEFAULT] for Firebase C++ 13.12.0
DEBUG: Added app name=[DEFAULT]: options, app_id=1:...:android:..., project_id=flutterfire-e2e-tests
DEBUG: Creating Auth ... for App ...
DEBUG: Auth state changed. Notifying 3 listeners.
DEBUG: ID token changed. Notifying 2 listeners.

No unhandled exceptions on either. The listener counts are firebase_ui_auth's
own, so the Dart-to-C++ boundary is live rather than merely linked.

Depends on

toyota-connected/ivi-homescreen-plugins#267, which brings the plugins' generated
pigeon up to the platform-interface versions these apps resolve. Without it the
apps build and then fail at the first channel call.

Notes

  • A headless image has no org.freedesktop.secrets, so the SDK cannot persist
    credentials across restarts — sign-in works, it just does not survive a
    restart until a keyring is present.
  • firebase_ui_database's example builds, but ivi-homescreen-plugins ships no
    firebase_database plugin, so its database calls have no backing at runtime.

Adds one emb manifest covering all six example apps, plus the patches needed to
build the Firebase C++ SDK they link against.

The apps run on the ivi-homescreen embedder, whose Firebase plugins are backed
by the Firebase C++ SDK. `emb cross <ivi-homescreen> --app <example>` builds the
embedder from that project and the app from here; the project owns the board
profile every app on a board shares, and this states only what these apps add on
top. That is the same for all six -- they differ in Dart code, not in native
dependencies -- so each example carries a `.emb` symlink to one manifest rather
than a copy, and there is a single place to change when the SDK version or the
plugin set moves.

.emb/base.emb.yaml turns the Firebase plugins on and declares the SDK as an
augment: there is no distro package for it, so it is built from source against
the same profile as the embedder and staged into the prefix the embedder
searches. .emb/raspberry-pi.emb.yaml adds what a Pi needs on top -- libsecret
for the SDK's secure storage, libuuid for its installation id, and the platform
Abseil that Firestore's gRPC and protobuf link against.

Five patches against firebase-cpp-sdk v13.12.0, applied by emb to its own
fetched tarball so the checkout stays pristine. 0001 disables compiler options
clang rejects. 0002, 0003 and 0005 are upstream bugs or gaps rather than local
policy and are worth sending upstream: leveldb inheriting another dependency's
patch file, the pinned dependencies not building with a current toolchain, and
the SDK not recognizing arm on desktop Linux. 0004 adds install rules, which the
SDK ships none of -- consumers are expected to reach into a source tree and a
build tree, which a cross build cannot do.

Building takes the better part of an hour the first time, because the SDK
fetches and compiles its own boringssl, curl, zlib, libuv, flatbuffers and, for
Firestore, the firebase-ios-sdk core with gRPC and protobuf. emb skips it
afterwards once pkg-config finds the installed firebase-cpp-sdk.pc.

Verified on a Raspberry Pi 5 (trixie, drm-kms-egl) and on an x86_64 host
(wayland-egl): all six apps build, and the auth example initializes Firebase and
signs in on both.

Signed-off-by: Joel Winarske <joel.winarske@linux.com>
DefaultFirebaseOptions threw UnsupportedError for TargetPlatform.linux, so every
example died at startup on an embedded-Linux embedder.

Linux here means ivi-homescreen, whose Firebase plugins are backed by the
Firebase C++ SDK -- the same client the android entry describes: an api key, an
app id and a project id, with no store listing involved. Group linux with the
existing android case, which windows already shares for the same reason.

This is the edit ivi-homescreen-plugins documents for every firebase plugin's
example app.

Signed-off-by: Joel Winarske <joel.winarske@linux.com>
@jwinarske

Copy link
Copy Markdown
Author

Dependency satisfied: toyota-connected/ivi-homescreen-plugins#267 merged
(3a16f2beb), so the plugins' generated pigeon now matches the platform
interface versions these apps resolve.

Re-verified against the merged v2.0 rather than the branch — it had also
picked up firebase#265 since I cut mine. Cross-built for rpi5-trixie, deployed, and
run on the Pi's DSI panel:

DEBUG: Creating Firebase App [DEFAULT] for Firebase C++ 13.12.0
DEBUG: Auth state changed. Notifying 2 listeners.
DEBUG: ID token changed. Notifying 1 listeners.

No unhandled exceptions. This is ready to merge on its own now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant