How to fix the missing libraries error in CMake? - c++

I'm setting up a new server, CMake 3.14.0-rc1 send me to a error message. i try some solutions post here but i dont find the correct one.
"CMake Error at C:/Program Files/CMake/share/cmake-3.14/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find OpenSSL (missing: OPENSSL_LIBRARIES)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.14/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
src/cmake/macros/FindOpenSSL.cmake:184 (find_package_handle_standard_args)
CMakeLists.txt:92 (find_package)"
this is the message.
I add manually the missing entry but not work. (Windows 10 and OpenSSL version 1.1.1a not light installed.
thank you all can help me for a solution.

CMake automatically calls the function FindOpenSSL:
FindOpenSSL
Find the OpenSSL encryption library.
This module will set the following variables in your project:
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
This is set to $major.$minor.$revision$patch (e.g. 0.9.8s).
Yet OPENSSL_LIBRARIES is missing; it generally means openssl needs to be installed on your development environment. You'd generally need the devel package.

Click Advanced tab in Cmake and set Openssl_root_dir

Related

Finding OpenBLAS on Windows with CMake

I followed the instructions here:
https://github.com/xianyi/OpenBLAS/wiki/How-to-use-OpenBLAS-in-Microsoft-Visual-Studio
for building and installing OpenBLAS, specifically 1. "Native (MSVC) ABI".
And now all the includes and libraries and CMake files are in C:/opt like it wanted.
I then saw I could use FindBLAS in my project's CMakeFile so I added
FindBLAS(), but apparently it's not a command?
I saw everyone who mentioned FindBLAS instead wrote:
set(BLA_VENDOR OpenBLAS)
find_package(BLAS REQUIRED)
so I'm actually pretty confused. What is FindBLAS? Why can't I find any examples of anyone using it?
But then I tried the set and find_package route I saw everywhere and got:
CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find BLAS (missing: BLAS_LIBRARIES)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.25/Modules/FindBLAS.cmake:1346 (find_package_handle_standard_args)
I tried setting the environment variables, resetting, everything I can think of. I'm not sure why CMake refuses to find the library and update ${BLAS_LIBRARIES}.

CMake cannot find OpenSSL libraries in windows

This is my cmake file:
cmake_minimum_required(VERSION 3.5.1)
set(PACKAGE_NAME "atest")
find_package(OpenSSL REQUIRED)
project(${PACKAGE_NAME} LANGUAGES C CXX)
I have a custom openssl binary that I wanna use in a folder
C:\MyOpenSSL\
C:\MyOpenSSL\include\ ... all the include files here
C:\MyOpenSSL\lib\ ... libssl.lib, libcrypto.lib and ossl_static.pdb
So when I run, CMake . -DOPENSSL_ROOT_DIR=C:\MyOpenSSL\
I get the following errors:
C:/cmake/cmake-3.22.2-win/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY) (found
version "1.1.1c")
Call Stack (most recent call first):
C:/cmake/cmake-3.22.2-win/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/cmake/cmake-3.22.2-win/share/cmake-3.22/Modules/FindOpenSSL.cmake:574 (find_package_handle_standard_args)
CMakeLists.txt:5 (find_package)
What am I missing here? Is somehow find_package found out the version v1.1.1c, but still saying it couldn't find it?
It turns out if I build and install openssl manually it works.
For whatever reason the raw lib i provided was not good enough for cmake to find it. I am still not sure why.

CMAKE - Could't find boost

I have a problem with Cmake. Every library i want to configure and generate it shows me:
CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230
(message): Could NOT find Boost (missing: Boost_INCLUDE_DIR system serialization)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594(_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.22/Modules/FindBoost.cmake:2360 (find_package_handle_standard_args)
CMake/HighFiveTargetDeps.cmake:27 (find_package)
CMakeLists.txt:63 (include)
I have no idea what should I do. Right now Im trying to generate HighFive library for C++ and it shows me the same problem like in Shark library, Shogun library, Opencv, Eigen, Xtensor... Any idea what should I do? I'll be glad for every answer.
It looks like the project you are trying to compile requires the Boost include libraries. Did you install them? If not, you need to install Boost first.
Then you can take a look at this post, which has a similar problem in my opinion. The accepted answer explained the following system variables were added (please adapt your paths and version numbers):
BOOST_INCLUDEDIR C:\SDKs\boost_1_58_0\
BOOST_LIBRARYDIR C:\SDKs\boost_1_58_0\lib64-msvc-12.0
BOOST_ROOT C:\SDKs\boost_1_58_0\boost

cmake can not find openssl on windows

I already read this post and it did not answer my questions: (cmake not able to find openssl)
I am working in windows 10 64 bit and I want to use boost asio with ssl support, so I installed openssl in C:\Local\OpenSSL-Win64 and I have a environment variable pointing to this.
I have this code in cmake:
file(TO_CMAKE_PATH $ENV{OPENSSL_ROOT} OPENSSL_ROOT_DIR)
message(WARNING "root: ${OPENSSL_ROOT_DIR}")
find_package(OpenSSL )
message(WARNING "OpenSSL_VERSION: ${OPENSSL_VERSION}")
message(WARNING "OpenSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}")
message(WARNING "OpenSSL_LIBRARIES: ${OPENSSL_LIBRARIES}")
and when I run the cmake, I am getting this message:
CMake Warning at CMakeLists.txt:44 (message):
root: C:/Local/OpenSSL-Win64
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindOpenSSL.cmake:293 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:45 (find_package)
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindOpenSSL.cmake:294 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:45 (find_package)
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindOpenSSL.cmake:296 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:45 (find_package)
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindOpenSSL.cmake:298 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:45 (find_package)
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES) (found version ".0.0`")
CMake Warning at CMakeLists.txt:47 (message):
OpenSSL_VERSION: .0.0`
CMake Warning at CMakeLists.txt:48 (message):
OpenSSL_INCLUDE_DIR: C:/Local/OpenSSL-Win64/include
CMake Warning at CMakeLists.txt:49 (message):
OpenSSL_LIBRARIES: SSL_EAY_LIBRARY-NOTFOUND;LIB_EAY_LIBRARY-NOTFOUND
as it can be seen the cmake could find the environment variable which is correctly pointed to C:/Local/OpenSSL-Win64
also interestingly, it can find the include path:
CMake Warning at CMakeLists.txt:48 (message):
OpenSSL_INCLUDE_DIR: C:/Local/OpenSSL-Win64/include
but the version, and include library is not right.
is there any specific ways that I can force cmake to find the openssl?
How can I make sure that it finds the suitable static library?
Edit 1
Aftre upgrading to cmake 3.8, now, cmake can find openssl, but not its libraries. The output is as follow:
Found OpenSSL: C:/Local/OpenSSL-Win64/lib/libssl.lib (found version "1.1.0e")
CMake Warning at CMakeLists.txt:52 (message):
OpenSSL_VERSION: 1.1.0e
CMake Warning at CMakeLists.txt:53 (message):
OpenSSL_INCLUDE_DIR: C:/Local/OpenSSL-Win64/include
CMake Warning at CMakeLists.txt:54 (message):
OpenSSL_LIBRARIES:
Why libraries are not found?
Edit 2
The reason that it could not find library was that I used the variable name with a different case. The correct name is OPENSSL_LIBRARIES.
For more information read the findopenssl.cmake file as part of the cmake distribution.
More recent OpenSSL versions (the 1.1.x series I think) slightly changed the formatting of how the version number was specified in the opensslv.h header. This caused CMake's version parsing code in its FindOpenSSL.cmake module to fail, which was then fixed around CMake 3.5.0. Furthermore, from OpenSSL 1.1.0, the library names on Windows are closer to their Unix counterparts and are named libcrypto and libssl (possibly with further suffixes) instead of the old names libeay32 and ssleay32. CMake 3.7.0 contained the update to account for this library name change. As a result of these two changes and fixes, if you want to use OpenSSL 1.1.0 or later with a CMake project, you should probably be using CMake 3.7.0 or later.
We had a similar problem with cmake 2.8.12.2 and OpenSSL 1.0.2u
CMake Error at /usr/share/cmake/Modules/FindOpenSSL.cmake:278 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:169 (FIND_PACKAGE)
To find out more details, you can add "--debug-output" option to cmake command.
In our case, it helped to specify the -D_OPENSSL_VERSION on cmake command line:
OPENSSL_VER=1.0.2u
cmake ...
-DOPENSSL_ROOT_DIR=$IDIR_BASE \
-DOPENSSL_INCLUDE_DIR=$IDIR_BASE/include \
-D_OPENSSL_VERSION="$OPENSSL_VER" \

Cmake can't find Boost Folder

I am using windows 7 - 64bit and am trying to build a project. When I use cmake i get the error
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoos
t.cmake:1191 (message):
Unable to find the requested Boost libraries.
Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing
Boost's headers.
Call Stack (most recent call first):
src/CMakeLists.txt:310 (find_package)
CMake Error at src/CMakeLists.txt:312 (message):
Boost C++ libraries not found. Please install or try setting BOOST_ROOT
I have set the variable to BOOST_ROOT to D:\MyProject\boost_1_43_0\boost\
but i still get this . How can i resolve this issue.
Placing boost in a subfolder of the project is not standard CMake practice for locating boost. I have boost x64 - MSVC 2010 installed in Program Files and CMake automatically locates it.
Boost_DIR : C:/Program Files/Boost/share/cmake/boost
Boost_INCLUDE_DIR : C:/Program Files/Boost/include
You can attempt to set Boost_DIR at the system environment variables level as well.