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

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.

Related

CMake cant find Boost

When configuring, the logs show the following in red, I've included version and OS if it helps.
Windows 10
CMake 3.25.1
Boost 1.81.0
Visual Studio 17 2022
CMake Warning at F:/My_Project/Cmake/share/cmake-3.25/Modules/FindBoost.cmake:1384 (message):
New Boost version may have incorrect or missing dependencies and imported targets
Call Stack (most recent call first):
F:/My_Project/Cmake/share/cmake-3.25/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
F:/My_Project/Cmake/share/cmake-3.25/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
deps/boost/CMakeLists.txt:35 (find_package)
Boost_DIR = Boost_DIR-NOTFOUND
Boost_FILESYSTEM_LIBRARY_DEBUG = Directory is correct
...
Boost_SYSTEM_LIBRARY_RELEASE = Directory is correct
Just to be on the safe side, I added "BOOST_ROOT" and the directory to both "User variables" and S"ystem variables".
Now, I've already used the bootstrap.bat, followed by the b2.exe. CMake shows the directory for everything else except the BOOST_DIR. When I click on configure, it still shows these errors.
From https://www.azerothcore.org/wiki/windows-core-installation
If you get an error that CMake *Could NOT find Boost (missing: system filesystem program_options iostreams regex) (found suitable version "1.74.0", minimum required is "1.70")
Locate your Boost folder
Run the Bootstrap.bat file
Run the b2.exe file
You can try a diffrent version of boost like latest one 1.81
https://netix.dl.sourceforge.net/project/boost/boost-binaries/1.81.0/boost_1_81_0-msvc-14.3-64.exe
i'm useing this version
don't forget you must edit system variables for this version directory
and don't forget you must use slash / for directory not back slash \ like this:
orginal location: C:\local\boost_1_81_0
on system variables: C:/local/boost_1_81_0
enter image description here

How to find Google Test with find_package using CMake on Windows?

I have tried without success to use the find_package function in CMake to make use of a pre-built "system wide" version of GTest in Windows. Here is a minimal, reproducible example of my CMakeLists.txt:
cmake_minimum_required(VERSION 3.2)
find_package(GTest REQUIRED)
if(NOT GTEST_LIBRARY)
message("GTest not found!")
endif()
I try to generate build files using the following command:
cmake .. -G"Visual Studio 14 2015" -DGTEST_ROOT="c:\Libs\googletest"
The c:\Libs\googletest path contains my pre-built GTest (with header files and binaries). I have studied the FindGTest.cmake file in my CMake installation (I use CMake version 3.13.3) and tried all kinds of folder structure, but I always get the following error message:
CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR
GTEST_MAIN_LIBRARY)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.13/Modules/FindGTest.cmake:196 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:2 (find_package)
Has anyone succeeded in using find_package for GTest in Windows? If so, how did you do it?
First you must build AND install Googletest using CMake build system
Then try to locate the GTestConfig.cmake file in the installation directory
So now you can add this path to the CMAKE_PREFIX_PATH variable.
Thus configuring your project using CMake, it should be able to find_package(GTest) using the usual search procedure.
So you just have to use GTest::GTest to consume it (i.e. target_link_libraries(.... GTest::GTest) ).
note: For people using FetchContent/add_subdirectory(googletest) beware google/googletest still not provide ALIAS target see https://github.com/google/googletest/issues/2429

CMake "Could NOT find OpenSSL" with MSYS2/mingw64 on 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.

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 unable to find my Windows installation of wxWidgets

I've tried to link wxWidgets 3.0.2 to my C++ project but CMake can't seem to find it.
The wxWidgets that I'm trying to get CMake to find is from wxMSW-Setup-3.0.2.exe
This is the error it gives me:
-- Building for: Visual Studio 12 2013
CMake Error at D:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find wxWidgets (missing: wxWidgets_FOUND)
Call Stack (most recent call first):
D:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
D:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindwxWidgets.cmake:871 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:66 (find_package)
-- Configuring incomplete, errors occurred!
CMakeLists.txt:66 refers to this line:
find_package(wxWidgets REQUIRED core base)
I've tried changing the CMake generator, and running set(wxWidgets_ROOT_DIR "C:/wxWidgets-3.0.2"), both of which didn't fix the problem.
CMake is version 3.3.1.
I think cmake used environement variable to find wxwidgets. You have to set wxDir or wxWin variable to C:/wxWidgets-3.0.2
Use find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net) instead of find_package(wxWidgets REQUIRED COMPONENTS core base). And when you build the wxWidgets https://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW, use build the static libraries instead of dynamic libraries, I fixed it by using these two steps.

Resources