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" \
Related
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}.
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.
Cloned a repository and installed the Boost library. My IDE (CLion) keeps telling me
CMake Error at C:/Program Files/JetBrains/CLion 2021.3/bin/cmake/win/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Boost (missing: regex date_time system filesystem
unit_test_framework program_options) (found version "1.67.0")
Call Stack (most recent call first):
C:/Program Files/JetBrains/CLion 2021.3/bin/cmake/win/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/JetBrains/CLion 2021.3/bin/cmake/win/share/cmake-3.21/Modules/FindBoost.cmake:2345 (find_package_handle_standard_args)
CMakeLists.txt:29 (find_package)
Prior to this, I was trying to use the most updated Boost library which led me to more errors, after changing it to the correct library, those errors went away, leaving me with this. This error also remains when trying to use the new library too.
I have tried set(BOOST_ROOT C:/local/boost_1_71_0) as was the correct answer on another similar post, yet it didn't work. I have also tried adding it to my path, which also does nothing. To note: It is strange because it says the version number of the Boost library yet it says could not be found.
I am using CLion's bundled CMake, but I also have the official CMake installed just in case. I don't think CLion's cmake is the issue.
I have compiled Boost from source with Visual Studio 2017, and I'm using CMake 3.9.3 to find it with the following command in my CMakeLists.txt:
find_package(Boost REQUIRED COMPONENTS filesystem)
I'm invoking CMake like this:
cmake -G "Visual Studio 15 2017" ..
-DBOOST_ROOT="C:\Users\emlai\src\libs\boost_1_65_0"
-DBOOST_LIBRARYDIR="C:\Users\emlai\src\libs\boost_1_65_0\lib64-msvc-15.0"
I get the following message:
CMake Error at C:/Program Files/CMake/share/cmake-3.9/Modules/FindBoost.cmake:1902 (message):
Unable to find the requested Boost libraries.
Boost version: 1.65.0
Boost include path: C:/Users/emlai/src/libs/boost_1_65_0
Could not find the following Boost libraries:
boost_filesystem
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Call Stack (most recent call first):
CMakeLists.txt:31 (find_package)
CMake Error at C:/Program Files/CMake/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find SDL2 (missing: SDL2_LIBRARY SDL2_INCLUDE_DIR)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
build/cmake-modules/FindSDL2.cmake:173 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:42 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/Users/emlai/src/zenith/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/emlai/src/zenith/build/CMakeFiles/CMakeError.log".
The output of dir C:\Users\emlai\src\libs\boost_1_65_0\lib64-msvc-15.0 shows that the filesystem libraries are in place.
I have tried all of the answers here, but without success. The same happens with the prebuilt Boost libraries downloaded from here.
How can I solve this problem?
I needed to pass -DBoost_COMPILER="-vc141" to CMake to make it work (-vc141 being the same string as in the Boost library filenames).
I want to configure and then generate opencv library for qt creator to link them.
I opened cmake 3.1.0 and typed in the source and build path.
source:
C:/Users/Philipp_Laptop/Downloads/opencv/sources
build: C:/opencv-mingw
Then I configured the mingw-compiler with the path:
C:/Qt/Tools/mingw482_32/bin/gcc.exe
C:/Qt/Tools/mingw482_32/bin/g++.exe
After successful configure i set the with_Qt option.
I configured it twice and it shows me the following error:
Detected version of GNU GCC: 48 (408)
CMake Warning (dev) at cmake/OpenCVUtils.cmake:261 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Quoted variables like "WIN32" will no longer be dereferenced when the
policy is set to NEW. Since the policy is not set the OLD behavior will be
used.
Call Stack (most recent call first):
CMakeLists.txt:127 (OCV_OPTION)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):
By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Core", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5Core" with any
of the following names:
Qt5CoreConfig.cmake
qt5core-config.cmake
Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
"Qt5Core_DIR" to a directory containing one of the above files. If
"Qt5Core" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:447 (include)
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:19 (find_package):
By not providing "FindQt5Gui.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Gui", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5Gui" with any
of the following names:
Qt5GuiConfig.cmake
qt5gui-config.cmake
Add the installation prefix of "Qt5Gui" to CMAKE_PREFIX_PATH or set
"Qt5Gui_DIR" to a directory containing one of the above files. If "Qt5Gui"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
CMakeLists.txt:447 (include)
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:20 (find_package):
By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"Qt5Widgets", but CMake did not find one.
Could not find a package configuration file provided by "Qt5Widgets" with
any of the following names:
Qt5WidgetsConfig.cmake
qt5widgets-config.cmake
Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
"Qt5Widgets_DIR" to a directory containing one of the above files. If
"Qt5Widgets" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:447 (include)
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:21 (find_package):
By not providing "FindQt5Test.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Test", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5Test" with any
of the following names:
Qt5TestConfig.cmake
qt5test-config.cmake
Add the installation prefix of "Qt5Test" to CMAKE_PREFIX_PATH or set
"Qt5Test_DIR" to a directory containing one of the above files. If
"Qt5Test" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:447 (include)
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:22 (find_package):
By not providing "FindQt5Concurrent.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"Qt5Concurrent", but CMake did not find one.
Could not find a package configuration file provided by "Qt5Concurrent"
with any of the following names:
Qt5ConcurrentConfig.cmake
qt5concurrent-config.cmake
Add the installation prefix of "Qt5Concurrent" to CMAKE_PREFIX_PATH or set
"Qt5Concurrent_DIR" to a directory containing one of the above files. If
"Qt5Concurrent" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
CMakeLists.txt:447 (include)
Looking for Q_WS_X11
Looking for Q_WS_X11 - not found
Looking for Q_WS_WIN
Looking for Q_WS_WIN - found
Looking for Q_WS_QWS
Looking for Q_WS_QWS - not found
Looking for Q_WS_MAC
Looking for Q_WS_MAC - not found
Found OpenGL: opengl32
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
Could NOT find Qt4 (missing: QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE
QT_QTTEST_LIBRARY QT_UIC_EXECUTABLE) (found version "4.8.6")
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:374 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindQt4.cmake:1331 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
cmake/OpenCVFindLibsGUI.cmake:34 (find_package)
CMakeLists.txt:447 (include)
Configuring incomplete, errors occurred!
See also "C:/opencv-mingw/CMakeFiles/CMakeOutput.log".
See also "C:/opencv-mingw/CMakeFiles/CMakeError.log".
I used CMake GUI under Windows for this so I'll refer to this approach.
Let's start from problems related to CMAKE_PREFIX_PATH not defined.
To solve this you simply have to press ADD on the CMAKE GUI and add the variable of type PATH named CMAKE_PREFIX_PATH with value C:/Bin/Qt/5.3/mingw482_32/lib/cmake/ but using your own installation of Qt5. The directory you point now contains all modules you need: Qt5 directory, Qt5AxBase...
At this point you press configure and you should have QT_QMAKE_EXECUTABLE not valid. You need to set it properly, in my case: C:/Bin/Qt/5.3/mingw482_32/bin/qmake.exe.
Then press configuration again and see if some error is still present (you have others error I never saw but maybe they are consequence of the previous ones), in my case this solved all issues and the build proceeded.
The MINGW configuration seems to be fine: I did slightly different just putting the bin MINGW path in PAT variable as first entry and using the default compiler from CMAKE (but your solution is as valid as my one).