Repository navigation
libx265: build with Ninja to fix arm64 parallel-make race - #934
Merged
Merged
Conversation
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>
Contributor
Merged
norrietaylor
approved these changes
Oct 19, 2026
norrietaylor
left a comment
Member
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Switch
packages/libx265from the Unix Makefiles generator to the Ninja generator (-G Ninja, thenninja -C buildand aDESTDIRinstall), replacing themakebuild dep withninja. Every existing CMake flag is kept.Why: arm64 parallel-make race
x265 4.2's
source/CMakeLists.txtassembles each ARM.Sfile viaadd_custom_command(OUTPUT ${ASM}.o)and adds${ASM_OBJS}to bothx265-staticandx265-shared. Under Unix Makefiles the custom command runs once per target, so with parallel make both targets write the same.S.oat the same time, and the shared link can read a half-written object:(buildbot run
6f29c338-f85c-4940-9fc3-82fd0a705042, arm64 log1000078.jsonllines 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