How to Fix: Could not find OpenSSL Error in Ubuntu and Other Linux

1 min

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.
Could not find OpenSSL error
Could not find OpenSSL error

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.


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.


Creator and author of Connect with me via Telegram, Twitter, or send us an email.
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments