git2-rs: Fails to build on macOS unless OPENSSL_ROOT_DIR is set
Projects that depend on git2-rs fail to build on macOS with openssl from Homebrew (tested 10.13, with libgit2-sys v0.6.12, and libgit2 and libssh2 installed via Homebrew):
– Found PkgConfig: /usr/local/bin/pkg-config (found version “0.29.2”) … – LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path. (…tons of CMake output…) ‘libgit2 failed to find libssh2, and SSH support is required’, libgit2-sys/build.rs:137:12
$ pkg-config --libs libssh2
-L/usr/local/Cellar/libssh2/1.8.0/lib -lssh2
git2-rs builds fine I export LIBGIT2_SYS_USE_PKG_CONFIG=1. However, it took me a bit of effort to investigate the failure and read the source code to learn that this option exists.
Could you use pkg-config by default?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (9 by maintainers)
Try sourcing this to get pkgconfig to find openssl:
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig"