Ошибка Zephyr при использовании llvm, отлично работает с набором инструментов по умолчанию - PullRequest
0 голосов
/ 30 января 2020

Я строю для платы nrf52833_pca10100 и nrf52840_pca10056.

изменен набор инструментов: экспорт ZEPHYR_TOOLCHAIN_VARIANT = llvm У меня есть llvm-8-dev, clang, clang-8, установленный через apt. для ZEPHYR_TOOLCHAIN_VARIANT = зефир, образец / базовый / блинки может строить и делать хорошо. При переключении на llvm возникает следующая ошибка при сборке:

-- The C compiler identification is Clang 6.0.0
-- The CXX compiler identification is Clang 6.0.0
-- The ASM compiler identification is Clang
-- Found assembler: /usr/bin/clang
-- Cache files will be written to: /root/.cache/zephyr 
CMake Error at ../../../cmake/extensions.cmake:1457 (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/zephyrproject/zephyr/samples/basic/blinky/test/CMakeFiles/CMakeOutput.log". 
See also "/home/zephyrproject/zephyr/samples/basic/blinky/test/CMakeFiles/CMakeError.log".

Я могу заставить эту проблему не появляться и строить, кормя -D CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY при сборке. Однако, когда я пытаюсь сделать, возникают следующие ошибки:

In file included from /home/zephyrproject/modules/hal/nordic/nrfx/mdk/nrf.h:164: /home/zephyrproject/modules/hal/nordic/nrfx/mdk/compiler_abstraction.h:154:16: warning:
      variable 'sp' is uninitialized when used here [-Wuninitialized]
        return sp;
               ^~ /home/zephyrproject/modules/hal/nordic/nrfx/mdk/compiler_abstraction.h:153:29: note:
      initialize the variable 'sp' to silence this warning
        register unsigned sp __ASM("sp");
                            ^
                             = 0 1 warning generated.

и в самом конце ссылки:

clang: warning: argument unused during compilation: '--specs=nosys.specs' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
clang: error: unable to execute command: Executable "ld.lld" doesn't exist!
clang: error: ld.lld command failed with exit code 1 (use -v to see invocation)
zephyr/CMakeFiles/zephyr_prebuilt.dir/build.make:100: recipe for target 'zephyr/zephyr_prebuilt.elf' failed
make[2]: *** [zephyr/zephyr_prebuilt.elf] Error 1
CMakeFiles/Makefile2:2133: recipe for target 'zephyr/CMakeFiles/zephyr_prebuilt.dir/all' failed
make[1]: *** [zephyr/CMakeFiles/zephyr_prebuilt.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Не уверен, что с ним не так.

РЕДАКТИРОВАТЬ: больше контента CMakeError.log

Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)":
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Performing C SOURCE FILE Test check_C__nostartfiles__nostdlib__isystem__usr_lib_llvm_6_0_lib_clang_6_0_0_include__isystem__usr_bin____lib_gcc_x86_64_linux_gnu_7_4_0_include_fixed__Wl___unresolved_symbols_ignore_in_object_files failed with the following output:
Change Dir: /home/akirakato/Desktop/ncs/zephyr/samples/basic/blinky/bc/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_11778/fast && /usr/bin/make -f CMakeFiles/cmTC_11778.dir/build.make CMakeFiles/cmTC_11778.dir/build
make[1]: Entering directory '/home/akirakato/Desktop/ncs/zephyr/samples/basic/blinky/bc/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_11778.dir/src.c.obj/usr/bin/clang --target=arm-none-eabi   -Dcheck_C__nostartfiles__nostdlib__isystem__usr_lib_llvm_6_0_lib_clang_6_0_0_include__isystem__usr_bin____lib_gcc_x86_64_linux_gnu_7_4_0_include_fixed__Wl___unresolved_symbols_ignore_in_object_files -nostartfiles -nostdlib -isystem /usr/lib/llvm-6.0/lib/clang/6.0.0/include -isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/include-fixed -Wl,--unresolved-symbols=ignore-in-object-files   -o CMakeFiles/cmTC_11778.dir/src.c.obj   -c /home/akirakato/Desktop/ncs/zephyr/samples/basic/blinky/bc/CMakeFiles/CMakeTmp/src.c
clang: warning: -Wl,--unresolved-symbols=ignore-in-object-files: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-nostartfiles' [-Wunused-command-line-argument]
Linking C executable cmTC_11778
/snap/cmake/237/bin/cmake -E cmake_link_script CMakeFiles/cmTC_11778.dir/link.txt --verbose=1
/usr/bin/clang --target=arm-none-eabi  -Dcheck_C__nostartfiles__nostdlib__isystem__usr_lib_llvm_6_0_lib_clang_6_0_0_include__isystem__usr_bin____lib_gcc_x86_64_linux_gnu_7_4_0_include_fixed__Wl___unresolved_symbols_ignore_in_object_files -nostartfiles -nostdlib -isystem /usr/lib/llvm-6.0/lib/clang/6.0.0/include -isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/include-fixed -Wl,--unresolved-symbols=ignore-in-object-files  --specs=nosys.specs  CMakeFiles/cmTC_11778.dir/src.c.obj  -o cmTC_11778
clang: warning: argument unused during compilation: '-nostartfiles' [Wunused-command-line-argument]
clang: warning: argument unused during compilation: '--specs=nosys.specs' [-Wunused-command-line-argument]
clang: error: unable to execute command: Executable "ld.lld" doesn't exist!
clang: error: ld.lld command failed with exit code 1 (use -v to see invocation)
CMakeFiles/cmTC_11778.dir/build.make:86: recipe for target 'cmTC_11778' failed
make[1]: \*\*\* [cmTC_11778] Error 1
make[1]: Leaving directory '/home/akirakato/Desktop/ncs/zephyr/samples/basic/blinky/bc/CMakeFiles/CMakeTmp'
Makefile:121: recipe for target 'cmTC_11778/fast' failed
make: *** [cmTC_11778/fast] Error 2


Source file was:
int main(void) { return 0; }

Я начинаю подозревать, что это проблема clang 6 и что мне нужно использовать clang 8+, увидела пост о том, как clang исправляет их проблемы, что было после дата выпуска clang 6. Не уверен, как изменить то, что выбирает clang zephyr.

...