CMake "Could NOT find OpenSSL" with MSYS2/mingw64 on Windows - windows

I'm trying to compile this project on Windows using MSYS2 with mingw64, and when running cmake . I get the following output:
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.16299.
-- Build type: Release
-- Source of Randomness: random_device
CMake Error at C:/msys64/mingw64/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (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.1b")
Call Stack (most recent call first):
C:/msys64/mingw64/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
C:/msys64/mingw64/share/cmake-3.13/Modules/FindOpenSSL.cmake:412 (find_package_handle_standard_args)
CMakeLists.txt:10 (find_package)
I have OpenSSL installed, as evidenced by:
$ which openssl
/mingw64/bin/openssl
$ openssl version
OpenSSL 1.1.1b 26 Feb 2019
And the OPENSSL_CRYPTO_LIBRARY that it seems to be looking for is either /mingw64/lib/libcrypto.a or /mingw64/lib/libcrypto.dll.a.
What's really throwing me for a loop is that in the CMake error message, it says "found version 1.1.1b", so clearly it is able to find it. Anyone have suggestions on how to resolve this error?

Turns out, I needed to add -G "Unix Makefiles" to my cmake command. By default it was producing Visual Studio solutions/projects, which is not what you want in mingw, and by adding this flag it was able to find the openssl files.

Related

compiling YCM for vim under cygwin windows with visual studio and cmake

So,
I'm trying to compile YouCompleteMe plugin for vim in windows using visual studio as documented. The current cmake that ships with cygwin doesn't have a generator for visual studio so I installed the official cmake through an installer and copied all the nessecary files into cygwin's bin folder including the share folder in the cygwin folder in order for it to work.
When I do cmake --version it displays cmake version 3.4.1 correctly and it seems to be working. However when I use the following command I'm getting a few errors:
cmake -G "Visual Studio 12 2013 Win64" . ..\third_party\ycmd\cpp
This command is the one I should be using to compile YCM under windows as stated in the docs. (without c autocomplete because I can't compile LLVM correctly under cygwin)
However it seems that it doesn't pick up the right compiler nor the right python version. I'm getting the following error:
Your C++ compiler does NOT support C++11, compiling in c++03 mode.
CMake Error at C:/cygwin64/share/cmake3.4/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
(Required is at least version "2.6")
Call Stack (most recent call first):
C:/cygwin64/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
C:/cygwin64/share/cmake-3.4/Modules/FindPythonLibs.cmake:264 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
BoostParts/CMakeLists.txt:30 (find_package)
--Configuring incomplete, errors occured!
See also: "C:/cygwin64/home/Hylke/.vim/bundle/YouCompleteMe/build/CMakeFiles/CMakeOutput.log".
Does anybody know of an easier way to get YCM working under cygwin? Aren't there some pre-compiled versions out there that I may use?
Or... Could someone point me into the right direction on how to compile it correctly using visual studio 2013 community 64 bits.
I've already tried using this command to fix the compiler issue:
cmake -G "Visual Studio 12 2013 Win64" -D CMAKE_C_COMPILER="/usr/bin/gcc.exe" -D CMAKE_CXX_COMPILER="/usr/bin/g++.exe" . ../third_party/ycmd/cpp
But that seems to give the same output.

How to compile libgit2 on windows using cmake?

I am trying to compile libgit2 and followed the instruction on https://libgit2.github.com/docs/guides/build-and-link/ but lock so far.
Can someone tell me what to do?
Here is the result from my command line:
-- Building for: Visual Studio 12 2013
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- zlib was not found; using bundled 3rd-party sources.
-- LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.
CMake Error at d:/cmake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
Call Stack (most recent call first):
d:/cmake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
d:/cmake/share/cmake-3.3/Modules/FindPythonInterp.cmake:162 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:594 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
See also "D:/temp/gitlib/libgit2-master/build/CMakeFiles/CMakeOutput.log".
See also "D:/temp/gitlib/libgit2-master/build/CMakeFiles/CMakeError.log".
Thanks,
libgit2 uses python (works both with versions 2 and 3 of the language) to build the tests. You can install python or ask CMake not to build the tests.
IIRC CMake will look in a few standard locations you don't necessarily need python in your path, though it doesn't hurt.
If you would rather not build the tests, you can pass -DBUILD_CLAR=OFF so it doesn't bother looking for python.
Download Python from Paython.org and install it (i.e. d:\python). Then Open your VS command line and type PATH D:\Python\Python35-32;d:\cmake\bin;%PATH%
That's all set now, go to your build folder run cmake .. and then cmake --build .

CMake Error: File /cygdrive/.../src/LLVMBuild.txt does not exist

I'm trying to build cling on Windows7 following the instructions here:
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=[Install Path] ..\src
cmake --build . --config [Release/Debug] --target cling
I notice that the compiler cmake is using being Visual Studio 12 2013 (either with cmake-gui or in cmdline), while I get the following error (full traceback is here):
Constructing LLVMBuild project information
CMake Error: File /cygdrive/e/ABOUT-C++/cling/src/LLVMBuild.txt does not exist.
CMake Error at E:/ABOUT-C++/cling/build/LLVMBuild.cmake:28 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:431 (include)
CMake Error: File /cygdrive/e/ABOUT-C++/cling/src/bindings/LLVMBuild.txt does not exist.
CMake Error at E:/ABOUT-C++/cling/build/LLVMBuild.cmake:30 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:431 (include)
Why is the path prefixed with /cygdrive/e/... but not E:/...? Are those valid paths? (The missing files cmake mention DO exist in the corresponding folder!)
Or is that because llvm / clang / cling should be built with cygwin on windows, while the compiler vc12 I'm using by default is incorrect?
My bet is that your problem lies in your python. Judging on D:/cygwin/bin/python2.7.exe it seems that you use special version of python that prepends /cygdrive/ all over the place.
Try using official binary package for Windows.

CMake Error: Could not find openSSL or GCrypt

I'm trying to use CMake in order to get libssh binaries for Windows.
I have Windows 7 OS and VS 2010.
I installed OpenSSL and set in CMake the entries OPENSSL_INCLUDE_DIR and OPENSSL_ROOT_DIR. After that, I get the following error:
Could NOT find NSIS (missing: NSIS_MAKE)
Could NOT find OpenSSL (missing: OPENSSL_LIBRARIES)
Could NOT find GCrypt, try to set the path to GCrypt root folder in the system variable GCRYPT_ROOT_DIR (missing: GCRYPT_INCLUDE_DIR GCRYPT_LIBRARIES)
CMake Error at CMakeLists.txt:57 (message):
Could not find OpenSSL or GCrypt
Any help will be welcome...
Thanks in advance
Worked out after I set the entries SSL_EAY_DEBUG and SSL_EAY_RELEASE.

how to get qt4 for a cmake build

I'm trying to build the latest sources of keepassX on OS X which I have found here: http://gitorious.org/keepassx .
I'm getting this error message complaining about a missing Qt4 library:
ernst#cnap-b13-01 ~/Temp/keepassx/build
[264] : cmake [-DCMAKE_INSTALL_PREFIX=/usr/local] [-DCMAKE_VERBOSE_MAKEFILE=ON] [-DWITH_GUI_TESTS=ON] ..
CMake Error at /Applications/CMake 2.8-7.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
Could NOT find Qt4 (missing: QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE
QT_RCC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR QT_QTCORE_INCLUDE_DIR
QT_QTCORE_LIBRARY QT_QTGUI_INCLUDE_DIR QT_QTGUI_LIBRARY
QT_QTTEST_INCLUDE_DIR QT_QTTEST_LIBRARY QT_UIC_EXECUTABLE) (Required is at
least version "4.6.0")
Call Stack (most recent call first):
/Applications/CMake 2.8-7.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
/Applications/CMake 2.8-7.app/Contents/share/cmake-2.8/Modules/FindQt4.cmake:1171 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:68 (find_package)
-- Configuring incomplete, errors occurred!
Any ideas on how to get this compiling?
I was able to solve this by installing the Qt SDK using the Mac OS X online installer and passing -DQT_QMAKE_EXECUTABLE=~/QtSDK/Desktop/Qt/4.8.1/gcc/bin/qmake to cmake.
Note that as the /Developer directory is no longer there with XCode 4.3 I also had to do sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer /Developer in order for keepassx to find some header files and compile successfully.
If Qt4 is installed in your system set QT_QMAKE_EXECUTABLE to the path for the qmake binary. You can do that in cmake-gui or ccmake. Or even with the -D parameter to cmake.
Use the option -no-framework when configuring qt:
./configure -no-framework -static -prefix ~/Libraries/qt-installed

Resources