-
Notifications
You must be signed in to change notification settings - Fork 396
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
libgit2-sys is looking up iconv in /opt but git2 only searches system folders #180
Comments
Thanks for sharing this, it helped me figure out my similar problem. Since this is something that seems to come up regularly, I thought I'd share the details of my situation in the hope it will be useful to the person who lands here from Google... The solution that worked for me is at the bottom of this comment. (Note that you can disable the default-features of git2-rs (as suggested here), if you're OK with losing openssl-based functionality - accessing git/https URLs I think?) I was getting the same error after cmake was removed from the git2's build process in alexcrichton@76f4b74 I also have macports-installed OpenSSL, which openssl-sys detects and instructs Cargo to use by printing
Checking the output indicates that it expects symbols like
But the final binary is linked with the /opt/local/lib in the search path (coming from the
And since there's a libiconv library there, the default paths are not searched. But as the macports' version exports different symbols, I end up with the linker error:
Removing the [edit] but adding
[edit2] Using pkg_config as detailed below is a better solution. |
Ah, apparently openssl-sys is not the only one adding macports to the library search path, ncurses-rs does it too. Will doing what it does - running [edit] Turns out this is already implemented. You can opt in by setting an environment variable
[edit2] As of 2020, specifying |
I'm going to close this since this isn't something that this library itself has tons of control over unfortunately. |
Just meet exactly this error today. My solution is install |
I had this error again. Turns out git2-rs 0.13+ no longer requires the |
Copy of my comment #263 (comment) since this issue is also relevant:
Also, installing I don't have any |
Ah:
from https://lapcatsoftware.com/articles/bigsur.html I presume this would explain why the problem has arisen again on macOS 11 after it was previously fixed |
Re: rust-lang/cargo#3538
I get the following linker error when compiling anything that depends on libgit2-sys:
the linker error:
Here is my config:
macOS 10.12.2
Xcode 8.2.1
git version 2.10.1 (Apple Git-78)
CMake and openssl installed via MacPorts.
Example:
sudo port install cmake
sudo port install openssl
export OPENSSL_INCLUDE_DIR=/opt/local/include
export OPENSSL_LIB_DIR=/opt/local/lib
cargo clean
cargo install dinghy
When compiling the C code for libgit2-sys-0.6.6:
-- Found Iconv: -L/usr/lib -liconv
Then when running rustc on libgit2-sys-0.6.6/lib.rs:
-L native=/opt/local/lib
Where there is also an iconv.
The user can fix this by forcing git2 to search /opt/local as follows:
CMAKE_PREFIX_PATH=/opt/local/ cargo build
However, this is decidedly not user-friendly nor easily googleable (well, now it might be).
The text was updated successfully, but these errors were encountered: