Skip to content

CMake generated incremental builds, rebuild more often than required. #7511

@cptspacemanspiff

Description

@cptspacemanspiff

🐛 Describe the bug

Issue:

So when building executorch, when running ninja/make, the rebuild builds more than required, this annoys me.

Specifically:

  1. The first time call ninja-> builds everything, yay.
  2. immediately call ninja again -> rebuilds 2 files.
  3. immediately call ninja again -> rebuilds 12 files.
    (repeats 2-3 ad nauseum)

Cause:

This is caused by when cmake sets up the generation of the schema headers. It generates the file: include/executorch/schema/program_generated.h

However, it expects to generate:
include/executorch/program_generated.h

When ninja/make goes to check for the file: 'include/executorch/program_generated.h' it does not exist, so it regenerates the
file 'include/executorch/schema/program_generated.h'.

Then the next time CMake is run, ninja sees that program_generated.h has been updated, so it regenerates the 12 other dependent files.

Fix (In associated pull request)

Tell CMake to look for the files that it actually generated.

Possible drawbacks?

So this looks like someone updated the include directory for the schema headers to be in the schema subdirectory, and forgot/did not know to update the CMake dependency tracking. However, if this change occurred, it happened before the open source git history.

I suppose that it is possible that there is some weird edge-case that requires that the schema headers are always regenerated...

Metadata

Metadata

Labels

module: build/installIssues related to the cmake and buck2 builds, and to installing ExecuTorchmodule: runtimeIssues related to the core runtime and code under runtime/

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions