flutterpi_tool icon indicating copy to clipboard operation
flutterpi_tool copied to clipboard

Output directory keeps changing + kernel_blob.bin appearing in release builds

Open Prithvi-raptee opened this issue 3 months ago • 2 comments

Description

What currently happens:

  • The output directory structure of flutterpi_tool build keeps changing over time. Originally it was something like build/, then build/flutter-pi/aarch64-generic, then apparently back to build/, etc.
  • An extra file kernel_blob.bin sometimes shows up in the output, even when building in what I expect should be AOT / release modes.
  • These variations (dir structure + presence of kernel_blob.bin) break downstream scripts, automations, deployment paths.

What I expect:

  • A stable, documented output layout (with versioned or released version of the tool) so that user scripts don’t need to adjust weekly.
  • In --release or profile builds, no kernel_blob.bin should appear (because release/profile builds should use AOT/ELF snapshots, not JIT / kernel bytecode, right?).
  • Directory names / paths should either be configurable or at least have stable canonical names (arch, generic / cpu, etc.).

Steps to Reproduce / Observations

  1. Using flutterpi_tool build --arch=<some arch> --release
  2. Initially the output was under build/.
  3. Later versions of flutterpi_tool put output under build/flutter-pi/aarch64-generic/ (or similar arch-named subdir).
  4. Recently, the output moved back to just build/ or another layout.
  5. Even in release mode, I sometimes see kernel_blob.bin under flutter_assets/.

Impact

  • My automation scripts assume some fixed path to pick up binaries/assets, and these keep breaking.
  • If kernel_blob.bin is included in release builds, then that suggests the build is not fully AOT, which may impact performance, binary size, startup, or be surprising for users expecting release-mode behavior.

What I Checked / Need Validation

  • The changelog: I reviewed the flutterpi_tool changelog on pub.dev and see many fixes & version bumps.
  • There is no explicit note (so far as I saw) that kernel_blob.bin is removed in release builds, or that output directory layout is intended to be stable.
  • I also found that in Flutter itself, there is an issue “Failed to find snapshot: flutter_assets/kernel_blob.bin” when in release mode, meaning having kernel_blob.bin absent is expected in some configurations. (108803)

Prithvi-raptee avatar Sep 15 '25 06:09 Prithvi-raptee

Hey, those are completely valid concerns. The output directory did change in 0.9, I forgot to put that in the changelog. I'll add tests in the future to make sure the output directory doesn't change accidentally.

However, I can't reproduce the other issues you mentioned. For me, with 0.9.2, the output directory is now build/flutter-pi/armv7-generic consistently, as it should be.

If you have a kernel_blob.bin in the output directory for an AOT mode, it's probably a leftover from a previous debug mode build. But I change it so that the previous build outputs are deleted when doing a new build.

ardera avatar Sep 18 '25 17:09 ardera

Hey, thanks for following up! A few clarifications from my side:

  • My scripts always build in --release mode. I never run debug builds on these machines.
  • Each build starts by deleting the entire build/ directory (so no leftover artifacts should exist).
  • I’ve been using this same setup for 3-4 months. The kernel_blob.bin problem only started appearing recently, without any changes to our scripts.

Unfortunately, upgrading to 0.9.x isn’t possible yet because our current Flutter SDK version is incompatible with that release. So all of this is happening with flutterpi_tool ^0.8.0 (likely 0.8.1 or 0.8.2; I noticed 0.8.2 no longer appears on pub.dev). So is 0.8.2 yanked/changed on pub.dev?

Given that, it looks like the kernel_blob.bin issue may still exist in 0.8.x release builds. Could you confirm whether any changes between 0.8.x and 0.9.x touched the release build pipeline regarding AOT vs kernel blobs? Or if there’s a known workaround for 0.8.x?

Thanks!

Prithvi-raptee avatar Sep 19 '25 05:09 Prithvi-raptee