CMake for MinGW Makefiles won't create the build - cmake

I am trying to create a build of MinGW Makefiles using cmake but I get the following error when I execute the command cmake -G "MinGW Makefiles" ..\source\
I have attached a picture of my path varibles below.Path Variables. I get the following error on running the cmake -G commmand
PS C:\Users\gaura.YASH\OneDrive\Desktop\new_code\cmake_1st_proj\C-Make\1st project\build> cmake ..\source\ -G "MinGW Makefiles"
-- The CXX compiler identification is MSVC 19.33.31630.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeTestCXXCompiler.cmake:63 (message):
The C++ compiler
"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/gaura.YASH/OneDrive/Desktop/new_code/cmake_1st_proj/C-Make/1st project/build/CMakeFiles/CMakeScratch/TryCompile-mhmynt
Run Build Command(s):C:/MinGW/bin/mingw32-make.exe -f Makefile cmTC_29120/fast && C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_29120.dir\build.make CMakeFiles/cmTC_29120.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/gaura.YASH/OneDrive/Desktop/new_code/cmake_1st_proj/C-Make/1st project/build/CMakeFiles/CMakeScratch/TryCompile-mhmynt'
Building CXX object CMakeFiles/cmTC_29120.dir/testCXXCompiler.cxx.obj
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_cl_compile_depends --dep-file=CMakeFiles\cmTC_29120.dir\testCXXCompiler.cxx.obj.d --working-dir="C:\Users\gaura.YASH\OneDrive\Desktop\new_code\cmake_1st_proj\C-Make\1st project\build\CMakeFiles\CMakeScratch\TryCompile-mhmynt" --filter-prefix="Note: including file: " -- C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cmTC_29120.dir\testCXXCompiler.cxx.obj /FdCMakeFiles\cmTC_29120.dir/ /FS -c "C:\Users\gaura.YASH\OneDrive\Desktop\new_code\cmake_1st_proj\C-Make\1st project\build\CMakeFiles\CMakeScratch\TryCompile-mhmynt\testCXXCompiler.cxx"
testCXXCompiler.cxx
Linking CXX executable cmTC_29120.exe
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_29120.dir\link.txt --verbose=1
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_29120.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\link.exe /nologo #CMakeFiles\cmTC_29120.dir\objects1 /out:cmTC_29120.exe /implib:cmTC_29120.lib /pdb:"C:\Users\gaura.YASH\OneDrive\Desktop\new_code\cmake_1st_proj\C-Make\1st project\build\CMakeFiles\CMakeScratch\TryCompile-mhmynt\cmTC_29120.pdb" /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib
RC Pass 1: command "rc /fo CMakeFiles\cmTC_29120.dir/manifest.res CMakeFiles\cmTC_29120.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specifiedCMakeFiles\cmTC_29120.dir\build.make:99: recipe for target 'cmTC_29120.exe' failed
mingw32-make.exe[1]: *** [cmTC_29120.exe] Error -1
mingw32-make.exe[1]: Leaving directory 'C:/Users/gaura.YASH/OneDrive/Desktop/new_code/cmake_1st_proj/C-Make/1st project/build/CMakeFiles/CMakeScratch/TryCompile-mhmynt'
Makefile:126: recipe for target 'cmTC_29120/fast' failed
mingw32-make.exe: *** [cmTC_29120/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/gaura.YASH/OneDrive/Desktop/new_code/cmake_1st_proj/C-Make/1st project/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/gaura.YASH/OneDrive/Desktop/new_code/cmake_1st_proj/C-Make/1st project/build/CMakeFiles/CMakeError.log".
PS C:\Users\gaura.YASH\OneDrive\Desktop\new_code\cmake_1st_proj\C-Make\1st project\build>
I am trying to avoid adding the compiler to be used in the cmakelist.txt file as I saw that it is a bad practice. I searched and found alternative approaches using -D flag and saving the preferred settings in cache but I am curious to know why this one works in the tutorial but not on my system.

I tinkered for a bit and realized it is necessary to give the g++ compiler as a flag to the cmake command. The default compiler here is MSVC but mingw-makefile use the g++.exe. Thus, the command cmake -G MinGW Makefiles" -D CMAKE_CXX_COMPILER=g++ ..\source\ will create a build for your project given the build repository doesn't have any existing cache, if it does, then you would need to clear it.
One thing to keep in mind is that compiler = g++ is the name of the application of the compiler in path. So you must add it to path and write the exact name without ext. here.
Additionally, I tried to run the ninja build system, which also showed the same error as the original question. Similar changes in the command fixed it as well, so cmake -G "Ninja" -D CMAKE_CXX_COMPILER=g++ ..\source\ will build your project, given you have no cache in build. Delete if you do.
I could not find out how to run ninja using msvc though, replacing g++ with the cl exe did not work.
Edit: How to use Clang-CL LLVM with VS2019 CMAKE? for the clang-msvc one.

Related

CMake project using ifort failed. "is not able to compile a simple test program."

I can compile the project using gfortran in both Linux and Windows with no error. But for some reason I have to use ifort.exe as compiler in Windows and it failed. Anyone can help?
The detailed information is as follows:
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - failed
-- Check for working Fortran compiler: D:/Program Files/IVF/compilers_and_libraries_2018.3.210/windows/bin/intel64/ifort.exe
-- Check for working Fortran compiler: D:/Program Files/IVF/compilers_and_libraries_2018.3.210/windows/bin/intel64/ifort.exe- broken CMake Error at D:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestFortranCompiler.cmake:51 (message): The Fortran compiler
"D:/Program Files/IVF/compilers_and_libraries_2018.3.210/windows/bin/intel64/ifort.exe"
is not able to compile a simple test program. It fails with the following output:
Change Dir: C:/Users/xxx/build/CMakeFiles/CMakeTmp
Run Build Command(s):D:/PROGRA~2/MINGW-~1/X86_64~1.0-P/mingw64/bin/mingw32-make.exe cmTC_809ef/fast && mingw32-make.exe[1]: Entering directory 'C:/Users/xxx/build/CMakeFiles/CMakeTmp'
D:/PROGRA~2/MINGW-~1/X86_64~1.0-P/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_809ef.dir\build.make CMakeFiles/cmTC_809ef.dir/build
mingw32-make.exe[2]: Entering directory 'C:/Users/xxx/build/CMakeFiles/CMakeTmp'
Building Fortran object CMakeFiles/cmTC_809ef.dir/testFortranCompiler.f.obj
D:\PROGRA~2\IVF\COMPIL~1.210\windows\bin\intel64\ifort.exe /nologo /fpp /W1 /nologo /fpp /libs:dll /threads /Od /debug:full /dbglibs /FoCMakeFiles\cmTC_809ef.dir\testFortranCompiler.f.obj /FdCMakeFiles\cmTC_809ef.dir/ -c C:\Users xxx\build\CMakeFiles\CMakeTmp\testFortranCompiler.f
warning #31001: The dll for reading and writing the pdb (for example, mspdb110.dll) could not be found on your path. This is usually a configuration error. Compilation will continue using /Z7 instead of /Zi, but expect a similar err r when you link your program.
Linking Fortran executable cmTC_809ef.exe
"D:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_809ef.dir\link.txt --verbose=1
"D:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_809ef.dir --rc=rc --mt="" --manifests -- xilink /nologo #CMakeFiles\cmTC_809ef.dir\objects1.rsp /out:cmTC_809ef.exe /implib:cmTC_809ef.lib /pdb:C:\Users\xxx\build\CMakeFiles\CMakeTmp\cmTC_809ef.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL:YES /subsystem:console user32.lib
RC Pass 1: command "rc /fo CMakeFiles\cmTC_809ef.dir/manifest.res CMakeFiles\cmTC_809ef.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specified.mingw32-make.exe[2]: *** [CMakeFiles\cmTC_809ef.dir\build.make:107: cmTC_809ef.exe] Error -1 mingw32-
make.exe[2]: Leaving directory 'C:/Users/xxx/build/CMakeFiles/CMakeTmp'
mingw32-make.exe[1]: *** [Makefile:140: cmTC_809ef/fast] Error 2
mingw32-make.exe[1]: Leaving directory 'C:/Users/xxx/build/CMakeFiles/CMakeTmp'
The error is because that the rc.exe cannot be found. I solved the problem by adding the file path to the PATH variable.

CMake building for Windows (clang-cl) using Ninja Generator

I am trying to build a simple application on a Windows machine using CMake as the main build tool. Once CMake is invoked on the project the is an error on configuration phase:
> cmake -H. -G Ninja -Bbuild -DCMAKE_C_COMPILER:PATH="C:\Program Files\LLVM\bin\clang-cl.exe" -DCMAKE_CXX_COMPILER:PATH="C:\Program Files\LLVM\bin\clang-cl.exe"
-- The C compiler identification is Clang 7.0.0
-- The CXX compiler identification is Clang 7.0.0
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang-cl.exe
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang-cl.exe --broken
CMake Error at C:/Program Files/CMake/share/cmake-3.12/Modules/CMakeTestCCompile
r.cmake:52 (message):
The C compiler
"C:/Program Files/LLVM/bin/clang-cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/mak/Desktop/cmake-test/build/CMakeFiles/CMakeTmp
Run Build Command:"C:/Qt/Tools/QtCreator/bin/ninja.exe" "cmTC_f5485"
[1/2] Building C object CMakeFiles\cmTC_f5485.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTC_f5485.exe
FAILED: cmTC_f5485.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_f5485.dir --manifests -- CMAKE_LINKER-NOTFOUND /nologo CMakeFiles\cmTC_f5485.dir\testCCompiler.c.obj /out:cmTC_f5485.exe /implib:cmTC_f5485.lib /pdb:cmTC_f5485.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
RC Pass 1: command "rc /foCMakeFiles\cmTC_f5485.dir/manifest.res CMakeFiles\cmTC_f5485.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the given file
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
I read a lot through the web but my problem was not solved by any proposed solution. What I found so far is a simmilar but maybe outdated solution to the same problem which did not work for me, because Ninja was not able to build the executable:
> ninja all
[1/2] Building CXX object CMakeFiles/minimal.dir/main.cpp.obj
FAILED: CMakeFiles/minimal.dir/main.cpp.obj
C:\PROGRA~1\LLVM\bin\clang-cl.exe -MD -MT CMakeFiles/minimal.dir/main.cpp.obj -MF CMakeFiles\minimal.dir\main.cpp.obj.d -o CMakeFiles/minimal.dir/main.cpp.obj -c ../main.cpp
clang-cl.exe: warning: unknown argument ignored in clang-cl: '-MF' [-Wunknown-argument]
clang-cl.exe: error: no such file or directory: 'CMakeFiles/minimal.dir/main.cpp.obj'
clang-cl.exe: error: no such file or directory: 'CMakeFiles\minimal.dir\main.cpp.obj.d'
ninja: build stopped: subcommand failed.
Before this error CMake configured properly except that all compilers ABI info detection failed - but CMake resumed without error. There are some other questions out there which did not help either.
The official documentation states it is quite simple but in fact it is not.
So: How do I build a simple C++ project using CMake with the Ninja generator and Clang as the compiler? I try to avoid the installation of Visual Studio but it would be great if generated binaries are compatible with MSVC build binaries.
Versions:
CMake 3.12.2
Ninja 1.8.2
Clang 7.0.0
Example: Here is the minial example which I am working with:
CMakeLists.txt
cmake_minimum_required(VERSION 3.12)
project(minimal)
add_executable(${PROJECT_NAME} main.cpp)
main.cpp
#include <stdio.h>
int main(void)
{
printf("Hello World!\n");
return 0;
}
To compile with clang-cl, it is necessary to run cmake with MSVC environment loaded (use vcvarsall.bat). Otherwise it tries to use GCC compatibility options.
It is enough to install just the Build Tools.

Building ParaView-Superbuild in windows 10

I'm trying to build the ParaView-Superbuild (https://gitlab.kitware.com/paraview/paraview-superbuild) on Windows 10 64x.
I cannot manage to get it to work. I just ran from error to error. Currently I'm stuck at:
CMake Error at superbuild/projects/win32/boost.cmake:5 (message):
At least Visual Studio 9.0 is required
Call Stack (most recent call first):
superbuild/cmake/SuperbuildMacros.cmake:690 (include)
superbuild/CMakeLists.txt:145 (_superbuild_discover_projects)
using Cmake 3.13.10-rc1 as generator for Ninja. I have Cygwin64 installed and I'm using the GCC compiler
The C compiler identification is GNU 7.3.0
The CXX compiler identification is GNU 7.3.0
Since I thought that the error has something to do with the compiler I tried to switch to the installed VS2017 compiler. However, the build process will then crash with
CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules
/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools
/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/paraview-superbuild/build/CMakeFiles/CMakeTmp
Run Build Command:"C:/Ninja/ninja.exe" "cmTC_915a7"
[1/2] Building C object CMakeFiles\cmTC_915a7.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTC_915a7.exe
FAILED: cmTC_915a7.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe
--intdir=CMakeFiles\cmTC_915a7.dir --manifests -- C:\PROGRA~2\MICROS~1
\2017\ENTERP~1\VC\Tools\MSVC\1415~1.267\bin\Hostx64\x64\link.exe /nologo
CMakeFiles\cmTC_915a7.dir\testCCompiler.c.obj /out:cmTC_915a7.exe
/implib:cmTC_915a7.lib /pdb:cmTC_915a7.pdb /version:0.0 /machine:x64
/debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib
winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib
advapi32.lib && cd ."
RC Pass 1: command "rc /foCMakeFiles\cmTC_915a7.dir/manifest.res
CMakeFiles\cmTC_915a7.dir/manifest.rc" failed (exit code 0) with the
following output:
The system cannot find the file specified
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (
I don't know how to fix the error using the GCC compiler when the VS one is not working at all. Sadly, I couldn't find any help on the Paraview website.
Has somebody managed to build it and can show me step by step how to do it?
And no, I don't want to use Linux here.
Thanks.
Here is a reliable way to build ParaView Superbuild on windows
Install Visual Studio 2013 community with all C++ related tools
Install cmake
Install git bash
Install Ninja
Install Qt 5.9.2 VS2013
Install other potential dependencies
open git bash
then :
cd C:/
mkdir pv
cd pv
git clone git#gitlab.kitware.com:paraview/paraview-superbuild.git
mv paraview-superbuild pvsb
mkdir pvsb_b
cd pvsb
git submodule update --init --recursive
Open Visual Studio Native Command X64
then :
cd C:\pv\pvsb_b
cmake-gui
configure paraview-superbuild accordingly to your need
ENABLE_qt5 and USE_SYSTEM_qt should be ON
generate
close cmake-gui
ninja

Unable to use specific compiler in cmake created CodeBlocks project

I have various projects that I need to compile them with different compilers.
So, what I need is an IDE that lets easily allow me to choose/change a target and compile projects for that target.
Another need is to use cmake.
I am now trying CodeBlocks in windows. First I try to add a compiler:
I have set:
Settings->Toolchain executables->Compiler's installation directory->Program Files
Then I create CodeBlocks project with cmake -G "CodeBlocks - MinGW Makefiles"
I open the project in CodeBlocks that is generated by cmake.
I chose compiler in Project Settings.
I build.
Then I discover that compiler in Project Settings is totally ignored! Because it is used the one in CMakeCache.
Thus, I write a script that first set CC and CXX, then run cmake.
With this way I see that CMakeCache has the compiler that I want.
Then I build the project in CodeBlocks.
Now, for g++.exe, the correct compiler is used. However, CodeBlocks insists and insists again to use default MinGW compiler (which is in path) for mingw32-make.exe
Here is the last build output, where D:/Qt/Qt5.4.1/Tools/mingw491_32/bin is default and C:\mingw_x86_64\release7.1.0-posix-dwarf-rt_v5-rev2.7\bin is the correct one.
-------------- Build: 32bit in deneme21 (compiler: MinGW GCC Compiler 32bit)---------------
Checking if target is up-to-date: mingw32-make.exe -q -f Makefile 32bit
Running command: D:/Qt/Qt5.4.1/Tools/mingw491_32/bin/mingw32-make.exe -f "D:/Qt_ws/deneme/deneme31/Makefile" VERBOSE=1 install/strip
C:\CMake3.10.2\win32\bin\cmake.exe -HD:\Qt_ws\deneme\deneme31 -BD:\Qt_ws\deneme\deneme31 --check-build-system CMakeFiles\Makefile.cmake 0
C:\CMake3.10.2\win32\bin\cmake.exe -E cmake_progress_start D:\Qt_ws\deneme\deneme31\CMakeFiles D:\Qt_ws\deneme\deneme31\CMakeFiles\progress.marks
D:/Qt/Qt5.4.1/Tools/mingw491_32/bin/mingw32-make.exe -f CMakeFiles\Makefile2 all
mingw32-make.exe[1]: Entering directory 'D:/Qt_ws/deneme/deneme31'
D:/Qt/Qt5.4.1/Tools/mingw491_32/bin/mingw32-make.exe -f CMakeFiles\deneme21.dir\build.make CMakeFiles/deneme21.dir/depend
mingw32-make.exe[2]: Entering directory 'D:/Qt_ws/deneme/deneme31'
C:\CMake3.10.2\win32\bin\cmake.exe -E cmake_depends "MinGW Makefiles" D:\Qt_ws\deneme\deneme31 D:\Qt_ws\deneme\deneme31 D:\Qt_ws\deneme\deneme31 D:\Qt_ws\deneme\deneme31 D:\Qt_ws\deneme\deneme31\CMakeFiles\deneme21.dir\DependInfo.cmake --color=
mingw32-make.exe[2]: Leaving directory 'D:/Qt_ws/deneme/deneme31'
D:/Qt/Qt5.4.1/Tools/mingw491_32/bin/mingw32-make.exe -f CMakeFiles\deneme21.dir\build.make CMakeFiles/deneme21.dir/build
mingw32-make.exe[2]: Entering directory 'D:/Qt_ws/deneme/deneme31'
[ 50%] Building CXX object CMakeFiles/deneme21.dir/src/foo.cpp.obj
C:\mingw_x86_64\release7.1.0-posix-dwarf-rt_v5-rev2.7\bin\g++.exe #CMakeFiles/deneme21.dir/includes_CXX.rsp -m32 -o CMakeFiles\deneme21.dir\src\foo.cpp.obj -c D:\Qt_ws\deneme\deneme31\src\foo.cpp
[100%] Linking CXX static library libdeneme21.a
C:\CMake3.10.2\win32\bin\cmake.exe -P CMakeFiles\deneme21.dir\cmake_clean_target.cmake
C:\CMake3.10.2\win32\bin\cmake.exe -E cmake_link_script CMakeFiles\deneme21.dir\link.txt --verbose=1
C:\mingw_x86_64\release7.1.0-posix-dwarf-rt_v5-rev2.7\bin\ar.exe qc libdeneme21.a CMakeFiles/deneme21.dir/src/foo.cpp.obj
C:\mingw_x86_64\release7.1.0-posix-dwarf-rt_v5-rev2.7\bin\ranlib.exe libdeneme21.a
mingw32-make.exe[2]: Leaving directory 'D:/Qt_ws/deneme/deneme31'
[100%] Built target deneme21
mingw32-make.exe[1]: Leaving directory 'D:/Qt_ws/deneme/deneme31'
C:\CMake3.10.2\win32\bin\cmake.exe -E cmake_progress_start D:\Qt_ws\deneme\deneme31\CMakeFiles 0
D:/Qt/Qt5.4.1/Tools/mingw491_32/bin/mingw32-make.exe -f CMakeFiles\Makefile2 preinstall
How can I make CodeBlocks use the compiler that I want in cmake created project?

Trying to use JetBrains CLion, but Cmake - c++ compiler broken after cygwin install

I have been trying to get JetBrains CLion IDE working, but I am running into a problem with Cmake and none of my research online has been helpful. I installed cygwin with the necessary packages (as stated here - gcc/g++, cmake, make, gdb). When I open up CLion and go into Settings (I'm running Windows 10) under Build>Toolchains>Debugger everything has a check next to it, so it seems like CLion has found everything alright, but when I look in the Debugger window I get the following error:
"C:\Users\Lucas Lofaro\.CLion2016.3\system\cygwin_cmake\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" "/cygdrive/c/Users/Lucas Lofaro/ClionProjects/cracking_the_coding_interview"
-- The CXX compiler identification is GNU 5.3.0
-- Check for working CXX compiler: /usr/bin/c++.exe
-- Check for working CXX compiler: /usr/bin/c++.exe -- broken
CMake Error at /cygdrive/c/Users/Lucas Lofaro/.CLion2016.3/system/cygwin_cmake/share/cmake-3.6.2/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/usr/bin/c++.exe" is not able to compile a simple test
program.
It fails with the following output:
Change Dir: /cygdrive/c/Users/Lucas Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make.exe" "cmTC_96921/fast"
/usr/bin/make -f CMakeFiles/cmTC_96921.dir/build.make
CMakeFiles/cmTC_96921.dir/build
make[1]: Entering directory '/cygdrive/c/Users/Lucas
Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_96921.dir/testCXXCompiler.cxx.o
/usr/bin/c++.exe -o CMakeFiles/cmTC_96921.dir/testCXXCompiler.cxx.o -c
"/cygdrive/c/Users/Lucas
Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeTmp/testCXXCompiler.cxx"
Linking CXX executable cmTC_96921.exe
"/cygdrive/c/Users/Lucas
Lofaro/.CLion2016.3/system/cygwin_cmake/bin/cmake.exe" -E cmake_link_script
CMakeFiles/cmTC_96921.dir/link.txt --verbose=1
/usr/bin/c++.exe -Wl,--enable-auto-import
CMakeFiles/cmTC_96921.dir/testCXXCompiler.cxx.o -o cmTC_96921.exe
-Wl,--out-implib,libcmTC_96921.dll.a
-Wl,--major-image-version,0,--minor-image-version,0
c++: fatal error: -fuse-linker-plugin, but cyglto_plugin.dll not found
compilation terminated.
CMakeFiles/cmTC_96921.dir/build.make:97: recipe for target 'cmTC_96921.exe'
failed
make[1]: *** [cmTC_96921.exe] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/Lucas
Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_96921/fast' failed
make: *** [cmTC_96921/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "/cygdrive/c/Users/Lucas Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/c/Users/Lucas Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeError.log".
I've also added the cygwin bin directory to my Path environment variable, but I am really at a loss as to what to do next. Something isn't linking up and I don't want to start digging around in Cmake files without a better understanding of what's going on. Any guidance would be much appreciated. Please let me know if I can provide any additional information.
It turns out that the cmake, make, and g++ packages were installed but not updated to their most recent versions. Rerunning cygwin installer solved my problem and everything now compiles fine.