You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The good error message provided by pkg-config itself is suppressed and replaced by a rust-level error message that isn't always accurate or useful
#174
Open
eli-schwartz opened this issue
Jan 12, 2025
· 0 comments
I tried to build a package which links to libgit2-sys. It is a bit finicky about which system libgit2 version to use. I can upgrade or downgrade libgit2 as needed, however. I just need to know what the actual problem is...
This is the error message I got:
warning: [email protected]+1.9.0: failed to probe system libgit2:
error: failed to run custom build command for `libgit2-sys v0.18.0+1.9.0`
Caused by:
process didn't exit successfully: `/var/tmp/portage/dev-vcs/git-absorb-0.6.17/work/git-absorb-0.6.17/target/release/build/libgit2-sys-3dc86e5cce7dbd79/build-script-build` (exit status: 101)
--- stdout
cargo:rustc-check-cfg=cfg(libgit2_vendored,)
cargo:rerun-if-env-changed=LIBGIT2_NO_VENDOR
cargo:rerun-if-env-changed=LIBGIT2_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=LIBGIT2_STATIC
cargo:rerun-if-env-changed=LIBGIT2_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:warning=failed to probe system libgit2:
pkg-config exited with status code 1
> PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 x86_64-pc-linux-gnu-pkg-config --libs --cflags libgit2 libgit2 >= 1.9.0 libgit2 < 1.10.0
The system library `libgit2` required by crate `libgit2-sys` was not found.
The file `libgit2.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
The PKG_CONFIG_PATH environment variable is not set.
HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `libgit2.pc`.
--- stderr
thread 'main' panicked at /var/tmp/portage/dev-vcs/git-absorb-0.6.17/work/cargo_home/gentoo/libgit2-sys-0.18.0+1.9.0/build.rs:45:13:
The environment variable `LIBGIT2_NO_VENDOR` has been set but no compatible system libgit2 could be found.
The build is now aborting. To disable, unset the variable or use `LIBGIT2_NO_VENDOR=0`.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Most of this can be ignored, and seems to come from cargo's handling of "build-script". The critical bit is cargo:warning, which tells me that pkg-config failed, and helpfully reports a command-line I can run to get more details:
$ PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 x86_64-pc-linux-gnu-pkg-config \
--libs --cflags libgit2 'libgit2 >= 1.9.0' 'libgit2 < 1.10.0'
Package dependency requirement 'libgit2 >= 1.9.0' could not be satisfied.
Package 'libgit2' has version '1.8.4', required version is '>= 1.9.0'
pkg-config tells me quite clearly what the problem is. It also does something similar if I try to ask for "doesnt-exist":
$ x86_64-pc-linux-gnu-pkg-config --libs --cflags doesnt-exist
Package doesnt-exist was not found in the pkg-config search path.
Perhaps you should add the directory containing `doesnt-exist.pc'
to the PKG_CONFIG_PATH environment variable
Package 'doesnt-exist' not found
This new error message is very similar to the error message pkg-config-rs gives, except that pkg-config itself knows when to give a better error message for partially matched version bounds.
The text was updated successfully, but these errors were encountered:
awilfox
added a commit
to awilfox/pkg-config-rs
that referenced
this issue
Jan 12, 2025
Otherwise, we are still not copy-paste friendly.
Ref: rust-lang#174
Fixes: a0640aa ("Wrap std::process::Command to track arguments and environment variables")
I tried to build a package which links to libgit2-sys. It is a bit finicky about which system libgit2 version to use. I can upgrade or downgrade libgit2 as needed, however. I just need to know what the actual problem is...
This is the error message I got:
Most of this can be ignored, and seems to come from cargo's handling of "build-script". The critical bit is
cargo:warning
, which tells me that pkg-config failed, and helpfully reports a command-line I can run to get more details:This doesn't work
which is apparently a bit of an edge case caused by:
pkg-config-rs/src/lib.rs
Lines 230 to 236 in 91fcbdb
Side note: Maybe rust Command needs to borrow python's shlex module:
Anyways, I run the real command:
pkg-config tells me quite clearly what the problem is. It also does something similar if I try to ask for "doesnt-exist":
This new error message is very similar to the error message pkg-config-rs gives, except that pkg-config itself knows when to give a better error message for partially matched version bounds.
The text was updated successfully, but these errors were encountered: