Skip to content

JIT snapshots can't be found on some platforms when just the assets path is specified. #100640

@akbiggs

Description

@akbiggs

The embedder does not appear to work with JIT snapshots on some platforms. In the GLFW example on Linux (which only sets FlutterProjectSettings.asset_path), we get an error that the Dart VM could not be initialized. With gn --unopt --build-embedder-examples:

% $ENGINE_DIR/out/host_debug_unopt/embedder_example $ENGINE_DIR/flutter/examples/glfw/myapp $ENGINE_DIR/third_party/icu/common/icudtl.dat 
[ERROR:flutter/runtime/dart_vm_data.cc(18)] VM snapshot invalid and could not be inferred from settings.
[ERROR:flutter/runtime/dart_vm.cc(269)] Could not set up VM data to bootstrap the VM from.
[ERROR:flutter/runtime/dart_vm_lifecycle.cc(84)] Could not create Dart VM instance.
[FATAL:flutter/shell/common/shell.cc(143)] Check failed: vm. Must be able to initialize the VM.
zsh: IOT instruction  $ENGINE_DIR/out/host_debug_unopt/embedder_example 

We suspect that this is not an issue on Windows and Mac because of this logic: https://github.com/flutter/engine/blob/main/runtime/dart_snapshot.cc#L72

A hack to fix this issue is to add these two lines here:

    settings.vm_snapshot_data_path =
        fml::paths::JoinPaths({settings.assets_path, "vm_snapshot_data"});
    settings.isolate_snapshot_data_path =
        fml::paths::JoinPaths({settings.assets_path,
        "isolate_snapshot_data"});

But we should add proper support to embedder.h.

Metadata

Metadata

Labels

P3Issues that are less important to the Flutter projectc: proposalA detailed proposal for a change to Fluttere: embedderUsers of the Embedder APIengineflutter/engine related. See also e: labels.platform-linuxBuilding on or for Linux specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions