CMake not able to find OpenSSL library

cmake bootstrap could not find openssl
build cmake without openssl
cmake openssl example
cmake openssl windows
install openssl ubuntu
cmake bootstrap openssl
cmake set openssl_root_dir
cmake openssl crypto

I am trying to install a software, which uses cmake to install itself, when i give at commandlin cmake .. it gives me following error in this file, CMakeLists.txt -------- line ---> find_package(OpenSSL REQUIRED) :--

 cmake ..
-- Could NOT find Git (missing:  GIT_EXECUTABLE) 
ZLib include dirs: /usr/include
ZLib libraries: /usr/lib/arm-linux-gnueabihf/
Compiling with SSL support
CMake Error at /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES
Call Stack (most recent call first):
  /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:291 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake-2.8/Modules/FindOpenSSL.cmake:313 (find_package_handle_standard_args)
  CMakeLists.txt:436 (find_package)

Here is the part of file CMakeLists.txt, where error is comming :------

# OpenSSL
    message("Compiling with SSL support")

    if (USE_CYASSL)
        # Use CyaSSL as OpenSSL replacement.
        # TODO: Add a find_package command for this also.
        message("CyaSSL include dir: ${CYASSL_INCLUDE_DIRS}")
        message("CyaSSL libraries: ${CYASSL_LIB}")

        # Additional to the root directory we need to include
        # the cyassl/ subdirectory which contains the OpenSSL
        # compatability layer headers.
        foreach(inc ${CYASSL_INCLUDE_DIRS})
            include_directories(${inc} ${inc}/cyassl)

        # TODO: Add support for STATIC also.
        find_package(OpenSSL REQUIRED)

        message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}")
        message("OpenSSL libraries: ${OPENSSL_LIBRARIES}")

endif(WITH_SSL) Now i have installed Openssl, here :----

ssl header is here   -- > /usr/local/ssl/include/openssl/
ssl library is here  -- > /usr/local/ssl/lib/libssl.a
openssl is here      -- > /usr/local/ssl/bin

I have set my .profile as :----

export LD_LIBRARY_PATH=/usr/local/ssl/include/openssl:/usr/lib:/usr/local/lib:/usr/lib/pkgconfig:/usr/local/include/wx-2.8/wx:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
export OPENSSL_ROOT_DIR=/usr/local/ssl
export OPENSSL_LIBRARIES=/usr/local/ssl/lib/

PATH = /usr/local/ssl/bin:$PATH

How to resolve this error ?

edit :-- Getting this error

/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
dso_dlfcn.c:(.text+0x10): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x24): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x30): undefined reference to `dlclose'

I had the same problem (openssl) and this worked for me on Ubuntu 14.04.1 LTS. The solution is the same up to Ubuntu 18.04 (tested).

sudo apt-get install libssl-dev

Could NOT find OpenSSL (missing: OPENSSL_LIBRARIES) � Issue , Actually, there is no OPENSSL_LIBRARIES in CMakeCache.txt, it named Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the vHanda added a commit to GitJournal/ndk-libraries that referenced this� It is a common misunderstanding: CMake does not need environment variables to know where the library and include dir are but CMake variables. Since CMake can not find your OpenSSL lib and include directory, you will have to manually tell him where they are with its command line when you call it.

If you're using Ubuntu, run sudo apt install libssl-dev.

CMake: Could NOT find OpenSSL � Issue #4219 � microsoft/vcpkg , installed_two openssl libraries: openssl[core]:x64-windows Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable for VS 2017. I am not sure if this is a vcpkg, cmake or openssl issue� It is more a CMake related issue. Finding OpenSSL is delegated to find_package(OpenSSL) command on CMakeLists.txt. Also, make sure WITH_GCRYPT variable is setted to false. Finally, you may manually set the OPENSSL_ related variables using ccmake or cmake-gui.

fixed it on macOS using

brew install openssl
cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib

FindOpenSSL — CMake 3.6.3 Documentation, FindOpenSSL�. Find the OpenSSL encryption library. Imported Targets�. This module defines the following IMPORTED targets:. Sometimes the “official” CMake FindXXX.cmake scripts are not ready to find our libraries (unsupported library names for specific settings, fixed installation directories like C:\OpenSSL, etc.) Or maybe there is no “official” CMake script for our library. In these cases we can provide a custom FindXXX.cmake file in our Conan packages. 1.

Please install openssl from below link: then set the variables below:


CMake not able to find OpenSSL library - openssl - android, I am trying to install a software, which uses cmake to install itself, when i give at commandlin cmake .. it gives me following error in this file, CMakeLists.txt� As stated by @Tsyvarev in the comments, OPENSSL_USE_STATIC_LIBS is an hint in finding libraries and should prepend find_package(OpenSSL). Verified in FindOpenSSL.cmake source, edited accordingly. – ceztko Apr 23 '19 at 9:26

Same problem, and fixed it on my centos 6.5 using the following command.

yum install openssl-devel

FindOpenSSL: fails to find 3rd-party openssl (#18960) � Issues , CMake Error at failed to find the openssl lib because of Why it supposed to binary library files are located in the OPENSSL_ROOT_DIR? Set OPENSSL_ROOT_DIR to the root directory of an OpenSSL installation. Set OPENSSL_USE_STATIC_LIBS to TRUE to look for static libraries. Set OPENSSL_MSVC_STATIC_RT set TRUE to choose the MT version of the lib.

Could NOT find OpenSSL (build for iOS) (#19649) � Issues � CMake , The library is successfully found: -- Found OpenSSL: .cmake:137 (message): Could NOT find OpenSSL, try to set the path to Obviously you will not be able to compile an iOS program with MacOS OpenSSL as the� This target is available only if found OpenSSL version is not less than 0.9.8. By linking this target the above OpenSSL targets can be linked even if the project has different MSVC runtime configurations with the above OpenSSL targets.

CMake无法找到OpenSSL库| 码农家园, cmake .. -- Could NOT find Git (missing: GIT_EXECUTABLE) ZLib include dirs: ssl library is here -- > /usr/local/ssl/lib/libssl.a /usr/local/ssl/lib/libcrypto.a openssl� OPENSSL_ROOT_DIR-Set this variable to the root installation of OpenSSL Read-Only variables: OPENSSL_FOUND - System has the OpenSSL library OPENSSL_INCLUDE_DIR - The OpenSSL include directory OPENSSL_CRYPTO_LIBRARY - The OpenSSL crypto library OPENSSL_SSL_LIBRARY - The OpenSSL SSL library OPENSSL_LIBRARIES - All OpenSSL libraries OPENSSL_VERSION

cmake not able to find openssl, I run into this problem, too. And with some searching the internet, I find this issue. Finally, I find the reason why cmake cannot successfully decide openssl version.

  • This should be accepted answer! Thanks for solution!
  • Works on Ubuntu 16.04 LTS as well.
  • This package is called openssl-devel on Centos 7, so you would do sudo yum install openssl-devel
  • This does not work anymore; not on Ubuntu 18.04 at least.
  • @Astrid I was able to make it works in Ubuntu 18.04
  • @Astrid it worked fine for me. What error message do you get?
  • Worked for me too on ubuntu 18.04 @Astrid
  • OPENSSL_LIBRARIES is an output variable, not an input. See…
  • Works like a charm, thanks! I was able to extract the zip file downloaded form the link you mentioned. After that I just added -DOPENSSL_ROOT-DIR="C:/Path/To/Extracted/Files".
  • This is now very out of date and probably dangerous to use. The openssl website has links to 2 sites that provide binaries. That's seems to be the problem with security related libs like this. However, setting the values like that should work with the other binary downloads too.
  • You probably could provide more details about the solution you found