# CMake intermittently doesn't find ASM during build

**URL:** https://discourse.cmake.org/t/cmake-intermittently-doesnt-find-asm-during-build/9294
**Category:** Usage
**Tags:** os:linux
**Created:** [October 27, 2023, 12:00pm UTC](https://discourse.cmake.org/t/cmake-intermittently-doesnt-find-asm-during-build/9294 "2023-10-27T12:00:38Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![gino-ashling](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gino-ashling/32/3954_2.png) [@gino-ashling](https://discourse.cmake.org/u/gino-ashling)
#### Post date: [October 27, 2023, 12:00pm UTC](https://discourse.cmake.org/t/cmake-intermittently-doesnt-find-asm-during-build/9294/1 "2023-10-27T12:00:38Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [October 29, 2023, 12:33pm UTC](https://discourse.cmake.org/t/cmake-intermittently-doesnt-find-asm-during-build/9294/2 "2023-10-29T12:33:27Z")

</div>

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

> [@gino-ashling](#):
>
> \*-- Warning: Did not find file Compiler/-ASM

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

---

<div class="post-metadata">

### Author: ![gino-ashling](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gino-ashling/32/3954_2.png) [@gino-ashling](https://discourse.cmake.org/u/gino-ashling)
#### Post date: [February 20, 2024, 5:09pm UTC](https://discourse.cmake.org/t/cmake-intermittently-doesnt-find-asm-during-build/9294/3 "2024-02-20T17:09:35Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![jtxa](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jtxa/32/1535_2.png) [@jtxa](https://discourse.cmake.org/u/jtxa)
#### Post date: [February 22, 2024, 1:25am UTC](https://discourse.cmake.org/t/cmake-intermittently-doesnt-find-asm-during-build/9294/4 "2024-02-22T01:25:55Z")

</div>

The error message in your last post is this line:

```auto
*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.

---

<div class="post-metadata">

### Author: ![jtxa](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jtxa/32/1535_2.png) [@jtxa](https://discourse.cmake.org/u/jtxa)
#### Post date: [February 22, 2024, 1:31am UTC](https://discourse.cmake.org/t/cmake-intermittently-doesnt-find-asm-during-build/9294/5 "2024-02-22T01:31:12Z")

</div>

About CMake’s own warning:

```auto
-- 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.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [February 22, 2024, 7:34am UTC](https://discourse.cmake.org/t/cmake-intermittently-doesnt-find-asm-during-build/9294/6 "2024-02-22T07:34:52Z")

</div>

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.
