git2-rs unable to find libgit2 built with `-DEXPERIMENTAL_SHA256=ON`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 450
- Avg merge
- 11m
- Merged PRs (30d)
- 1
Description
I tried to building gram using export LIBGIT2_NO_VENDOR=1 and with a build of libgit2 with the following flag -DEXPERIMENTAL_SHA256=ON. I then came across this error
|B│ Running `/mason/build/x86_64/2.2.0.tar.gz/target/release/build/libgit2-sys-1f279ea7f9a9f4f3/build-script-build`
│B│ warning: libgit2-sys@0.18.4+1.9.3: no GIT_EXPERIMENTAL_SHA256 constant in headers
│B│ error: failed to run custom build command for `libgit2-sys v0.18.4+1.9.3`
│B│
│B│ Caused by:
│B│ process didn't exit successfully: `/mason/build/x86_64/2.2.0.tar.gz/target/release/build/libgit2-sys-1f279ea7f9a9f4f3/build-script-build` (exit status: 101)
│B│ --- stdout
│B│ cargo:rustc-check-cfg=cfg(libgit2_vendored,libgit2_experimental_sha256,)
│B│ cargo:rerun-if-env-changed=LIBGIT2_NO_VENDOR
│B│ cargo:rerun-if-env-changed=LIBGIT2_EXPERIMENTAL_NO_PKG_CONFIG
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
│B│ cargo:rerun-if-env-changed=HOST_PKG_CONFIG
│B│ cargo:rerun-if-env-changed=PKG_CONFIG
│B│ cargo:rerun-if-env-changed=LIBGIT2_EXPERIMENTAL_STATIC
│B│ cargo:rerun-if-env-changed=LIBGIT2_EXPERIMENTAL_DYNAMIC
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
│B│ cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_PATH
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
│B│ cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
│B│ cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
│B│ cargo:rerun-if-env-changed=SYSROOT
│B│ cargo:rerun-if-env-changed=LIBGIT2_EXPERIMENTAL_STATIC
│B│ cargo:rerun-if-env-changed=LIBGIT2_EXPERIMENTAL_DYNAMIC
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
│B│ cargo:rustc-link-search=native=/usr/lib
│B│ cargo:rustc-link-lib=git2-experimental
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
│B│ cargo:rerun-if-env-changed=HOST_PKG_CONFIG
│B│ cargo:rerun-if-env-changed=PKG_CONFIG
│B│ cargo:rerun-if-env-changed=LIBGIT2_EXPERIMENTAL_STATIC
│B│ cargo:rerun-if-env-changed=LIBGIT2_EXPERIMENTAL_DYNAMIC
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
│B│ cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_PATH
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
│B│ cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
│B│ cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
│B│ cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
│B│ cargo:warning=no GIT_EXPERIMENTAL_SHA256 constant in headers
│B│
│B│ --- stderr
│B│
│B│ thread 'main' (12205) panicked at /mason/build/x86_64/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libgit2-sys-0.18.4+1.9.3/build.rs:100:13:
│B│ The environment variable `LIBGIT2_NO_VENDOR` has been set but no compatible system libgit2 could be found.
│B│ The build is now aborting. To disable, unset the variable or use `LIBGIT2_NO_VENDOR=0`.
│B│
│B│ stack backtrace:
│B│ 0: __rustc::rust_begin_unwind
│B│ 1: core::panicking::panic_fmt
│B│ 2: build_script_build::main
│B│ 3: core::ops::function::FnOnce::call_once
│B│ note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
│B│ warning: build failed, waiting for other jobs to finish...
I dont believe gram (or git2-rs?) was able to find my build of libgit2 using the experimental option, what do? Also is the issue applicable here or in libgit2?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the libgit2-sys build.rs entry point and trace how LIBGIT2_NO_VENDOR, pkg-config, and the experimental SHA-256 header check identify the system library. Reproduce the build with the reported environment and inspect the selected libgit2 headers and pkg-config metadata; done means the compatible experimental library is detected and the build proceeds without the panic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, rust
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100