I have some trouble doing a migration from IAR IDE to Cmake/IAR compiler for arm:
According to my understanding, with a correct CMakeList.txt, I try:
/c/CMake/bin/cmake.exe -G"MSYS Makefiles" -DCMAKE_TOOLCHAIN_FILE="C:\CMake\bin\Modules\Compiler\iar.cmake" -DCMAKE_C_COMPILER="C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0/arm/bin/iccarm.exe" -DCMAKE_ASM_COMPILER="C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0/arm/bin/iasmarm.exe" ..
I get:
-- The C compiler identification is IAR
-- The ASM compiler identification is IAR
-- Found assembler: C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0/arm/bin/iasmarm.exe
-- Check for working C compiler: C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0/arm/bin/iccarm.exe
CMake Error at C:/CMake/bin/Modules/Compiler/IAR.cmake:41 (message):
The IAR compiler for this architecture is not yet supported by CMake.
Please go to https://gitlab.kitware.com/cmake/cmake/issues and enter a
feature request there.
Call Stack (most recent call first):
C:/Projects/LabPadIntegration/lpd_firmware/LABPAD_IAR/FIRMWARE/build/CMakeFiles/3.7.2/CMakeSystem.cmake:6 (include)
C:/Projects/LabPadIntegration/lpd_firmware/LABPAD_IAR/FIRMWARE/build/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Configuring incomplete, errors occurred!
See also "C:/Projects/LabPadIntegration/lpd_firmware/LABPAD_IAR/FIRMWARE/build/CMakeFiles/CMakeOutput.log".
See also "C:/Projects/LabPadIntegration/lpd_firmware/LABPAD_IAR/FIRMWARE/build/CMakeFiles/CMakeError.log".
This sounds strange because if I read the IAR.cmake, the case where this fatal error rises is when the compiler does not match "arm" neither avr.
So I put a message output with the CMAKE_C_COMPILER argument and I get:
-- CMAKE_C_COMPILER={C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0/arm/bin/iccarm.exe}
-- The C compiler identification is IAR
-- The ASM compiler identification is IAR
-- Found assembler: C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0/arm/bin/iasmarm.exe
-- Check for working C compiler: C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0/arm/bin/iccarm.exe
CMake Error at C:/CMake/bin/Modules/Compiler/IAR.cmake:41 (message):
The IAR compiler for this architecture is not yet supported by CMake.
Please go to https://gitlab.kitware.com/cmake/cmake/issues and enter a
feature request there.
Call Stack (most recent call first):
C:/Projects/LabPadIntegration/lpd_firmware/LABPAD_IAR/FIRMWARE/build/CMakeFiles/3.7.2/CMakeSystem.cmake:6 (include)
C:/Projects/LabPadIntegration/lpd_firmware/LABPAD_IAR/FIRMWARE/build/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Configuring incomplete, errors occurred!
See also "C:/Projects/LabPadIntegration/lpd_firmware/LABPAD_IAR/FIRMWARE/build/CMakeFiles/CMakeOutput.log".
See also "C:/Projects/LabPadIntegration/lpd_firmware/LABPAD_IAR/FIRMWARE/build/CMakeFiles/CMakeError.log".
So I get the trace with CMAKE_C_COMPILER which matches well the value I entered, but the MATCH tells it does not match "arm"...
Any idea ?
I've been successfully using CMake to build with the IAR C/C++ Compilers.
The CMake's find_program() function worked nicely for finding CMAKE_<LANG>_COMPILER when installed in the usual locations.
As one example, the CMake toolchain file from this IAR tutorial worked for me on both Windows and Linux compilers.
However, it is also possible to set environment variables CC, CXX and ASM. CMake will use such environment variables to set the full path to the compiler. For example:
On Windows, using the IAR Embedded Workbench:
set CC="%PROGRAMFILES%/IAR Systems/Embedded Workbench 9.1/arm/bin/iccarm.exe"
set CXX="%PROGRAMFILES%/IAR Systems/Embedded Workbench 9.1/arm/bin/iccarm.exe"
set ASM="%PROGRAMFILES%/IAR Systems/Embedded Workbench 9.1/arm/bin/iasmarm.exe"
On Linux, using the IAR Build Tools:
export CC=/opt/iarsystems/bxarm/arm/bin/iccarm
export CXX=/opt/iarsystems/bxarm/arm/bin/iccarm
export ASM=/opt/iarsystems/bxarm/arm/bin/iasmarm
I just got some support from the Cmake issue tracker:
My misunderstanding, this is because the file i give as an arg is not a toolchain file
Related
I have a problem with this CMakeLists.txt file:
cmake_minimum_required(VERSION 2.6)
SET(CMAKE_C_COMPILER C:/MinGW/bin/gcc)
SET(CMAKE_CXX_COMPILER C:/MinGW/bin/g++)
project(cmake_test)
add_executable(a.exe test.cpp)
Calling cmake with: cmake -G "MinGW Makefiles" , it fails with the following output:
c:\Users\pietro.mele\projects\tests\buildSystem_test\cmake_test>cmake -G "MinGW Makefiles" .
-- The C compiler identification is GNU 4.6.1
-- The CXX compiler identification is GNU 4.6.1
-- Check for working C compiler: C:/MinGW/bin/gcc
CMake Error: your C compiler: "C:/MinGW/bin/gcc" 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: C:/MinGW/bin/gcc -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "C:/MinGW/bin/gcc" is not able to compile a simple test
program.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:10 (project)
CMake Error: your C compiler: "C:/MinGW/bin/gcc" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: your CXX compiler: "C:/MinGW/bin/g++" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
-- Configuring incomplete, errors occurred!
However the gcc compiler is in C:/MinGW/bin/ and it works.
Any idea?
Platform:
Windows 7
MinGW/GCC 4.6
Never try to set the compiler in the CMakeLists.txt file.
See the CMake FAQ about how to use a different compiler:
https://gitlab.kitware.com/cmake/community/wikis/FAQ#how-do-i-use-a-different-compiler
(Note that you are attempting method #3 and the FAQ says "(avoid)"...)
We recommend avoiding the "in the CMakeLists" technique because there are problems with it when a different compiler was used for a first configure, and then the CMakeLists file changes to try setting a different compiler... And because the intent of a CMakeLists file should be to work with multiple compilers, according to the preference of the developer running CMake.
The best method is to set the environment variables CC and CXX before calling CMake for the very first time in a build tree.
After CMake detects what compilers to use, it saves them in the CMakeCache.txt file so that it can still generate proper build systems even if those variables disappear from the environment...
If you ever need to change compilers, you need to start with a fresh build tree.
I had similar problem as Pietro,
I am on Window 10 and using "Git Bash".
I tried to execute >>cmake -G "MinGW Makefiles", but I got the same error as Pietro.
Then, I tried >>cmake -G "MSYS Makefiles", but realized that I need to set my environment correctly.
Make sure set a path to C:\MinGW\msys\1.0\bin and check if you have gcc.exe there. If gcc.exe is not there then you have to run C:/MinGW/bin/mingw-get.exe and install gcc from MSYS.
After that it works fine for me
Using with FILEPATH option might work:
set(CMAKE_CXX_COMPILER:FILEPATH C:/MinGW/bin/gcc.exe)
I had the same issue. And in my case the fix was pretty simple. The trick is to simply add the ".exe" to your compilers path. So, instead of :
SET(CMAKE_C_COMPILER C:/MinGW/bin/gcc)
It should be
SET(CMAKE_C_COMPILER C:/MinGW/bin/gcc.exe)
The same applies for g++.
I want to try and learn how to use the C language. Therefore, I downloaded CLion and MinGW as toolchain. When trying to install the compiler, it says "test CMake run finished with errors".
Did anybody ever had this problem? What should I do? (At the end of the question- what's written when I click "more" when it says "error").
Or, if you know of any other programs I should download in order to work with C, I'll be happy to hear.
Thanks in advance.
When clicking "more" it says:
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe
-- Check for working C compiler: C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe -- broken
CMake Error at C:/Program Files/JetBrains/CLion 2019.3.5/bin/cmake/win/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/׳ ׳•׳¢׳�/AppData/Local/Temp/cmake_check_environment/_build13533773436764788547/CMakeFiles/CMakeTmp
Run Build Command(s):C:/PROGRA~2/MINGW-~1/I686-8~1.0-P/mingw32/bin/mingw32-make.exe cmTC_e4849/fast && C:/PROGRA~2/MINGW-~1/I686-8~1.0-P/mingw32/bin/mingw32-make.exe -f CMakeFiles\cmTC_e4849.dir\build.make CMakeFiles/cmTC_e4849.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/ג‰¡ֿƒג‰¥ֿ†/AppData/Local/Temp/cmake_check_environment/_build13533773436764788547/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_e4849.dir/testCCompiler.c.obj
C:\PROGRA~2\MINGW-~1\I686-8~1.0-P\mingw32\bin\gcc.exe -o CMakeFiles\cmTC_e4849.dir\testCCompiler.c.obj -c C:\Users\ג•«ֳ¡ג•«׳¥ג•«ֳ³ג•«ֲ¥\AppData\Local\Temp\cmake_check_environment\_build13533773436764788547\CMakeFiles\CMakeTmp\testCCompiler.c
gcc.exe: error: C:\Users\ג•«ֳ¡ג•«׳¥ג•«ֳ³ג•«ֲ¥\AppData\Local\Temp\cmake_check_environment\_build13533773436764788547\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
mingw32-make.exe[1]: *** [CMakeFiles\cmTC_e4849.dir\build.make:65: CMakeFiles/cmTC_e4849.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/ג‰¡ֿƒג‰¥ֿ†/AppData/Local/Temp/cmake_check_environment/_build13533773436764788547/CMakeFiles/CMakeTmp'
mingw32-make.exe: *** [Makefile:120: cmTC_e4849/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/׳ ׳•׳¢׳�/AppData/Local/Temp/cmake_check_environment/_build13533773436764788547/CMakeFiles/CMakeOutput.log".
See also "C:/Users/׳ ׳•׳¢׳�/AppData/Local/Temp/cmake_check_environment/_build13533773436764788547/CMakeFiles/CMakeError.log".
Error code: 1
I work with cmake and ninja in Windows 7. It worked flawless, till i opend an older version of my IDE. Now cmake uses the wrong compiler. Instead of
C:/Program Files (x86)/Embarcadero/Studio/19.0/bin/bcc32x.exe it now tries to use C:/Program Files (x86)/Embarcadero/RAD Studio/9.0/bin/bcc32x.exe.
Of course I read similar Questions here on stackoverflow and tried the solutions described there, but nothing seems to work (How do you set CMAKE_C_COMPILER and CMAKE_CXX_COMPILER for building Assimp for iOS? for example). Even reinstallation of cmake does nothing. My windows environment variables are ok.
When i try to set CMake variables at command line like this:
cmake -G Ninja -D CMAKE_C_COMPILER="C:\\Program Files
(x86)\\Embarcadero\\Studio\\19.0\\bin\\bcc32x.exe" -D
CMAKE_CXX_COMPILER="C:\\Program Files (x86)\\Embarcadero\\Studio\\19.0
\\bin\\bcc32x.exe"
cmd Output was
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.
C:\Users\cld>cd c:\
c:\>cmake -G Ninja -D CMAKE_C_COMPILER="C:\\Program Files
(x86)\\Embarcadero\\Studio\\19.0\\bin\\bcc32x.exe" -D
CMAKE_CXX_COMPILER="C:\\Program Files (x86)\\Embarcadero\\Studio\\19.0
\\bin\\bcc32x.exe"
C:\Users\cld\Desktop\smallCmakeTest
-- The C compiler identification is Embarcadero 7.30.36015
-- The CXX compiler identification is Embarcadero 7.30.36015
-- Check for working C compiler: C:/Program Files (x86)/Embarcadero/RAD
Studio/9.0/bin/bcc32x.exe
-- Check for working C compiler: C:/Program Files (x86)/Embarcadero/RAD
Studio/9.0/bin/bcc32x.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.10/Modules
/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/Program Files (x86)/Embarcadero/RAD Studio/9.0/bin/bcc32x.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/cld/Desktop/smallCmakeTest/CMakeFiles/CMakeTmp
Run Build Command:"C:/ninja/ninja.exe" "cmTC_c1b2f"
[1/2] Building C object CMakeFiles\cmTC_c1b2f.dir\testCCompiler.c.obj
FAILED: CMakeFiles/cmTC_c1b2f.dir/testCCompiler.c.obj
"C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\bin\bcc32x.exe"
-I"C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\include\windows\crtl"
-I"C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\
include\windows\sdk" -I"C:\Program Files (x86)\Embarcadero\RAD Studio\9.0
\include\windows\rtl" -I"C:\Program Files (x86)\Embarcadero\RAD Studio\9.0
\include\dinkumware64" -tM -O0 -v -oCMakeFiles\cmTC_
c1b2f.dir\testCCompiler.c.obj -c testCCompiler.c
CreateProcess failed: 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:1 (project)
CMake Error at CMakeLists.txt:1 (project):
The CMAKE_CXX_COMPILER:
C:/Program Files (x86)/Embarcadero/RAD Studio/9.0/bin/bcc32x.exe
is not a full path to an existing compiler tool.
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.
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.10)
should be added at the top of the file. The version specified may be
lower
if you wish to support older CMake versions for this project. For
more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring incomplete, errors occurred!
See also "C:/Users/cld/Desktop/smallCmakeTest/CMakeFiles
/CMakeOutput.log".
See also "C:/Users/cld/Desktop/smallCmakeTest/CMakeFiles
/CMakeError.log".
I'm trying to compile CGAL 4.5 on cygwin (windows 7). i have gcc-core, gcc-g++ and gmp installed but when i try to run cmake i get following error:
$ cmake .
-- The CXX compiler identification is GNU 4.8.3
CMake Error: Could not find cmake module file:/home/metalab/CGAL-4.5/CMakeFiles/2.8.11.2/CMakeCXXCompiler.cmake
-- The C compiler identification is GNU 4.8.3
CMake Error: Could not find cmake module file:/home/metalab/CGAL-4.5/CMakeFiles/2.8.11.2/CMakeCCompiler.cmake
CMake Warning at /usr/share/cmake-2.8.11.2/Modules/Platform/CYGWIN.cmake:15 (message):
CMake no longer defines WIN32 on Cygwin!
(1) If you are just trying to build this project, ignore this warning or
quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or in
the CMake cache. If later configuration or build errors occur then this
project may have been written under the assumption that Cygwin is WIN32.
In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead.
(2) If you are developing this project, add the line
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
at the top of your top-level CMakeLists.txt file or set the minimum
required version of CMake to 2.8.4 or higher. Then teach your project to
build on Cygwin without WIN32.
Call Stack (most recent call first):
/usr/share/cmake-2.8.11.2/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
CMakeLists.txt:7 (project)
CMake Error: Could not find cmake module file:/home/metalab/CGAL-4.5/CMakeFiles/2.8.11.2/CMakeRCCompiler.cmake
-- Check for working CXX compiler: /usr/bin/c++.exe
CMake Error at /usr/share/cmake-2.8.11.2/Modules/CMakeTestCXXCompiler.cmake:40 (try_compile):
Unknown extension ".cxx" for file
/home/metalab/CGAL-4.5/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
try_compile() works only for enabled languages. Currently these are:
C CXX RC
See project() command to enable other languages.
Call Stack (most recent call first):
CMakeLists.txt:7 (project)
-- Check for working CXX compiler: /usr/bin/c++.exe -- broken
CMake Error at /usr/share/cmake-2.8.11.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:
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:7 (project)
-- Configuring incomplete, errors occurred!
i already tried playing with CMAKE_LEGACY_CYGWIN_WIN32 but no success.
I ran in a similar error. cmake seemed to not be able to find anything from Cygwin.
The fact is that you need to run the Cygwin version of cmake. If you installed cmake from an installer and it went under C:\Program Files, you have the wrong cmake and it won't find most everything which it should otherwise find.
all. I'm trying to use cmake for compile some android code with android toolchain on Windows 7x64.
when i call cmake as following
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=android.cmake 1>!cmake.log 2>!cmake.error.log
I run this command from Administrator console and get following output:
!cmake.log
-- The C compiler identification is GNU 4.6.0
-- The CXX compiler identification is GNU 4.6.0
-- Check for working C compiler: c:/cygwin/usr/local/android-toolchain-r8ea9/bin/arm-linux-androideabi-gcc.exe
-- Check for working C compiler: c:/cygwin/usr/local/android-toolchain-r8ea9/bin/arm-linux-androideabi-gcc.exe -- broken
-- Configuring incomplete, errors occurred!
!cmake.error.log
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler
"c:/cygwin/usr/local/android-toolchain-r8ea9/bin/arm-linux-androideabi-gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/PDK_BUILD/openssl/CMakeFiles/CMakeTmp
Run Build Command:C:/PROGRA~2/CMAKE2~1.8/bin/cmake.exe
"cmTryCompileExec333575975/fast"
CMake Error: The source directory
"C:/PDK_BUILD/openssl/CMakeFiles/CMakeTmp/cmTryCompileExec333575975/fast"
does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
I granted adninistrator rights for cmake.exe itself, cleared read-only attributes from CMakeFiles folder and disabled anti-virus but still not worked.
It looks like you are running into CMake Bug 0013131. This comment suggests that using unset TMP should fix the problem. Don't forget to delete the CMakeCache.txt and CMakeFiles folders (or the entire build tree when using out-of-source builds), before retrying.