Here’s how you can fix the “could not find OpenSSL” error in Debian, Ubuntu, Fedora and Arch Linux.
Thousands of open-source applications use the OpenSSL library to implement features which require secure connectivity between components over the web. Hence it’s a critical package and is needed when compiling any source package that implements OpenSSL.
If you don’t have it in your system, you may run into this error during compilation.
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR) (Required is at least version "0.9.7")
-- Could NOT find WolfSSL (missing: WOLFSSL_LIBRARY WOLFSSL_INCLUDE_DIR) (Required is at least version "3.4")
-- Could NOT find MbedTLS (missing: MBEDTLS_LIBRARY MBEDTLS_INCLUDE_DIR) (Required is at least version "1.3")
CMake Error at CMakeLists.txt:258 (message):
Unable to find any supported crypto library.
How to fix
The package name is different in Linux distributions. Use as per below.
Open a terminal window and use the following command to install in Ubuntu, Debian, Linux Mint and related distributions.
sudo apt install libssl-dev
For Fedora, CentOS, RHEL and related distributions, use the below.
sudo dnf install openssl-dev
For Arch Linux, use the following command to install it.
sudo pacman -S --needed openssl
After you install it, you can now run your compilation which caused the error.
Summary
I hope this guide solves the could not find OpenSSL error. Usually, the method of installing related packages should work for most cases. If you run into any other error, let me know in the comment box below.