Skip to content

libx265: build with Ninja to fix arm64 parallel-make race - #934

Merged
bryan-minimal merged 1 commit into
mainfrom
libx265-ninja
Oct 20, 2026
Merged

bryan-minimal merged 1 commit into
mainfrom
libx265-ninja

Conversation

@bryan-minimal

@bryan-minimal bryan-minimal commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Switch packages/libx265 from the Unix Makefiles generator to the Ninja generator (-G Ninja, then ninja -C build and a DESTDIR install), replacing the make build dep with ninja. Every existing CMake flag is kept.

Why: arm64 parallel-make race

x265 4.2's source/CMakeLists.txt assembles each ARM .S file via add_custom_command(OUTPUT ${ASM}.o) and adds ${ASM_OBJS} to both x265-static and x265-shared. Under Unix Makefiles the custom command runs once per target, so with parallel make both targets write the same .S.o at the same time, and the shared link can read a half-written object:

[ 85%] Linking CXX shared library libx265.so
p2s.S.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/x265-shared.dir/build.make:354: libx265.so.216] Error 1

(buildbot run 6f29c338-f85c-4940-9fc3-82fd0a705042, arm64 log 1000078.jsonl lines 193-201)

Ninja emits a single edge for a shared custom-command output, so each object is assembled once. amd64 uses nasm and isn't affected. AGENTS.md asks for the Ninja generator on CMake builds anyway.

Impact on pkgs#929

This race turned #929 (curl 8.23.0) red: curl → cmake → libx265, so the curl bump rebuilds libx265 and hit the race on arm64. #929 needs to be re-run after this merges.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated the project’s build process to use Ninja instead of Make for configuration, compilation, and installation. This is a change to the software build workflow; no end-user features or behavior are changed. The build now relies on Ninja to manage build tasks, replacing the previous Make-based process.

x265 4.2's source/CMakeLists.txt assembles each common/arm*/*.S via
add_custom_command(OUTPUT ${ASM}.o) and feeds ${ASM_OBJS} into BOTH
x265-static and x265-shared. The Unix Makefiles generator runs that custom
command once per target, so under parallel make the two targets write the
same .S.o concurrently and the linker can pick up a half-written object.

Seen on arm64 in buildbot run 6f29c338-f85c-4940-9fc3-82fd0a705042
(pkgs#929, curl 8.23.0), 1000078.jsonl lines 193-201:

  [ 85%] Linking CXX shared library libx265.so
  p2s.S.o: file not recognized: file format not recognized
  collect2: error: ld returned 1 exit status
  make[2]: *** [CMakeFiles/x265-shared.dir/build.make:354: libx265.so.216] Error 1

The Ninja generator emits one edge per custom-command output, so the object
is assembled once. amd64 assembles with nasm and is unaffected. AGENTS.md
asks for the Ninja generator on CMake builds anyway. make is no longer
used, so it is dropped from build_deps in favour of ninja.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal
bryan-minimal requested a review from a team as a code owner October 19, 2026 16:32
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: gominimal/pkgs/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 349a0b3e-e4dd-4667-a8d4-f0d57ff37cc5
📥 Commits

Reviewing files that changed from the base of the PR and between e151ec2 and 0f2204e.

📒 Files selected for processing: 2
  • packages/libx265/build.ncl
  • packages/libx265/build.sh

Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

📝 Walkthrough

The libx265 build configuration now uses Ninja instead of Make. CMake generates Ninja build files, and Ninja runs the build and install steps. The build commands no longer specify the previous Make job count.

Changes: libx265 build

Layer / File(s) Summary
Ninja build configuration
packages/libx265/build.ncl, packages/libx265/build.sh
The build configuration imports and lists Ninja as a dependency. CMake uses the Ninja generator, and Ninja runs the build and install steps. The commands no longer specify -j$(nproc).

Priority: ⬆️ High

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: 0chroma

Merge Risk: ⚪ Minimal · up to 0f220

No actionable issue remains from this review. The libx265 Ninja change is mergeable after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: switching libx265 to Ninja to address the arm64 parallel Make race.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the root cause rather than just reducing parallelism. Under Unix Makefiles, x265-static and x265-shared both run the same add_custom_command for each arm .S.o, while Ninja emits one step per output. ninja replaces make in build_deps, the flags, install and globs are unchanged, and x86_64 (nasm) is unaffected.

Before merging, please confirm the arm64 builder actually ran this, since arm64 is the point of the PR. Then re-run #929 (curl), which failed on this exact link.


Generated by Claude Code

@bryan-minimal
bryan-minimal added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit 60a2521 Oct 20, 2026
11 checks passed
@bryan-minimal
bryan-minimal deleted the libx265-ninja branch October 20, 2026 00:29
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.

2 participants