linking fails on windows when using MSVC toolchain
Closed this issue · 1 comments
Here is some contextual information:
git2 = "0.20" // Cargo.toml dependency
LIBGIT2_NO_VENDOR="0" // env var forcing git2-rs to build libgit2
When using the x86_64-pc-windows-msvc toolchain, I receive the following error:
= note: LINK : fatal error LNK1181: cannot open input file 'git2.lib'
As far as I can tell, it looks like libgit2 is being compiled correctly by cargo, as there's a .rlib, .rmeta, and .d file in the target/debug/deps directory. I'm able to get around this issue by compiling libgit2 myself, using the Visual Studio 2019 generator, and adding "-L" to RUSTFLAGS, but this doesn't seem ideal.
Also, this error doesn't happen when using the GNU toolchain. However, due to technical restrictions, this application needs to be build using the MSVC toolchain.
Any help would be appreciated.
Please disregard this issue. It has been figured out. I was unaware that the feature "vendored-libgit2" had to be enabled for the crate to build libgit2. I just assumed that it would do that automatically.