Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cptspacemanspiff opened this issue Jan 4, 2025 · 1 comment · Fixed by #7512
Closed

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

cptspacemanspiff opened this issue Jan 4, 2025 · 1 comment · Fixed by #7512
Assignees
Labels
module: build Related to buck2 and cmake build module: runtime Issues related to core runtime

Comments

@cptspacemanspiff
Copy link
Contributor

cptspacemanspiff commented Jan 4, 2025

🐛 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...

@SS-JIA SS-JIA added module: build Related to buck2 and cmake build module: runtime Issues related to core runtime labels Jan 6, 2025
@SS-JIA
Copy link
Contributor

SS-JIA commented Jan 6, 2025

cc: @dbort and @larryliu0820 as this is related to CMake build, in particular the generated files from flatbuffer compilation. As a layman this change looks reasonable, but would like to get a review from you guys. Have assigned the issue for now, but feel free to re-assign.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: build Related to buck2 and cmake build module: runtime Issues related to core runtime
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants