ardera / flutter-pi

A light-weight Flutter Engine Embedder for Raspberry Pi that runs without X.
MIT License
1.49k stars 154 forks source link

Document how to build for debug mode #128

Closed Hixie closed 8 months ago

Hixie commented 3 years ago

The README.md file describes how to build for release but it's not clear exactly how to build a debug build.

ardera commented 3 years ago

Yeah I agree, I should document that.

It's pretty simple actually, the flutter build bundle command always builds the debug artifacts (except if given the --precompiled argument). So the debug artifacts (namely kernel_blob.bin) are contained in the asset bundle. If you don't want release mode, you can just skip the Building the app.so section and go straight to Running your app with flutter-pi

compenguy commented 3 years ago

Relatedly, and I can move this into a separate issue if you'd like, is how to build/start in profiling mode.

I have a bundle that I built with --profile, but I get no observatory announcement when I start it with --release, and it won't start without it because of a missing kernel.blob.

When I use a bundle built for debug and start flutter-pi in debug I get the observatory announcement, but all the documentation for flutter says not to profile in debug. So I'm just unclear on how to accomplish this.

ardera commented 3 years ago

I have a bundle that I built with --profile, but I get no observatory announcement when I start it with --release, and it won't start without it because of a missing kernel.blob.

Actually, the asset bundle (so the stuff inside build/flutter_assets) is the same whether you build in release, profile or debug mode. The default build mode is --release, so invoking flutter build bundle without args as is done in the README to build the debug flutter assets will actually build them in release mode. But it's not important since they're all the same anyway.

If you want profile mode you need a custom gen_snapshot & flutter engine, configured with --runtime-mode profile as an argument to gn. I'll consider including it engine-binaries branch. Main point against including it is that I'm already building 4 engines (debug & release for ARM & ARM64) and also I'm building those on my private machine, so I while it's building I can't do anything else.

compenguy commented 3 years ago

I've made a go at cross compiling those myself, but failed miserably at every turn (llvm was a pain, but I got it built, but I never succeeded at getting libcxx to build, and I can't even remember any more what problems I had with libflutter_engine.so).

When I get some free time, maybe I'll have another go at it. If I run into problems, is there a good IRC or Discord channel for people who are using flutter in embedded?

ardera commented 3 years ago

When I get some free time, maybe I'll have another go at it. If I run into problems, is there a good IRC or Discord channel for people who are using flutter in embedded?

Sadly, there isn't. There's a flutter-official discord you can give a try, but it wasn't that helpful for me in the past

That's a good idea though. Maybe the flutter discord server mods could add a new channel flutter-embedders? Alternatively, I could create a flutter-embedded telegram group or a discord, but if it was on the official discord, we'd have everything in one place. Downside may be that that's confusing since everything else on the server is google-official. People may assume they will get google official support while actually, the people there are just hacking together some embedders. What do you think @Hixie?

I've made a go at cross compiling those myself, but failed miserably at every turn (llvm was a pain, but I got it built, but I never succeeded at getting libcxx to build, and I can't even remember any more what problems I had with libflutter_engine.so).

Yeah I agree it's pretty hard. I can provide you with my build scripts tough: flutter_engine.zip

Steps to get it running:

Once you have that setup, all you need to do on a new flutter version is pushd engine && gclient sync --ref=src/flutter@<commit> && popd with the new engine commit and ./arm32/build_engine_release.

Everything I do on a new version is run cbcd_engine which checks out the latest stable engine, builds it, collects the binaries into the engine-binaries dir and deploys them to my pi(s), but that doesn't work right now bc flutter builds are broken outside of google as mentioned.

When you have the binaries, copy the libflutter_engine.so to your pi to /usr/lib/libflutter_engine.so.release, build your app.so using the gen_snapshot you just built instead of the one I provide and it should just work.

Hixie commented 3 years ago

We're happy to add new channels, see https://github.com/flutter/flutter/wiki/Chat for details. Basically, ask in #server-support. That server isn't "Google"-official, by the way. It's "Flutter"-official. Google is a big contributor to Flutter, but not the only one. And nothing there is Google giving support to anyone.

ardera commented 3 years ago

Basically, ask in #server-support.

Okay, I'll do that.

That server isn't "Google"-official, by the way. It's "Flutter"-official. Google is a big contributor to Flutter, but not the only one. And nothing there is Google giving support to anyone.

My mistake. I just assumed that bc most of the people there are working for google.

eximius313 commented 8 months ago

@ardera, isn't it already documented?

ardera commented 8 months ago

@ardera, isn't it already documented?

Yes it is, thanks for letting me know.