Skip to content

IAR: Regression in 3.21.0, unable to compile project

I have a project which uses the IAR compiler, using a toolchain file.

With CMake version 3.20.5, this compiles without problems. After updating to CMake 3.21, it fails with the following error:

-- Check for working C compiler: C:/Program Files/IAR Systems/Embedded Workbench 9.0/arm/bin/iccarm.exe - broken
CMake Error at C:/Users/BDOMI/scoop/apps/cmake/3.21.0/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:66 (message):
  The C compiler

    "C:/Program Files/IAR Systems/Embedded Workbench 9.0/arm/bin/iccarm.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/DIST/dev/topas_core_2/build/topas_rel/CMakeFiles/CMakeTmp

    Run Build Command(s):C:\qp\qtools\bin\make.exe -f Makefile cmTC_d8493/fast && C:/qp/qtools/bin/make  -f CMakeFiles\cmTC_d8493.dir\build.make CMakeFiles/cmTC_d8493.dir/build
    make[1]: Entering directory 'C:/DIST/dev/topas_core_2/build/topas_rel/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_d8493.dir/testCCompiler.c.o
    C:\PROGRA~1\IARSYS~1\EMBEDD~1.0\arm\bin\iccarm.exe  --silent C:\DIST\dev\topas_core_2\build\topas_rel\CMakeFiles\CMakeTmp\testCCompiler.c  -IC:\PROGRA~1\IARSYS~1\EMBEDD~1.0\arm\inc\c --cpu Cortex-M4 --fpu VFPv4_sp --vectorize --no_wrap_diagnostics --mfc  -e -o CMakeFiles\cmTC_d8493.dir\testCCompiler.c.o
    Linking C executable cmTC_d8493.elf
    C:\Users\BDOMI\scoop\apps\cmake\3.21.0\bin\cmake.exe -E cmake_link_script CMakeFiles\cmTC_d8493.dir\link.txt --verbose=1
    C:\qp\qtools\mingw32\bin\ld.exe --silent CMakeFiles/cmTC_d8493.dir/testCCompiler.c.o --inline --merge_duplicate_sections  -o cmTC_d8493.elf
    C:\qp\qtools\mingw32\bin\ld.exe: unrecognized option '--silent'
    C:\qp\qtools\mingw32\bin\ld.exe: use the --help option for usage information

The problem seems to be that the wrong linker is used.

The correct linker for IAR would be C:/Program Files/IAR Systems/Embedded Workbench 9.0/arm/bin/ilinkarm.exe, which is also found in the CMakeCache.txt file. However, the error message shows that CMake tries to use the C:\qp\qtools\mingw32\bin\ld.exe linker, which is not correct.

Are there any changes in the toolchain file necessary when updating to version 3.21?

CMakeOutput.log CMakeError.log

Edited by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information