Ошибка утверждения: инструментальная цепочка не может создать фиктивный файл C

Несколько студентов и я пытались настроить среду сборки Zephyr RTOS под Windows 10, чтобы создавать приложения, предназначенные для различных плат ARM Cortex M. Все мы следовали "Руководству по началу работы" Zephyr и столкнулись с одной и той же проблемой. При компиляции для нескольких разных плат (давайте просто возьмем здесь nrf52840dk_nrf52840 в качестве примера) мы получаем такую ​​ошибку:

Сообщение об ошибке

C:\Users\John\code\eip-zephyr>west build -p auto -b nrf52840dk_nrf52840 .\zephyr\samples\basic\blinky\
-- west build: generating a build system
Including boilerplate (Zephyr base): C:/Users/John/code/eip-zephyr/zephyr/cmake/app/boilerplate.cmake
-- Application: C:/Users/John/code/eip-zephyr/zephyr/samples/basic/blinky
-- Zephyr version: 2.4.0 (C:/Users/John/code/eip-zephyr/zephyr)
-- Found Python3: C:/Python39/python.exe (found suitable exact version "3.9.0") found components: Interpreter
-- Found west (found suitable version "0.8.0", minimum required is "0.7.1")
-- Board: nrf52840dk_nrf52840
-- Cache files will be written to: C:/Users/John/code/eip-zephyr/zephyr/.cache
-- Found toolchain: gnuarmemb (C:/gnu_arm_embedded)
-- Found BOARD.dts: C:/Users/John/code/eip-zephyr/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
-- Generated zephyr.dts: C:/Users/John/code/eip-zephyr/build/nrf52840dk_nrf52840/blinky/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: C:/Users/John/code/eip-zephyr/build/nrf52840dk_nrf52840/blinky/zephyr/include/generated/devicetree_unfixed.h
Parsing C:/Users/John/code/eip-zephyr/zephyr/Kconfig
Loaded configuration 'C:/Users/John/code/eip-zephyr/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
Merged configuration 'C:/Users/John/code/eip-zephyr/zephyr/samples/basic/blinky/prj.conf'
Configuration saved to 'C:/Users/John/code/eip-zephyr/build/nrf52840dk_nrf52840/blinky/zephyr/.config'
Kconfig header saved to 'C:/Users/John/code/eip-zephyr/build/nrf52840dk_nrf52840/blinky/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 9.3.1
-- The CXX compiler identification is GNU 9.3.1
-- The ASM compiler identification is GNU
-- Found assembler: C:/gnu_arm_embedded/bin/arm-none-eabi-gcc.exe
CMake Error at ../../../cmake/extensions.cmake:1569 (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 "C:/Users/John/code/eip-zephyr/build/nrf52840dk_nrf52840/blinky/CMakeFiles/CMakeOutput.log".
See also "C:/Users/John/code/eip-zephyr/build/nrf52840dk_nrf52840/blinky/CMakeFiles/CMakeError.log".
FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' '-DWEST_PYTHON=c:\python39\python.exe' '-BC:\Users\John\code\eip-zephyr\build\nrf52840dk_nrf52840\blinky' '-SC:\Users\John\code\eip-zephyr\zephyr\samples\basic\blinky' -GNinja -DBOARD=nrf52840dk_nrf52840

Эта ошибка отсылает нас к файлам: CMakeError и CMakeOutput. Вот их содержание ниже:

CMakeError

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/gnu_arm_embedded/bin/arm-none-eabi-gcc.exe 
Build flags: 
Id flags:  

The output was:
1
c:/gnu_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/gnu_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2.exe: error: ld returned 1 exit status


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/gnu_arm_embedded/bin/arm-none-eabi-gcc.exe 
Build flags: 
Id flags:  

The output was:
1
c:/gnu_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/gnu_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2.exe: error: ld returned 1 exit status

CMakeOutput

The target system is: Generic - 2.4.0 - arm
The host system is: Windows - 10.0.19041 - AMD64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: C:/gnu_arm_embedded/bin/arm-none-eabi-gcc.exe 
Build flags: 
Id flags: -c 

The output was:
0


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.o"

The C compiler identification is GNU, found in "C:/Users/John/code/eip-zephyr/build/nrf52840dk_nrf52840/blinky/CMakeFiles/3.19.0/CompilerIdC/CMakeCCompilerId.o"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: C:/gnu_arm_embedded/bin/arm-none-eabi-gcc.exe 
Build flags: 
Id flags: -c 

The output was:
0


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.o"

The CXX compiler identification is GNU, found in "C:/Users/John/code/eip-zephyr/build/nrf52840dk_nrf52840/blinky/CMakeFiles/3.19.0/CompilerIdCXX/CMakeCXXCompilerId.o"

Checking whether the ASM compiler is GNU using "--version" matched "(GNU assembler)|(GCC)|(Free Software Foundation)":
arm-none-eabi-gcc.exe (GNU Arm Embedded Toolchain 9-2020-q2-update) 9.3.1 20200408 (release)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Мои вопросы:

  1. Что означает эта ошибка?
  2. Как мне это исправить, чтобы я мог успешно создавать приложения.

2 ответа

Решение

Покопавшись и получив помощь от других в канале zephyr-rtos Slack, я обнаружил, что другие испытывают ту же проблему, поэтому я опубликую здесь свое исправление в надежде, что оно также решит проблемы других людей.

Исправление двоякое:

  1. Вы должны перейти на более раннюю версию CMake 3.19. Большинство из них до этого работало, но рекомендуемая версия - 3.17.2. Если вы используете окна, это можно сделать с помощью шоколадной команды: choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' --version 3.17.2 --allow-downgrade --force.
  2. Вы должны удалить папку.cache. Ваш предыдущий вывод сборки сообщает вам, где это будет храниться. Строка начинается так: "- Файлы кеша тоже будут записываться: ..."

Я до сих пор не знаю, почему возникает эта ошибка или что нужно сделать, чтобы исправить ее навсегда, но на данный момент это исправление.

Просто хочу сообщить, что в репозитории Zephyr в настоящее время проводится обходной путь. Посмотрите здесь: https://github.com/zephyrproject-rtos/zephyr/pull/30272

Другие вопросы по тегам