-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Is this a new report?
Yes
System Info
Void 6.12.74_1 x86_64 GenuineIntel uptodate rr
Package(s) Affected
pijul
Does a report exist for this bug with the project's home (upstream) and/or another distro?
No
Expected behaviour
xbps-src pkg pijul succeding
Actual behaviour
xbps-src pkg pijul fails with
error: failed to run custom build command for `libsodium-sys v0.2.7`
Caused by:
process didn't exit successfully: `/builddir/pijul-1.0.0.beta.9/target/release/build/libsodium-sys-85258f15fc4830e4/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=SODIUM_LIB_DIR
cargo:rerun-if-env-changed=SODIUM_SHARED
cargo:rerun-if-env-changed=SODIUM_USE_PKG_CONFIG
cargo:rerun-if-env-changed=SODIUM_DISABLE_PIE
--- stderr
thread 'main' (22465) panicked at /host/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libsodium-sys-0.2.7/build.rs:39:9:
SODIUM_LIB_DIR is incompatible with SODIUM_USE_PKG_CONFIG. Set the only one env variable
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
=> ERROR: pijul-1.0.0.beta.9_1: do_build: '${make_cmd} build ${XBPS_VERBOSE+${make_verbose}} --release --locked --target ${RUST_TARGET} ${configure_args} ${make_build_args}' exited with 101
=> ERROR: in do_build() at common/build-style/cargo.sh:9
Investigation and preliminary diagnosis
common/build-helper/rust.sh exports SODIUM_LIB_DIR globally for all Rust packages. This conflicts with libsodium-sys when it is built with the use-pkg-config cargo feature enabled, causing a hard panic at build time. It seems that this would break any package that depends on libsodium-sys with that feature, such as pijul.
In build.rs of libsodium-sys, having both SODIUM_LIB_DIR set and the use-pkg-config feature enabled is explicitly rejected:
https://github.com/sodiumoxide/sodiumoxide/blob/3057acb1a030ad86ed8892a223d64036ab5e8523/libsodium-sys/build.rs#L39
causing this panic.
Additionally, the sodium block in rust.sh has had swapped paths since its introduction:
void-packages/common/build-helper/rust.sh
Lines 52 to 53 in 15214cf
| export SODIUM_LIB_DIR="${XBPS_CROSS_BASE}/usr/include" | |
| export SODIUM_INC_DIR="${XBPS_CROSS_BASE}/usr/lib" |
SODIUM_INC_DIR is not read at all but SODIUM_LIB_DIR pointing at /usr/include means the linker is told to search for libraries in the include directory. Maybe this has been silently working because the linker finds libsodium through its default system paths anyway?
Fix
I'm not well versed in rust but it seems that replacing the entire sodium block in rust.sh with export SODIUM_USE_PKG_CONFIG=1 would be appropriate, being consistent with how every other sys crate is handled there.
Steps to reproduce
git clone https://github.com/void-linux/void-packages
cd void-packages
./xbps-src binary-bootstrap
# update srcpkgs/pijul/template to version=1.0.0.beta.9, revision=1 ...
xgensum -i pijul
./xbps-src pkg pijul