grpc-rs: Linking fails against libssl on OS X
Describe the bug
I found this originally on another project, but I can reproduce the same thing against the grpc-rs repo. The final step of cargo build fails with a linker error:
[...]
= note: ld: warning: directory not found for option '-L/Users/habnabit/Projects/20181023-activity-aggregator/grpc-rs/target/debug/build/grpcio-sys-88e0b97a2cd094d1/out/build/third_party/boringssl/ssl'
ld: warning: directory not found for option '-L/Users/habnabit/Projects/20181023-activity-aggregator/grpc-rs/target/debug/build/grpcio-sys-88e0b97a2cd094d1/out/build/third_party/boringssl/crypto'
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Full output here: https://gist.github.com/habnabit/1b9a0cf0d0454db3ee98e7bb46f40624
To Reproduce
On a clean grpc-rs checkout:
$ git checkout v0.4.4
$ git submodule update --init --recursive
$ OPENSSL_ROOT_DIR=/usr/local/opt/openssl cargo build --features openssl --examples
Expected behavior Presumably this build should succeed. I don’t think I have a broken openssl.
System information macOS 10.14.5; homebrew openssl.
$ cargo version
cargo 1.35.0 (6f3e9c367 2019-04-04)
$ rustc --version
rustc 1.35.0 (3c235d560 2019-05-20)
$ ls -ld /usr/local/opt/openssl
lrwxr-xr-x 1 habnabit admin 24 May 31 20:26 /usr/local/opt/openssl -> ../Cellar/openssl/1.0.2r
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 35 (15 by maintainers)
Commits related to this issue
- grpc-sys: fix ssl path when using openssl (#387) We should not rely on the assumption that ssl library is in the search path when enabling openssl features. This PR utilize the path figured by cmak... — committed to tikv/grpc-rs by BusyJay 5 years ago
- grpc-sys: fix ssl path when using openssl (#387) We should not rely on the assumption that ssl library is in the search path when enabling openssl features. This PR utilize the path figured by cmake ... — committed to Ten0/grpc-rs by BusyJay 5 years ago
- grpc-sys: fix ssl path when using openssl (#387) We should not rely on the assumption that ssl library is in the search path when enabling openssl features. This PR utilize the path figured by cmake ... — committed to Ten0/grpc-rs by BusyJay 5 years ago
- grpc-sys: fix ssl path when using openssl (#387) Signed-off-by: Jay Lee <busyjaylee@gmail.com We should not rely on the assumption that ssl library is in the search path when enabling openssl feature... — committed to tikv/grpc-rs by BusyJay 5 years ago
- grpc-sys: fix ssl path when using openssl (#387) Signed-off-by: Jay Lee <busyjaylee@gmail.com We should not rely on the assumption that ssl library is in the search path when enabling openssl feature... — committed to tikv/grpc-rs by BusyJay 5 years ago
- Support openssl-vendored feature (#406) * support using vendored openssl (#262) * support using vendored openssl * minor refactor * remove unused imports Signed-off-by: niedhui <niedhui@g... — committed to tikv/grpc-rs by overvenus 5 years ago
Hi, @habnabit @aknuds1 I recently got a chance to tweak around on a mac and made up a fix. Can you verify whether #387 fixes your issues?
I think you can do a full rebuild and then check where the ssl library and crypto library locates. They are expected to be built and written to
target/debug/build/grpcio-sys-hashes/out/build/third_party/boringssl/ssl.@habnabit Technically you don’t. The error is reported because ld can’t find the library. Another way to fix this is tell ld where the openssl library locates. You can add the libssl path to the LIBRARY_PATH/LD_LIBRARY_PATH if you are using Linux. There should be similar variables on MacOS too.
@aknuds1 I think it has been included in 0.5.0-alpha.2.
Just enable the features like following:
It will compile openssl from source.
Have you install openssl library? Can it compile if you just use reqwest? Note that grpcio also requires devel files of openssl. And you may try vendored feature if you like.