Conversation
build.rs called hbb_common::gen_version(), which made hbb_common a build dependency, so cargo compiled the whole crate for the build host, including libsodium-sys. When cross compiling with pkg-config pointed at the target sysroot, the host build script then links the target libsodium and fails at link time. That is what happens on every non-x86_64 OpenWrt target. Write src/version.rs from CARGO_PKG_VERSION with the standard library instead. BUILD_DATE is kept as an empty constant: nothing in hbbs or hbbr reads it, and a constant value makes the build reproducible. Signed-off-by: Guilherme Cardoso <luminoso@gmail.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe build no longer depends on ChangesVersion generation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to This change preserves generated version behavior while removing the build-only dependency affecting cross-compilation, so it is ready to merge with normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 Clippy (1.98.0)Clippy execution failed Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
build.rscallshbb_common::gen_version(), which makeshbb_commona build dependency. Cargo then compiles the whole crate for the build host, includinglibsodium-sys. When cross compiling with pkg-config pointed at the target sysroot, the host build script links the targetlibsodiumand fails:This happens on every non-x86_64 target when packaging hbbs and hbbr for OpenWrt (openwrt/packages#30572), and only passes on x86_64 because host and target share the machine type.
The change writes
src/version.rsfromCARGO_PKG_VERSIONwith the standard library, so the build script has no dependencies at all.VERSIONis unchanged.BUILD_DATEstays as an empty constant: nothing in hbbs or hbbr reads it, and a constant value makes the build reproducible.Cargo.lockdoes not change becausehbb_commonremains a normal dependency.Tested by building 1.1.16 with this change applied for x86_64 musl in the OpenWrt SDK;
hbbs --versionprintshbbs 1.1.16and the build script binary no longer links libsodium.Summary by CodeRabbit
The PR appears safe to merge and cleanly removes the problematic host dependency without changing consumed version behavior.
Summary
This PR removes
hbb_commonfrom the host-side build dependency graph and replaces its version-file generator with a standard-library-only build script.VERSIONfrom Cargo’s package version.BUILD_DATEconstant as an empty reproducible value.Reviews (1) · Last reviewed commit: "build: generate src/version.rs without h..."