Skip to content

error: unknown type name 'GIT_BEGIN_DECL' #723

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

Closed
kornelski opened this issue Jun 17, 2021 · 3 comments
Closed

error: unknown type name 'GIT_BEGIN_DECL' #723

kornelski opened this issue Jun 17, 2021 · 3 comments

Comments

@kornelski
Copy link
Contributor

kornelski commented Jun 17, 2021

The version of libgit2-sys on crates.io has stopped building on my machine (upgrade to macOS 12 beta may have been related) for an odd reason: GIT_BEGIN_DECL is undefined.

The issue is reliably reproducible, with both Apple clang and Homebrew gcc 11.

warning: In file included from libgit2/src/alloc.c:8:
warning: In file included from libgit2/src/alloc.h:11:
warning: /private/tmp/foo/target/debug/build/libgit2-sys-a2d40bc23ad2df82/out/include/git2/sys/alloc.h:13:1: error: unknown type name 'GIT_BEGIN_DECL'
warning: GIT_BEGIN_DECL
warning: ^

The problem appears to be fixed in the latest git of git2-rs (as of 7d12405), i.e:

git2 = "0.13.20"

doesn't build, but:

git2 = { git = "https://github.com/rust-lang/git2-rs" }

builds fine.

Therefore, can you release the latest changes?

@ehuss
Copy link
Contributor

ehuss commented Jun 17, 2021

Hm. We can definitely make a new release, but I am a bit surprised that it would make a difference because there haven't been any changes that would necessarily affect the build of libgit2-sys here. (Changes listed here.) The only change that might be relevant is the vendored-openssl change, but that should only affect the linking of openssl, and only if you are using that feature (are you?). I also wouldn't expect the use of openssl to change the parsing of a header.

Looking at the code, I don't see how that can fail. The top of sys/alloc.h imports git2/common.h which defines GIT_BEGIN_DECL. I don't see how it is possible for that to be undefined.

Does using git2 = { git = "https://github.com/rust-lang/git2-rs", tag="0.13.20" } still fail? I'm wondering if there is some difference in how it is built as a "path-style" dependency (there are various subtle differences).

I'm also wondering, do you maybe have libgit2 installed via homebrew (or anywhere else)? I'm just wondering, if maybe similar to #721 there is some interaction with the system-installed copy.

@kornelski
Copy link
Contributor Author

Yeah, that's weird! The git dependency from the tag works, the crates.io dep doesn't.

@kornelski
Copy link
Contributor Author

kornelski commented Jun 17, 2021

Oh, nevermind. rm -rf ~/.cargo/registry/ fixed it. My registry copy must have gotten corrupted somehow. Sorry for the false alarm.

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

2 participants