C,CXX compiler identification is unknown - windows

I'm trying to use ROS on windows. While trying to the run the turtlebot3 tutorial (https://ms-iot.github.io/ROSOnWindows/Turtlebot/Turtlebot3.html)
I ran into an error.
I've tried installing Microsoft visual studio 2019 but that doesn't seem to help.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error in CMakeLists.txt:
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
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 "D:/Edge/ROS/ws/turtlebot3/build/CMakeFiles/CMakeOutput.log".
See also "D:/Edge/ROS/ws/turtlebot3/build/CMakeFiles/CMakeError.log".

Related

MSYS2 (64 bit): The C compiler identification is unknown

I'm new to building in Windows. I'm building the following project: https://github.com/arkottke/strata.
The page suggests installing dependencies using MSYS2. I've installed MSYS2 and installed everything as instructed exactly, but I get the following when trying to build using cmake:
$ cmake .. -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:31 (project):
No CMAKE_C_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error at CMakeLists.txt:31 (project):
No CMAKE_CXX_COMPILER could be found.
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/isb17182/strata/build/CMakeFiles/CMakeOutput.log".
See also "/home/isb17182/strata/build/CMakeFiles/CMakeError.log".
I've seen answers for the same problem on other building platforms, but these are too complicated for me to understand currently. If someone could provide a simple explanation of how to resolve this it would be much appreciated.
Thanks
This is what worked for me
Thanks to everyone who contributed.
Run
pacman -S base-devel gcc
Which will update GCC to latest and verify by
gcc --version
Be sure you're using the cmake of msys2 (as the project build instructions suggest you should install), not a regular Windows cmake installed elsewhere on the system.
which cmake
After this ere execute your command...build done ;)

Can't compile restbed on Windows 7

I'm a the end with 16 hours of configure, installing, deleting, modifying and hit my keyboard many times....
I want to use restbed for plattform independent C++ programming, but I can't get build this stuff. I have Cygwin (download at 2017/04/24) installed (think for git or whatever creepy things), Code::Blocks with MinGW (16.01) and at least a seperate MinGW (also downloaded 2017/04/24) installation. Also I've Visual Studio 2012 Pro, 2015 and 2017 (long story) on a Windows 7 x64 Pro.
This is what I try and the results:
cloning recursivly with git in empty directory and following the instructions.
cmake -DBUILD_TESTS=YES -DBUILD_EXAMPLES=YES -DBUILD_SSL=NO -DBUILD_SHARED=YES ..
Uhh.. success. I seems it using the gcc/g++ from Cygwin.
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
:
:
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/d/Entwicklung/C++/restbed/restbed/build
Nice! Now follows:
make -j install
After 7% working, it gives a bunch of warnings and failed:
/cygdrive/{my_path_to}/restbed/restbed/dependency/asio/asio/include/asio/detail/config.hpp:755:5: warning: #warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. [-Wcpp]
# warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
^
/cygdrive/{my_path_to}/restbed/restbed/dependency/asio/asio/include/asio/detail/config.hpp:756:5: warning: #warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line. [-Wcpp]
# warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line.
^
/cygdrive/{my_path_to}/restbed/restbed/dependency/asio/asio/include/asio/detail/config.hpp:757:5: warning: #warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target). [-Wcpp]
# warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
^
/cygdrive/{my_path_to}/restbed/restbed/dependency/asio/asio/include/asio/detail/config.hpp:781:5: error: #error You must add -D__USE_W32_SOCKETS to your compiler options.
I modifing config.hpp and add
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
The 'define bla' warnings dissapear, but now I should set '-D__USE_W32_SOCKETS'.
BUT WHERE?
After researching google I try to set a enviroment variable CPPFLAGS=-D__USE_W32_SOCKETS, but this change nothing!
OK, now I want give MinGW a chance, but how get I rid of this penetrant Cygwin, without deinstalling and get mess with other software?
Cool, should I set some enviroment variables....
Clean up the build-Directory and set CC and CXX as mentioned in cmake output.
SET CC=D:/MinGW/bin/gcc.exe
SET CXX=D:/MinGW/bin/g++.exe
Checking my PATH variable and adding ";D:\MinGW\mysys\1.0\bin;D:\MinGW\bin"
Now use cmake bla.. again...but... but... WHAT?
-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
CMake Error at CMakeLists.txt:4 (project):
The CMAKE_C_COMPILER:
D:/MinGW/bin/gcc.exe
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 "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error at CMakeLists.txt:4 (project):
The CMAKE_CXX_COMPILER:
D:/MinGW/bin/g++.exe
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 "/cygdrive/{my_path_to}/restbed/restbed/build/CMakeFiles/CMakeOutput.log".
With Cygwin cmake says, I use gcc/g++ in version GNU 5.4.0. On the other hand, it detects the correct MinGW version as 5.3.0, but can't find it? Hu?
What can I do to get this library work under Windows 7?
EDIT BEGIN
To build makefiles for Code::Blocks, the -G parameter doesn't work. I try some combinations, but always say:
cmake -DBUILD_TESTS=YES -DBUILD_EXAMPLES=YES -DBUILD_SSL=NO -DBUILD_SHARED=YES -G "CodeBlocks" ..
CMake Error: Could not create named generator CodeBlocks
Generators
Unix Makefiles = Generates standard UNIX makefiles.
Ninja = Generates build.ninja files.
CodeBlocks - Ninja = Generates CodeBlocks project files.
CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
:
:
cmake -DBUILD_TESTS=YES -DBUILD_EXAMPLES=YES -DBUILD_SSL=NO -DBUILD_SHARED=YES -G "CodeBlocks - Ninja" ..
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Now this (many censored words) thing want to know the cmake-make?
My fault.... don't think about, what I've installed.
"CodeBlocks - Unix Makefiles" works as expected for generating project file, but can't compile under Code::Blocks. I changed compiler for project in 'Build options' to Cygwin, but says:
Execution of '/usr/bin/make.exe -j8 -f "/cygdrive/d/{my_path_to}/restbed/restbed/build/Makefile" VERBOSE=1 all' in 'D:\{my_path_to}\restbed\restbed\build' failed.
...and nothing more. Think it has to do with "Unix Makefile" under Windows.
EDIT END
I'm out of knowledge what to do, what to set, to delete, to modify, configure, aaaargh.
My last hope is, that someone has the big hint, a good idea or a workaround.
Thanks in advance.
Restbed can build with Visual Studio 2015/2017, why not use the native toolchain for that platform?

Cmake Error During Installation of dlib on Windows?

I am trying to install dlib-19.2 in Window 7.But during the building process of dlib I get these errors.
Configuring cmake ...
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error in CMakeLists.txt:
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
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 "C:/dlib-19.2/tools/python/build/CMakeFiles/CMakeOutput.log".
See also "C:/dlib-19.2/tools/python/build/CMakeFiles/CMakeError.log".
error: cmake configuration failed!
Can anyone explain me the reason of the error and how to avoid it.Cmake GUI seems to work perfectly fine.
Had the same problem, installing Visual C++ 2015 Build Tools solved it for me:
http://landinghub.visualstudio.com/visual-cpp-build-tools

Qt Creator using MinGW compiler with CMake

I'm trying to use Qt Creator for C++ CMake project which doesn't use the Qt libraries.
I'm following the official guide, but it does not work at all. Here are my steps:
Add my MinGW bin directory to PATH.
Run QtCreator and setup CMake.
Open a a very basic CMakeLists.txt file.
Select "Ninja (Desktop)" as CMake generator.
Getting errors from CMake.
You may have noticed that step 4 is actually not mentioned at all in the official guide. I'm quite used to CMake and as such I'm asking myself:
Why doesn't the Qt Creator offer the normal "MinGW Makefiles" generator?
And finally the ultimate question:
How can I make the Qt Creator use a MinGW compiler through CMake?
Answered questions:
According to the official guide and as usual when you set PATH correctly, step 5 should not happen.
Why doesn't CMake find the compiler set in PATH?
It's the Ninja Generator that creates these errors, the same thing happens if you do it manually with CMake.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file: D:/Programming/C++/Test/SupportQt/build/CMakeFiles/3.0.2/CMakeCXXCompiler.cmake
CMake Error at CMakeLists.txt:1 (project):
No CMAKE_C_COMPILER could be found.
Tell CMake where to find the compiler by setting the CMake cache entry
CMAKE_C_COMPILER to the full path to the compiler, or to the compiler name
if it is in the PATH.
CMake Error at CMakeLists.txt:1 (project):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting 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.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file: D:/Programming/C++/Test/SupportQt/build/CMakeFiles/3.0.2/CMakeCCompiler.cmake
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.-- Configuring incomplete, errors occurred!
Looking at the configuration menu to see whether I have forgotten to setup something, I stumbled across the compiler setup page. I then of course added my compiler there as well, but it did nothing.
Why doesn't CMake use the compiler list when using CMake?
It does use the compiler list, IF you pick the right compiler in the kits selection.
As usually if you ask for help only to shortly after figure it out, I feel quite stupid now...
Why doesn't the Qt Creator use the compiler list when using CMake?
It does, but only if you set the Kit to use the right compiler!
Why doesn't CMake find the compiler set in PATH?
This is actually the problem of the Ninja Generator with CMake. The same thing happens if you use CMake directly.
Why doesn't the Qt Creator offer the normal "MinGW Makefiles" generator?
It does, but only if you picked a MinGW compiler in your Kit!
How can I make the Qt Creator use a MinGW compiler through CMake?
By setting everything up correctly and not relying too heavily on the official guide.

cmake doesn't work in windows XP

I'm new with cmake,just installed it and following this article:
http://www.cs.swarthmore.edu/~adanner/tips/cmake.php
D:\Works\c\cmake\build>cmake ..
-- Building for: NMake Makefiles
CMake Warning at CMakeLists.txt:2 (project):
To use the NMake generator, cmake must be run from a shell that can use the
compiler cl from the command line. This environment does not contain
INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
work.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Warning at D:/Tools/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake:32 (ENABLE_LANGUAGE):
To use the NMake generator, cmake must be run from a shell that can use the
compiler cl from the command line. This environment does not contain
INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
work.
Call Stack (most recent call first):
D:/Tools/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:58 (INCLUDE)
CMakeLists.txt:2 (project)
CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found. Please set CMAKE_RC_COMPILER to a valid compiler path or name.
-- Check for CL compiler version
-- Check for CL compiler version - failed
-- Check if this is a free VC compiler
-- Check if this is a free VC compiler - yes
-- Using FREE VC TOOLS, NO DEBUG available
-- Check for working C compiler: cl
CMake Warning at CMakeLists.txt:2 (PROJECT):
To use the NMake generator, cmake must be run from a shell that can use the
compiler cl from the command line. This environment does not contain
INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
work.
CMake Warning at D:/Tools/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake:32 (ENABLE_LANGUAGE):
To use the NMake generator, cmake must be run from a shell that can use the
compiler cl from the command line. This environment does not contain
INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
work.
Call Stack (most recent call first):
D:/Tools/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:58 (INCLUDE)
CMakeLists.txt:2 (PROJECT)
CMake Error at D:/Tools/CMake 2.8/share/cmake-2.8/Modules/CMakeRCInformation.cmake:22 (GET_FILENAME_COMPONENT):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
D:/Tools/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake:32 (ENABLE_LANGUAGE)
D:/Tools/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:58 (INCLUDE)
CMakeLists.txt:2 (PROJECT)
CMake Error: CMAKE_RC_COMPILER not set, after EnableLanguage
CMake Error: your C compiler: "cl" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check for working C compiler: cl -- broken
CMake Error at D:/Tools/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "cl" is not able to compile a simple test program.
It fails with the following output:
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
CMake Error: your C compiler: "cl" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: your CXX compiler: "cl" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
-- Configuring incomplete, errors occurred!
What are the complete requirement to use cmake successfully in windows XP?I've already installed Visual Studio under D:\Tools\Microsoft Visual Studio 9.0
First of all, I have to confess that I don't know cmake.
To use the NMake generator, cmake
must be run from a shell that can use
the compiler cl from the command
line. This environment does not
contain INCLUDE, LIB, or LIBPATH,
and these must be set for the cl
compiler to work.
The error above means that the proper locations to your C/C++ compiler's headers and libraries could not be found by cmake.
Instead of running cmake from the Command Prompt, try running cmake from the Visual Studio 2008 Command Prompt. You can find it under Start > Programs > Microsoft Visual Studio 2008 > Visual Studio Tools) or vcvarsall.bat in the folder *Microsoft Visual Studio 9.0\VC*. The visual Studio 2008 Command Prompt should set all these environment variables for you automatically so that cmake knows where to find the necessary files that it needs.
The Command Prompt will start in your Visual Studio folder, so you'll have to type the following commands to switch to your source folder and start cmake.
D:
cd D:\Works\c\cmake\build>
cmake
I hope this helps you.
I had similar issues on Win7, and was getting the same error - The C compiler "cl.exe" is not able to compile a simple test program.
The solution that worked for me :
On Windows Donot run cmake on the cygwin terminal.
Run it from the command prompt, AND also ensure that you have admin rights, In windows 7 you can start command prompt as administrator by going to Start->All programs->Accessories-> (Right Click on Command Prompt) and Select "Run as administrator"
Then run 'cmake <your source>' Worked like a charm for me.

Resources