Repository navigation
rizin: link system xxhash instead of the vendored copy - #1573
Conversation
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>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
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>
norrietaylor
left a comment
There was a problem hiding this comment.
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.
| 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 | ||
| } |
There was a problem hiding this comment.
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/.
| # 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. |
There was a problem hiding this comment.
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.
rizin linked its own vendored xxhash, and the recipe comment said xxhash wasn't packaged. It is packaged now (
xxhash0.8.4). Vendored copies like this don't show up in pkgscan.Changes
build.sh: adds-Duse_sys_xxhash=enabled.enabledmakes meson fail if the library isn't found.build.sh: adds a fail-closed readelf check after install:librz_hash.so.*must NEEDlibxxhash(llama.cpp style).build.ncl: addsxxhashto build_deps and runtime_deps. Thesystem_libsstandalone test now also requireslibxxhash.build.shis updated.libmagic: tried, then dropped (2nd commit)
The first commit also set
-Duse_sys_magic=enabled. The new check then failed on both arches becauselibrz_magic.so.0.9did not NEEDlibmagic. The reason is in the source:librz/magicis rizin's own implementation:rz_magic_*with its own parser inmagic-load.c.use_sys_magiconly adds-lmagic, which--as-neededdrops, plus aUSE_LIB_MAGICdefine that onlyrizin -Vreads.So there is no bundled libmagic to unbundle. The option and the
filedep are removed, andbuild.shrecords why.The other use_sys_* options
use_capstone_version=next(unreleased capstone 6), and ourcapstoneis 5.0.9zipis Info-ZIP, not libzip)🤖 Generated with Claude Code
Summary by CodeRabbit