sdk-ng: qemu_cortex_m3 minimal example fails for cmake 3.19

tldr: cmake v3.18.5 works, cmake v3.19 and master (24/11/2020) fails


I am following the official Zephyr getting started and want to build and run the “minimal” example on qemu for x86-64 and Arm.

It works for me on qemu x86-64, but fails with the following for Arm:

-- west build: making build dir /home/oberstet/scm/crossbario/st-device/zephyr/build pristine
-- west build: generating a build system
Including boilerplate (Zephyr base): /home/oberstet/scm/crossbario/st-device/zephyr/cmake/app/boilerplate.cmake
-- Application: /home/oberstet/scm/crossbario/st-device/zephyr/samples/basic/minimal
-- Zephyr version: 2.4.0 (/home/oberstet/scm/crossbario/st-device/zephyr)
-- Found Python3: /home/oberstet/cpy382_1/bin/python3 (found suitable exact version "3.8.2") found components: Interpreter 
-- Found west (found suitable version "0.8.0", minimum required is "0.7.1")
-- Board: qemu_cortex_m3
-- Cache files will be written to: /home/oberstet/.cache/zephyr
-- Found toolchain: zephyr (/home/oberstet/zephyr-sdk-12)
-- Found dtc: /home/oberstet/zephyr-sdk-12/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/oberstet/scm/crossbario/st-device/zephyr/boards/arm/qemu_cortex_m3/qemu_cortex_m3.dts
-- Generated zephyr.dts: /home/oberstet/scm/crossbario/st-device/zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /home/oberstet/scm/crossbario/st-device/zephyr/build/zephyr/include/generated/devicetree_unfixed.h
Parsing /home/oberstet/scm/crossbario/st-device/zephyr/Kconfig
Loaded configuration '/home/oberstet/scm/crossbario/st-device/zephyr/boards/arm/qemu_cortex_m3/qemu_cortex_m3_defconfig'
Configuration saved to '/home/oberstet/scm/crossbario/st-device/zephyr/build/zephyr/.config'
Kconfig header saved to '/home/oberstet/scm/crossbario/st-device/zephyr/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/oberstet/zephyr-sdk-12/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
CMake Error at ../../../cmake/extensions.cmake:1557 (message):
  Assertion failed: The toolchain is unable to build a dummy C file.  See
  CMakeError.log.
Call Stack (most recent call first):
  ../../../CMakeLists.txt:42 (assert)


-- Configuring incomplete, errors occurred!
See also "/home/oberstet/scm/crossbario/st-device/zephyr/build/CMakeFiles/CMakeOutput.log".
See also "/home/oberstet/scm/crossbario/st-device/zephyr/build/CMakeFiles/CMakeError.log".
FATAL ERROR: command exited with status 1: /snap/bin/cmake -DWEST_PYTHON=/home/oberstet/cpy382_1/bin/python3 -B/home/oberstet/scm/crossbario/st-device/zephyr/build -S/home/oberstet/scm/crossbario/st-device/zephyr/samples/basic/minimal -GNinja -DBOARD=qemu_cortex_m3
Makefile:102: recipe for target 'build_minimal_arm' failed
make: *** [build_minimal_arm] Error 1
(cpy382_1) oberstet@intel-nuci7:~/scm/crossbario/st-device$ cat /home/oberstet/scm/crossbario/st-device/zephyr/build/CMakeFiles/CMakeError.log
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /home/oberstet/zephyr-sdk-12/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc 
Build flags: 
Id flags:  

The output was:
1
/home/oberstet/zephyr-sdk-12/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.2.0/../../../../arm-zephyr-eabi/bin/ld: /home/oberstet/zephyr-sdk-12/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.2.0/../../../../arm-zephyr-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x60): undefined reference to `_exit'
collect2: error: ld returned 1 exit status


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /home/oberstet/zephyr-sdk-12/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++ 
Build flags: 
Id flags:  

The output was:
1
/home/oberstet/zephyr-sdk-12/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.2.0/../../../../arm-zephyr-eabi/bin/ld: /home/oberstet/zephyr-sdk-12/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.2.0/../../../../arm-zephyr-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x60): undefined reference to `_exit'
collect2: error: ld returned 1 exit status

https://gist.github.com/oberstet/5cf96cde06d289b8d70ca3e59c7daca8


I have been trying different sdk version, however no luck with:

  • sdk-0.12.0-beta-2
  • sdk-0.11.4

I’m a bit lost, as the documented getting started doesn’t work for me. anything I can try? any traps? thanks a lot!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 31 (17 by maintainers)

Most upvoted comments

Opened this issue to track 3.19 support

https://github.com/zephyrproject-rtos/zephyr/issues/30232

There were old good days when it was suggested to install cmake from https://pypi.org/project/cmake/ . And it still appears to have non-broken version…

@oberstet I’ve been able to reproduce the non-docker case.

Seems cmake version related. If I use:

[galak@spiff build]$ cmake --version
cmake version 3.18.4

things work. Seems like anything 3.19 or newer fails.