I am trying to install on my windows desktop, a software suite called NUPACK which is used to design nucleic acid reaction pathways. http://www.nupack.org/
This software requires CMake to install, and from my understanding, CMake does not have compilers by itself, and requires us to have compilers separately installed. As such, I downloaded MinGW to use as a C++ compiler. Prior to running, I have set the environment variables of both CMake and MinGW's bin. I am running CMake (version 3.11.1) through the command prompt but I keep encountering the following problem:
C:\Users\Nicholas\Documents\nupack\build>Cmake -DCMAKE_INSTALL_PREFIX=NUPACKINSTALL -G "MinGW Makefiles" ..
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-
3.11/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/MinGW/bin/gcc.exe"
is not able to compile a simple test program.
I'm guessing CMake cannot identify my MinGW gcc and gcc++ compilers somehow. I tried the following next, but the same error arose.
set CMAKE_C_COMPILER=%C:\mingw\bin\gcc%
set CMAKE_CXX_COMPILER=%C:\mingw\bin\g++%
Has anyone encountered the same problem? Can this be resolved by using MinGW64? I am using Windows 10 and previously, I tried using visual studio 2017's compilers, but it had its on set of problems too.
Yes, the problem is that CMake cannot find GCC compiler. Before be sure that g++ and gcc are installed. It can be MinGW64 or Cygwin.
There are at least three ways to link GCC compiler.
1st way:
Set compilers in CMakeLists.txt:
set(CMAKE_C_COMPILER C:\path\to\gcc.exe)
set(CMAKE_CXX_COMPILER C:\path\to\g++.exe)
2nd way:
When calling cmake in terminal or cmd:
cmake -DCMAKE_C_COMPILER="C:\path\to\gcc.exe" -DCMAKE_CXX_COMPILER="C:\path\to\g++.exe"
3rd way:
Set as environment variable:
Go to Windows "Environment Variables" and add to PATH this:
;C:\path_to_MinGW_or_Cygwin\bin
I had similar problem.
My Setup was : VSCode (Windows 10) + GCC 9.2xx + CMake 3.18.2
Environment variables were already set to point to GCC and CMake.
This Worked: https://stackoverflow.com/a/4101496/2865353
Needs to cleanup CMakeCache.txt and CMakeFiles directory.
Erros it fixed are:
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
CMake Error at CMakeLists.txt:3 (project):
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
Related
Is this possible? I've been trying for days.
I tried to use homebrew's clang compiler, running this:
cmake -DCMAKE_BUILD_TYPE=Release -S . -B cmake-build-release -Wno-dev -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX
cmake --build ./cmake-build-release --config Release
eventually leads to lipo being called, where it complains:
warning: Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: Invalid value (Producer: 'LLVM15.0.6' Reader: 'LLVM APPLE_1_1300.0.29.3_0')
fatal error: Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't figure out the architecture type of: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/PluginProcessor-eb9c16/PluginProcessor-arm64.o
I believe lipo is being called because I added this to my cmake project:
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
(This is for a universal build)
I was trying to setup a symlink to point lipo to llvm-lipo but had no luck (and I wasn't sure if this would even fix this error anyway).
If I try to use -G Xcode (the XCode project generator) I get the error:
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: .../Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
CMake Error in cmake-build-xcode/CMakeFiles/CMakeTmp/CMakeLists.txt:
Target "cmTC_e6c65" requires the language dialect "CXXc++2a" (with compiler
extensions). But the current compiler "AppleClang" does not support this,
or CMake does not know the flags to enable it.
I think the best solution would be to somehow get Xcode to use the homebrew Clang compiler - rather than Apple Clang; is this possible?
I was also thinking to overwrite the clang executables included with XCode with symlinks to the HomeBrew clang. This might fix but again seems hackey - when I was trying to setup symlinks to lipo I had to setup weird security stuff / boot mac OS into recovery mode - which is where I gave up
I am just getting started with C++ and CLion IDE. I got this error after watching a YouTube video that showed how to get started on CLion. All I did was try to add GCC to CLion as the compiler for C++. Nothing else at all.
I have GCC version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
I've only been programming for about 3 months on HTML CSS & JS so this error is way over my head. Any help would be greatly appreciated!
Below is my error and a link to a screenshot
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
The CMAKE_CXX_COMPILER:
GCC
is not a full path and was not found in the PATH.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "/home/dominic/CLionProjects/untitled1/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/home/dominic/CLionProjects/untitled1/cmake-build-debug/CMakeFiles/CMakeError.log".
[Failed to reload]
Cmake List
Use full path to compiler or add the gcc path to PATH if you want to used just gcc.
I guess that if you specify C compiler as /usr/bin/gcc (or /usr/local/bin/gcc if you installed it there) and C++ compiler as /usr/bin/g++ in Preferences | Build, Execution, Deployment | Toolchains everything should work.
Mind that Linux is case-sensitive OS and GCC executable is gcc.
This question already has answers here:
Running CMake on Windows
(4 answers)
Closed 3 years ago.
I am on Windwos trying to get Mingw-w64 to work with CMake since my MSVC is somehow not working at all (using Windows10 64bit.
Basically I add the arguments -DCMAKE_CXX_COMPILER="C:/MinGW-w64/mingw64/bin/g++.exe" -DCMAKE_C_COMPILER="C:/MinGW-w64/mingw64/bin/gcc.exe" to my call to CMake which sets the corresponding compiler.
However I get these errors:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: C:/MinGW-w64/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/MinGW-w64/mingw64/bin/gcc.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/MinGW-w64/mingw64/bin/gcc.exe"
is not able to compile a simple test program.
How could I get this to work?
The simplest way to generate makefiles for MinGW (and MinGW-w64) is to use the appropriate CMake generator. Just call cmake with
-G "MinGW Makefiles"
no need to set DCMAKE_CXX_COMPILER and DCMAKE_C_COMPILER by hand.
For this to work, CMake must find your compilers. So this path must be added to the windows PATH variable, as CristiFati pointed out:
C:/MinGW-w64/mingw64/bin
To check if the PATH is correct, fire up a Windows command prompt and run
where gcc
The output should be (at least) the path you just added to the Windows PATH variable.
I have been trying to integrate the AWS SDK for C++ into my Netbeans Project. I try to use the cmake command but it fails with the following errors.
Here is the text from running the command in the command prompt
C:\Users\jense\Desktop\code libraries\aws-sdk-cpp-master\aws-sdk-cpp-master>"C:\Users\jense\Desktop\code libraries\cmake-3.8.2-win64-x64\cmake-3.8.2-win64-x64\bin\cmake" .
-- Could NOT find Git (missing: GIT_EXECUTABLE)
-- TARGET_ARCH not specified; inferring host OS to be platform compilation target
-- Building AWS libraries as shared objects
-- Generating windows build config
-- Building project version: 1.1.10
-- The CXX compiler identification is GNU 5.3.0
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_ade23\fast"
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- broken
CMake Error at C:/Users/jense/Desktop/code libraries/cmake-3.8.2-win64-x64/cmake-3.8.2-win64-x64/share/cmake-3.8/Modules/CMakeTestCXXCompiler.cmake:44 (message):
The C++ compiler "C:/MinGW/bin/g++.exe" is not able to compile a simple
test program.
It fails with the following output:
Change Dir: C:/Users/jense/Desktop/code libraries/aws-sdk-cpp-master/aws-sdk-cpp-master/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_ade23\fast"
Generator: execution of make failed. Make command was: "nmake" "/NOLOGO"
"cmTC_ade23\fast"
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:105 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/jense/Desktop/code libraries/aws-sdk-cpp-master/aws-sdk-cpp-master/CMakeFiles/CMakeOutput.log".
See also "C:/Users/jense/Desktop/code libraries/aws-sdk-cpp-master/aws-sdk-cpp-master/CMakeFiles/CMakeError.log".
Here is inside my CMakeError.txt
Determining if the CXX compiler works failed with the following output:
Change Dir: C:/Users/jense/Desktop/code libraries/aws-sdk-cpp-master/aws-sdk-cpp-master/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_a5997\fast"
Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_a5997\fast"
Inside my CMakeOutput.txt
The CXX compiler identification is GNU, found in "C:/Users/jense/Desktop/code libraries/aws-sdk-cpp-master/aws-sdk-cpp-master/CMakeFiles/3.8.2/CompilerIdCXX/a.exe"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags:
The output was:
0
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.exe"
It says that g++ cannot compile a simple test program, however it seems to work fine on my other c++ programs. Also, it instructs me to run nmake /NOLOGO cmTC_a5997\fast. I cannot find nmake installed on my computer, is this the problem? Or is that just another error happening from a chain of errors?
How do I fix this?
I am using Netbeans 8.2 not Visual Studio.
All the answers I have seen on SO don't seem to relate to my issue, they are visual studio related answers and or something fixing a problem that I don't have.
Thanks!
NMake is the traditional make program in the Microsoft toolchain. Since you use MinGW you need mingw32-make, but CMake defaults to the MS toolchain generator on Windows. Call CMake with -G "MinGW Makefiles" to switch to the MinGW generator.
-G "Unix Makefiles", like Miles Budnek suggested in the question’s comments, is the default generator for Unix-like targets. For example, it’s the default on Linux. However, it is not the same as MinGW and won’t work in your situation.
P.S. 1: Especially on Windows make has its problems with using all your CPU cores. You might want to have a look at Ninja. It’s usually a drop-in replacement for make, can be activated with CMake’s -G Ninja and handles parallel builds a lot better.
P.S. 2 (unrelated to the question): Avoid spaces anywhere in your directory paths. Those are a prime source for trouble because you’ll have to quote such paths properly everywhere. That’s (a) suprisingly difficult to get right, (b) something you can easily forget entirely and (c) something all your 3rd-party dependencies’ build systems need to be capable of as well. Not using spaces is the simplest way to avoid all those potential pitfalls.
I have a problem with cmake after I installed a new SDK 10 version (now it should be 10.0.10586.0). But when I run cmake cmakelists.txt, I got this error message:
-- Building for: Visual Studio 14 2015
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_C_COMPILER could be found.
I googled a while but could not find the right answer. My problem is that I can use VS2015 to build my application (old projects) using the new SDK. Everything seems to be fine. But cmake will try to build one small generated project (CompilerIdCXX.vcxproj). But in this project, SDK 8 is used (which is not available in my system anymore).
Could you help me, many thanks in advance
Problem solved (sorta of), I have to reinstall an older version of SDK10 aside from the version 10.0.10586.0. It is weird that uninstalling the older version had somehow damaged the environment.