Skip to content

perf: fix parallel build race with header install#871

Merged
mgsharm merged 1 commit intobottlerocket-os:developfrom
mgsharm:fix-perf-parallel-build-race/core-kit
Mar 25, 2026
Merged

perf: fix parallel build race with header install#871
mgsharm merged 1 commit intobottlerocket-os:developfrom
mgsharm:fix-perf-parallel-build-race/core-kit

Conversation

@mgsharm
Copy link
Copy Markdown
Contributor

@mgsharm mgsharm commented Mar 18, 2026

Description of changes:

The perf build has a race condition with high parallelism (-j128). In tools/perf/Makefile.perf, the libperf sub-build runs both libperf.a (compilation) and install_headers (copying headers to the output directory) as targets in a single parallel make invocation. The compiler's search path checks the output directory first, but the install command creates an empty file before writing the actual content. With -j128, the compiler can pick up that empty file before it's fully written, which causes incomplete type and missing prototype errors.

This adds a one-line patch to tools/lib/perf/Makefile that makes compilation depend on install_headers, ensuring all headers are fully installed before source files are compiled.

Testing done:

  • Built multiple times to confirm the issue is no longer encountered.
  • make ARCH=aarch64
  • make ARCH=x86_64

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

Signed-off-by: Gaurav Sharma <mgsharm@amazon.com>
@mgsharm mgsharm requested review from KCSesh, bcressey and ytsssun March 18, 2026 18:19
@mgsharm mgsharm merged commit 7d7bbe0 into bottlerocket-os:develop Mar 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants