Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.13.1 causing an error in project using git2 #540

Closed
qtfkwk opened this issue Apr 1, 2020 · 4 comments
Closed

0.13.1 causing an error in project using git2 #540

qtfkwk opened this issue Apr 1, 2020 · 4 comments

Comments

@qtfkwk
Copy link

qtfkwk commented Apr 1, 2020

$ cargo build
...
   Compiling git2 v0.13.1
error[E0531]: cannot find unit struct, unit variant or constant `GIT_ERROR_HTTP` in crate `raw`
   --> /home/qtfkwk/.cargo/registry/src/github.com-1ecc6299db9ec823/git2-0.13.1/src/error.rs:159:18
    |
159 |             raw::GIT_ERROR_HTTP => super::ErrorClass::Http,
    |                  ^^^^^^^^^^^^^^ help: a constant with a similar name exists: `GIT_ERROR_NET`
    |
   ::: /home/qtfkwk/.cargo/registry/src/github.com-1ecc6299db9ec823/libgit2-sys-0.12.0+0.99.0/lib.rs:40:9
    |
40  |         pub const $variant: $name = $val;
    |         --------------------------------- similarly named constant `GIT_ERROR_NET` defined here

error[E0425]: cannot find value `GIT_ERROR_HTTP` in crate `raw`
   --> /home/qtfkwk/.cargo/registry/src/github.com-1ecc6299db9ec823/git2-0.13.1/src/error.rs:247:13
    |
247 |             GIT_ERROR_HTTP,
    |             ^^^^^^^^^^^^^^ help: a constant with a similar name exists: `GIT_ERROR_NET`
    |
   ::: /home/qtfkwk/.cargo/registry/src/github.com-1ecc6299db9ec823/libgit2-sys-0.12.0+0.99.0/lib.rs:40:9
    |
40  |         pub const $variant: $name = $val;
    |         --------------------------------- similarly named constant `GIT_ERROR_NET` defined here

Discovered 0.13.1 had released via cargo outdated --root-deps-only, then updated my Cargo.toml to have git2 = "0.13.1", then observed the above error during cargo build.

Short term workaround is to change Cargo.toml to have git2 = "<0.13.1", which builds successfully with 0.13.0.

Any ideas about the root cause and/or fix? Thanks in advance!

EDIT: OS: Debian Testing; libgit2-28, libgit2-dev not installed

EDIT:

$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/qtfkwk/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.42.0 (b8cedc004 2020-03-09)
@ehuss
Copy link
Contributor

ehuss commented Apr 1, 2020

You can update libgit2-sys to the latest version to fix this (cargo update -p libgit2-sys).

@alexcrichton when bumping versions, should we probably update this line as well? Like this:

diff --git a/Cargo.toml b/Cargo.toml
index c19830c..7232cf0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,7 +20,7 @@ url = "2.0"
 bitflags = "1.1.0"
 libc = "0.2"
 log = "0.4.8"
-libgit2-sys = { path = "libgit2-sys", version = "0.12.0" }
+libgit2-sys = { path = "libgit2-sys", version = "0.12.2" }

 [target."cfg(all(unix, not(target_os = \"macos\")))".dependencies]
 openssl-sys = { version = "0.9.0", optional = true }

@qtfkwk
Copy link
Author

qtfkwk commented Apr 1, 2020

@ehuss Perfect! cargo update -p libgit2-sys worked! Much appreciated! Please consider the original issue closed from my point of view, although will allow you or @alexcrichton to close it when that question has been resolved. Thanks again!

@XAMPPRocky
Copy link
Member

@ehuss Without also updating the libgit2-sys dependency, you can't use automatic dependency management services like dependabot. Since that can't use cargo update.

andytom added a commit to starship/starship that referenced this issue Apr 3, 2020
Fix the dependencies for git2 based on the suggestions from
rust-lang/git2-rs#540.
andytom added a commit to starship/starship that referenced this issue Apr 3, 2020
* build(deps): bump git2 from 0.13.0 to 0.13.1

Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Commits](rust-lang/git2-rs@git2-curl-0.13.0...0.13.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Fix git2 build failures

Fix the dependencies for git2 based on the suggestions from
rust-lang/git2-rs#540.

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Thomas O'Donnell <andy.tom@gmail.com>
dagbrown pushed a commit to dagbrown/starship that referenced this issue Oct 22, 2021
* build(deps): bump git2 from 0.13.0 to 0.13.1

Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Commits](rust-lang/git2-rs@git2-curl-0.13.0...0.13.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Fix git2 build failures

Fix the dependencies for git2 based on the suggestions from
rust-lang/git2-rs#540.

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Thomas O'Donnell <andy.tom@gmail.com>
@ehuss
Copy link
Contributor

ehuss commented Jul 8, 2023

Closing as I believe this is resolved. When updating the base crate to use new bindings, we'll be sure to also update the -sys dependency.

@ehuss ehuss closed this as completed Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants