CMake intermittently doesn't find ASM during build

Usually, all works fine with the scripts and commands.
We’ve been seeing this issue occasionally from time to time, during many different unrelated regression tests.

Please see the command used and the error log:

*cmake -B sw/cpu_app/build -G Unix\ Makefiles -S sw/cpu_app -DCMAKE_BUILD_TYPE=Release
*-- The ASM compiler identification is unknown
*-- Found assembler: /<path/masked/>/toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-gcc
*-- Warning: Did not find file Compiler/-ASM
*-- The C compiler identification is GNU 12.1.0
*-- Detecting C compiler ABI info
*-- Detecting C compiler ABI info - done
*-- Check for working C compiler: /<path/masked/>/toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-gcc - skipped
*-- Detecting C compile features
*-- Detecting C compile features - done
*-- The CXX compiler identification is GNU 12.1.0
*-- Detecting CXX compiler ABI info
*-- Detecting CXX compiler ABI info - done
*-- Check for working CXX compiler: /<path/masked/>/toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-c++ - skipped
*-- Detecting CXX compile features
*-- Detecting CXX compile features - done
*-- Warning: Did not find file Compiler/-ASM
*-- Configuring incomplete, errors occurred!

Environment: SUSE 12 Linux.

Manually it is difficult to reproduce the issue, as it is happening during the regression tests.
Any leads to the cause of the issue will be helpful.
Thank you.

It looks like a cross-compile and that the target platform is not set properly based on the /-ASM here:

I think it might be best to set up a toolchain file that describes the target system in a reliable way.

1 Like

Unfortunately, this started happening frequently again. A bit of new information, is now it’s happening on Windows as well.

– The C compiler identification is GNU 13.2.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: <path/masked>/toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-gcc.exe - skipped
– Detecting C compile features
– Detecting C compile features - done
– The CXX compiler identification is GNU 13.2.0
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: <path/masked>/toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-g++.exe - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– The ASM compiler identification is unknown
– Found assembler: <path/masked>/toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-gcc.exe
– Warning: Did not find file Compiler/-ASM
CMake Error at E:/tmp/arc_1621160833/tmpysisrwi0/bsp/toolchain.cmake:61 (enable_language):

  • The CMAKE_ASM_COMPILER:*

  • riscv32-unknown-elf-gcc*

  • is not a full path and was not found in the PATH.*

  • Tell CMake where to find the compiler by setting the CMake cache entry*

  • CMAKE_ASM_COMPILER to the full path to the compiler, or to the compiler*

  • name if it is in the PATH.*
    Call Stack (most recent call first):

  • CMakeLists.txt:5 (include)*

– Warning: Did not find file Compiler/-ASM
– Configuring incomplete, errors occurred!

Any help?
The issue happened in Windows (and Linux) and also with the latest toolchain version (GNU 13.2).

The error message in your last post is this line:

*CMake Error at E:/tmp/arc_1621160833/tmpysisrwi0/bsp/toolchain.cmake:61 (enable_language)*

This has nothing to do with CMake itself, check your own toolchain file.

AFAIK the toolchain file is included before CMake decides about the compiler, because it uses information from the toolchain file to do so.

So if that toolchain file does such checks, then it expects you to set the cache variables to the absolute path yourself, e.g. via -D on the first configure call.

About CMake’s own warning:

-- Warning: Did not find file Compiler/-ASM

The filename usually contains the compiler name, but in your case the identification was “unknown”, hence it’s empty.

CMake detects the compiler by calling --version and for GNU it expects the following regex to match (GNU assembler)|(GCC)|(Free Software Foundation). Seems your compiler has modified the version string too heavily.

But this message alone, is no reason for CMake configure to abort. The build may fail, because the assembler is not fully/correctly set up.
That’s why I assume your first post did not contain the full log.

The toolchain file is read before any languages can or should be enabled. You must not call enable_language() in a toolchain file. Think of the toolchain file as providing all the details needed if a language is enabled. It is up to the project to then enable the languages it needs.