Skip to content

rizin: link system xxhash instead of the vendored copy - #1573

Merged
bryan-minimal merged 2 commits into
mainfrom
rizin-system-libs
Nov 19, 2026
Merged

bryan-minimal merged 2 commits into
mainfrom
rizin-system-libs

Conversation

@bryan-minimal

@bryan-minimal bryan-minimal commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

rizin linked its own vendored xxhash, and the recipe comment said xxhash wasn't packaged. It is packaged now (xxhash 0.8.4). Vendored copies like this don't show up in pkgscan.

Changes

  • build.sh: adds -Duse_sys_xxhash=enabled. enabled makes meson fail if the library isn't found.
  • build.sh: adds a fail-closed readelf check after install: librz_hash.so.* must NEED libxxhash (llama.cpp style).
  • build.ncl: adds xxhash to build_deps and runtime_deps. The system_libs standalone test now also requires libxxhash.
  • The use_sys_* comment in build.sh is updated.

libmagic: tried, then dropped (2nd commit)

The first commit also set -Duse_sys_magic=enabled. The new check then failed on both arches because librz_magic.so.0.9 did not NEED libmagic. The reason is in the source:

  • In 0.9.1, librz/magic is rizin's own implementation: rz_magic_* with its own parser in magic-load.c.
  • No source file calls the libmagic API.
  • use_sys_magic only adds -lmagic, which --as-needed drops, plus a USE_LIB_MAGIC define that only rizin -V reads.

So there is no bundled libmagic to unbundle. The option and the file dep are removed, and build.sh records why.

The other use_sys_* options

option status
zlib, libzstd, lzma, lz4, pcre2, openssl, tree_sitter already system
xxhash system (this PR)
magic no effect in 0.9.1 (see above)
capstone vendored. rizin builds use_capstone_version=next (unreleased capstone 6), and our capstone is 5.0.9
libzip, zydis, libmspack, softfloat, blake2, blake3 vendored because they aren't packaged (zip is Info-ZIP, not libzip)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Build & Packaging
    • Updated build configuration to use the system-provided xxhash library and verify it is linked correctly in installed builds. This helps ensure packaged builds include the expected hashing library.

rizin 0.9.1 vendored xxhash and its own libmagic because the recipe said
neither was packaged; both are now (xxhash 0.8.4, libmagic from file 5.48).
Enable -Duse_sys_xxhash and -Duse_sys_magic, add xxhash and file as build
and runtime deps, extend the system_libs test, and fail the build if
librz_hash does not NEED libxxhash or librz_magic does not NEED libmagic.

capstone stays vendored (rizin builds capstone "next", unreleased v6; ours
is 5.0.9). libzip, zydis, libmspack, softfloat, blake2 and blake3 are not
packaged, so they stay vendored too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal
bryan-minimal requested a review from a team as a code owner November 18, 2026 20:36
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Rizin build configuration adds xxhash as a system build and runtime dependency. The build script enables Meson’s system xxhash option and checks installed libraries for xxhash linkage. The package test also requires libxxhash in the shared-library dependencies.

Changes: Rizin xxhash integration

Layer / File(s) Summary
Configure system xxhash
packages/rizin/build.ncl, packages/rizin/build.sh
The build definitions add xxhash as a system build and runtime dependency. The build script enables use_sys_xxhash and updates comments about system and vendored libraries.
Verify xxhash linkage
packages/rizin/build.ncl, packages/rizin/build.sh
The package test requires libxxhash among librz shared-library dependencies. After installation, the build script requires readelf and checks that librz_hash has a DT_NEEDED entry beginning with libxxhash.so.

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

Suggested reviewers: norrietaylor, agent-137

Merge Risk: Minimal · up to 920d1

Rizin now links the packaged xxhash library instead of its vendored copy, and the build fails if the link is missing. No concrete merge-blocking issue was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "rizin: link system xxhash instead of the vendored copy" matches the main change that survives the follow-up commits. The PR now replaces the vendored xxhash with the system library, adds th…
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "rizin: link system xxhash instead of the vendored copy" matches the main change that survives the follow-up commits. The PR now replaces the vendored xxhash with the system library, adds the xxhash dependency to build.ncl, and adds a readelf check for libxxhash in build.sh. The title does not mention libmagic. The PR objectives still name libmagic, but the follow-up commits drop it, so the title matches the final changeset.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9cebbef and 920d155.

Files selected for processing: 2

  • packages/rizin/build.ncl
  • packages/rizin/build.sh

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

The first build failed the new readelf check on both arches: librz_magic
did not NEED libmagic. In 0.9.1 librz/magic is rizin's own rewrite (its
own parser in magic-load.c), and no source file calls the libmagic API.
use_sys_magic only adds -lmagic, which --as-needed drops, plus a
USE_LIB_MAGIC define that only rizin -V reads. There is no bundled
libmagic to unbundle, so drop the option and the file dep, and record why
in build.sh. The xxhash half is unchanged (its check passed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal bryan-minimal changed the title rizin: link system xxhash and libmagic instead of the vendored copies rizin: link system xxhash instead of the vendored copy Nov 19, 2026

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

Scope matches the title. Both files change only the xxhash linkage and the comments that describe it. The use_sys_magic attempt from the first commit left no option and no file dependency in the final diff. Clobber none: git log on packages/rizin shows only the original package commit and a test-deps batch before this PR. Correctness the change is good. xxhash is in build_deps and runtime_deps, in the same whole-package form that packages/rsync/build.ncl uses. The system_libs test now requires libxxhash, so the change has a regression test. The needs gate in build.sh parses readelf -d with the same sed expression as packages/llama.cpp/build.sh. Two small findings concern the text of the new gate and one comment. Not checked: that librz_hash is the only rizin library that uses xxhash, and that meson selects the shared libxxhash.so and not the libxxhash.a that the xxhash package also ships. Both need the rizin source or a build. The build-time gate fails closed in either case.

Comment thread packages/rizin/build.sh
readelf -d "$so" | sed -n 's/.*(NEEDED).*\[\(.*\)\]/\1/p' | grep -q "^$2\.so" || {
echo "ERROR: $so does not NEED $2 — use_sys_* fell back to the vendored copy" >&2
exit 1
}

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.

low · A maintainer reads this error when the build fails. The text gives one cause: use_sys_* fell back to the vendored copy. The code cannot prove that cause. With -Duse_sys_xxhash=enabled, meson stops when the library is missing, as the comment at lines 73-75 says. So when this gate fails, the probable cause is the other one that the comment names: the linkage moved to a different librz_*. The message sends the reader to the wrong cause. State only the fact, for example ERROR: $so has no DT_NEEDED entry for $2. This is the only instance in packages/.

Comment thread packages/rizin/build.sh
# parser in magic-load.c) and no source file calls the libmagic
# API: use_sys_magic only adds -lmagic, which --as-needed drops,
# plus a USE_LIB_MAGIC define read by nothing but rizin -V. Tried
# in pkgs#1573: librz_magic did not NEED libmagic on either arch.

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.

nit · The magic entry is in the list Deliberately left VENDORED, but its first words say that it is not a bundled library. Its last sentence, Tried in pkgs#1573: ..., narrates this PR and does not describe the code. Move the entry out of the vendored list, or give it a heading such as No effect in 0.9.1. Delete the last sentence, because the sentences before it already give the reason.

@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 9de31e3 Nov 19, 2026
16 checks passed
@bryan-minimal
bryan-minimal deleted the rizin-system-libs branch November 19, 2026 23:56
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