Re: C Compiler "/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc" does not compile

Marc Herbert



You're missing a ${ZEPHYR_BASE} definition. Do you use west?


This often confused me too. So I looked into adding a better error message but I couldn't find an implementation that wouldn't have to be duplicated in every single sample and test. That must be why there isn't any.


CMake doesn't support $ENV{ZEPHYR_BASE:-zephyr_base_is_missing} out of the box; please prove me wrong. Zephyr has tons of advanced CMake features available in.... ${ZEPHYR_BASE}/cmake





Off-topic PS: cmake has a new -B option that saves changing directory, see example in



From: <users@...> on behalf of "bobwilmes@..." <bobwilmes@...>
Date: Wednesday, 29 May 2019 at 20:15
To: "users@..." <users@...>
Subject: [Zephyr-users] C Compiler "/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc" does not compile


I am new to Zephyr trying to build some of the sample programs for a bbc_microbit.
I get the following error message from the compiler (I installed the 0.10 level of the Zephyr SDK on Windows 10 subsystem for Linux running Ubuntu 18.04 LTS).
It looks like the compiler that comers with the SDK is not working.
Any help would be much appreciated!!!!

bobwilmes@WILMES:~/zephyrproject/zephyr/samples/hello_world/build$ cmake -GNinja -DBOARD=bbc_microbit ..
CMake Error at CMakeLists.txt:5 (include):
  include could not find load file:


-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Check for working C compiler: /opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -- broken
CMake Error at /home/bobwilmes/.local/lib/python2.7/site-packages/cmake/data/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler


  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/bobwilmes/zephyrproject/zephyr/samples/hello_world/build/CMakeFiles/CMakeTmp

    Run Build Command:"/usr/bin/ninja" "cmTC_37158"
    [1/2] Building C object CMakeFiles/cmTC_37158.dir/testCCompiler.c.o
    [2/2] Linking C executable cmTC_37158
    FAILED: cmTC_37158
    : && /opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc    CMakeFiles/cmTC_37158.dir/testCCompiler.c.o  -o cmTC_37158   && :
    /opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/8.3.0/../../../../arm-zephyr-eabi/bin/ld: /opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/8.3.0/../../../../arm-zephyr-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
    /home/buildslave/src/ undefined reference to `_exit'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.


  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:6 (project)

-- Configuring incomplete, errors occurred!
See also "/home/bobwilmes/zephyrproject/zephyr/samples/hello_world/build/CMakeFiles/CMakeOutput.log".
See also "/home/bobwilmes/zephyrproject/zephyr/samples/hello_world/build/CMakeFiles/CMakeError.log".
bobwilmes@WILMES:~/zephyrproject/zephyr/samples/hello_world/build$ -

Join to automatically receive all group messages.