Skip to content

Incremental VM build fails with "Can't load Kernel binary: Invalid SDK hash." #42633

@alexmarkov

Description

@alexmarkov

Repro:

  1. Create a local branch and build runtime
git checkout -b tmp master
tools/build.py -a x64 -m release runtime
  1. Modify VM sources, for example
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 6c402b8287..1e9daeed81 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -6426,7 +6426,7 @@ void TypeArguments::EnumerateURIs(URIs* uris) const {
 
 const char* TypeArguments::ToCString() const {
   if (IsNull()) {
-    return "TypeArguments: null";
+    return "TypeArguments: null1";
   }
   Zone* zone = Thread::Current()->zone();
   const char* prev_cstr = OS::SCreate(zone, "TypeArguments: (H%" Px ")",
  1. Commit the change into a local branch
git commit -a -m foo
  1. Build runtime once again
tools/build.py -a x64 -m release runtime

Build fails with the following error

ninja -C out/ReleaseX64 -j1000 -l64 runtime
ninja: Entering directory `out/ReleaseX64'
[12/51] ACTION //runtime/bin:generate_snapshot_bin(//build/toolchain/linux:clang_x64)
FAILED: gen/runtime/bin/vm_snapshot_data.bin gen/runtime/bin/vm_snapshot_instructions.bin gen/runtime/bin/isolate_snapshot_data.bin gen/runtime/bin/isolate_snapshot_instructions.bin 
python ../../build/gn_run_binary.py compiled_action gen_snapshot --enable-experiment=non-nullable --null-safety --deterministic --snapshot_kind=core --vm_snapshot_data=gen/runtime/bin/vm_snapshot_data.bin --vm_snapshot_instructions=gen/runtime/bin/vm_snapshot_instructions.bin --isolate_snapshot_data=gen/runtime/bin/isolate_snapshot_data.bin --isolate_snapshot_instructions=gen/runtime/bin/isolate_snapshot_instructions.bin /usr/local/google/home/alexmarkov/work/dart/sdk/out/ReleaseX64/vm_platform_strong_stripped.dill
Command failed: ./gen_snapshot --enable-experiment=non-nullable --null-safety --deterministic --snapshot_kind=core --vm_snapshot_data=gen/runtime/bin/vm_snapshot_data.bin --vm_snapshot_instructions=gen/runtime/bin/vm_snapshot_instructions.bin --isolate_snapshot_data=gen/runtime/bin/isolate_snapshot_data.bin --isolate_snapshot_instructions=gen/runtime/bin/isolate_snapshot_instructions.bin /usr/local/google/home/alexmarkov/work/dart/sdk/out/ReleaseX64/vm_platform_strong_stripped.dill
output: Can't load Kernel binary: Invalid SDK hash.

[13/51] CXX obj/runtime/vm/libdart_vm_jit.object.o
ninja: build stopped: subcommand failed.
ninja -C out/ReleaseX64 -j1000 -l64 runtime done.

This is a basic development workflow which is now broken. Same error happens when switching between commits and building the VM.

The workaround is to remove out directory and make a clean build, but it is much slower.

/cc @cskau-g @mkustermann

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-infrastructureUse area-infrastructure for SDK infrastructure issues, like continuous integration bot changes.area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions