简体   繁体   中英

How can I use BoringSSL in Linux that already has OpenSSL installed?

I am able to compile BoringSSL on Ubuntu and created libssl.a and libcrypto.a. In Makefile I have changed -L path to point to those library location and -lssl -lcrypto to specify the library name. However my machine already has OpenSSL installed, so looks like in this case it is the OpenSSL libs getting picked up as always because the libraries have exact same name.

If there any other way to enforce OS to use BoringSSL other than completely remove or disable OpenSSL and try?

If you have -L pointed to the directory where BoringSSL is built, it will always use BoringSSL instead of the system SSL (except if the linker is searching for shared libraries only, as John Bollinger points out).

You'll also need to pass -pthread to the compiler as it can't implicitly pull in the POSIX thread library with a static library like it can with a shared library.

Please make sure that the library path with the shared libraries is not in the search paths of the linker and then the -L search path will be used and picks up the static libraries.

Alternatively try adding -Bstatic flag after -L to notify linker to use static libraries only.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM