qemu build not working on fresh ncs v2.3.0

Windows 11, NCS v2.3.0, VSCode

I installed ncs v2.3.0 via the nrf desktop app.

I opened vscode, opened an nRF Connect console, and issued the command:

west build -b qemu_x86 samples/hello_world

I was expecting this to work because of the zephyr 3.2.0 guide: docs.zephyrproject.org/.../beyond-GSG.html

PS C:\Users\dougl> cd C:\ncs\v2.3.0\zephyr\
PS C:\ncs\v2.3.0\zephyr> west build -b qemu_x86 samples/hello_world
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base (cached)).
-- Application: C:/ncs/v2.3.0/zephyr/samples/hello_world
-- Using NCS Toolchain 2.3.0 for building. (C:/ncs/toolchains/v2.3.0/cmake)
-- Cache files will be written to: C:/ncs/v2.3.0/zephyr/.cache
-- Zephyr version: 3.2.99 (C:/ncs/v2.3.0/zephyr)
-- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
-- Board: qemu_x86
-- Found host-tools: zephyr 0.15.2 (C:/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.15.2 (C:/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
-- Found BOARD.dts: C:/ncs/v2.3.0/zephyr/boards/x86/qemu_x86/qemu_x86.dts
-- Generated zephyr.dts: C:/ncs/v2.3.0/zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/ncs/v2.3.0/zephyr/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/ncs/v2.3.0/zephyr/build/zephyr/dts.cmake
Parsing C:/ncs/v2.3.0/zephyr/Kconfig
Loaded configuration 'C:/ncs/v2.3.0/zephyr/build/zephyr/.config'
No change to configuration in 'C:/ncs/v2.3.0/zephyr/build/zephyr/.config'
No change to Kconfig header in 'C:/ncs/v2.3.0/zephyr/build/zephyr/include/generated/autoconf.h'
CMake Error at C:/ncs/v2.3.0/zephyr/cmake/compiler/gcc/target.cmake:43 (message):
  C compiler
  C:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/x86_64-zephyr-elf/bin/x86_64-zephyr-elf-gcc
  not found - Please check your toolchain installation
Call Stack (most recent call first):
  C:/ncs/v2.3.0/zephyr/cmake/modules/FindTargetTools.cmake:102 (include)
  C:/ncs/v2.3.0/zephyr/cmake/modules/kernel.cmake:25 (find_package)
  C:/ncs/v2.3.0/zephyr/cmake/modules/zephyr_default.cmake:117 (include)
  C:/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  C:/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
  CMakeLists.txt:5 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: 'c:\ncs\toolchains\v2.3.0\opt\bin\cmake.EXE' '-DWEST_PYTHON=c:\ncs\toolchains\v2.3.0\opt\bin\python.exe' '-BC:\ncs\v2.3.0\zephyr\build' -GNinja '-SC:\ncs\v2.3.0\zephyr\samples\hello_world'
PS C:\ncs\v2.3.0\zephyr> 

Can you tell me what isn't working and how to fix it?

This also didn't work for the native_posix.

Thanks.

Parents Reply Children
  • Hi, I have followed the step-by-step instructions on setting up zephyr on the command line, and I was able to build, but not run.

    The page you linked to said building for qemu_x86 (not qemu_x86_64) works normally I think, but the _x64 had to install special things?

    Why isn't this running?

    I also installed the chocolatey package (link) for qemu and zephyr-qemu but that didn't fix it.

    PS C:\Users\dougl\zephyrproject\zephyr> west build -p always -b qemu_x86 .\samples\hello_world\
    -- west build: making build dir C:\Users\dougl\zephyrproject\zephyr\build pristine
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/Users/dougl/zephyrproject/zephyr/samples/hello_world
    -- CMake version: 3.26.1
    -- Found Python3: C:/Python311/python.exe (found suitable exact version "3.11.2") found components: Interpreter
    -- Cache files will be written to: C:/Users/dougl/zephyrproject/zephyr/.cache
    -- Zephyr version: 3.3.99 (C:/Users/dougl/zephyrproject/zephyr)
    -- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
    -- Board: qemu_x86
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Found host-tools: zephyr 0.16.0 (C:/Users/dougl/zephyr-sdk-0.16.0)
    -- Found toolchain: zephyr 0.16.0 (C:/Users/dougl/zephyr-sdk-0.16.0)
    -- Found Dtc: C:/ProgramData/chocolatey/bin/dtc.exe (found suitable version "1.5.0", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/Users/dougl/zephyrproject/zephyr/boards/x86/qemu_x86/qemu_x86.dts
    -- Generated zephyr.dts: C:/Users/dougl/zephyrproject/zephyr/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/Users/dougl/zephyrproject/zephyr/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: C:/Users/dougl/zephyrproject/zephyr/build/zephyr/dts.cmake
    Parsing C:/Users/dougl/zephyrproject/zephyr/Kconfig
    Loaded configuration 'C:/Users/dougl/zephyrproject/zephyr/boards/x86/qemu_x86/qemu_x86_defconfig'
    Merged configuration 'C:/Users/dougl/zephyrproject/zephyr/samples/hello_world/prj.conf'
    Configuration saved to 'C:/Users/dougl/zephyrproject/zephyr/build/zephyr/.config'
    Kconfig header saved to 'C:/Users/dougl/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/Users/dougl/zephyr-sdk-0.16.0/x86_64-zephyr-elf/bin/x86_64-zephyr-elf-gcc.exe
    CMake Warning at C:/Users/dougl/zephyrproject/zephyr/subsys/random/CMakeLists.txt:11 (message):


    Warning: CONFIG_TIMER_RANDOM_GENERATOR is not a truly random generator.
    This capability is not secure and it is provided for testing purposes only.
    Use it carefully.


    CMake Warning at C:/Users/dougl/zephyrproject/zephyr/CMakeLists.txt:828 (message):
    No SOURCES given to Zephyr library: lib__libc__common

    Excluding target from build.


    -- Configuring done (5.1s)
    -- Generating done (0.2s)
    -- Build files have been written to: C:/Users/dougl/zephyrproject/zephyr/build
    ←[92m-- west build: building application
    [1/131] Generating include/generated/version.h
    -- Zephyr version: 3.3.99 (C:/Users/dougl/zephyrproject/zephyr), build: zephyr-v3.3.0-1713-gccd88a4b611c
    [117/131] Linking C executable zephyr\zephyr_pre0.elf

    [121/131] Linking C executable zephyr\zephyr_pre1.elf

    [131/131] Linking C executable zephyr\zephyr.elf
    Memory region Used Size Region Size %age Used
    RAM: 53280 B 3 MB 1.69%
    IDT_LIST: 0 GB 2 KB 0.00%
    PS C:\Users\dougl\zephyrproject\zephyr> west build -t run
    -- west build: running target run
    [0/1] To exit from QEMU enter: 'CTRL+a, x'[QEMU] CPU: qemu32,+nx,+pae'QEMU-NOTFOUND' is not recognized as an internal or external command,
    operable program or batch file.

    FAILED: zephyr/CMakeFiles/run_qemu C:/Users/dougl/zephyrproject/zephyr/build/zephyr/CMakeFiles/run_qemu
    cmd.exe /C "cd /D C:\Users\dougl\zephyrproject\zephyr\build && QEMU-NOTFOUND -m 4 -cpu qemu32,+nx,+pae -machine q35 -device isa-debug-exit,iobase=0xf4,iosize=0x04 -no-reboot -nographic -no-acpi -net none -pidfile qemu.pid -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -icount shift=5,align=off,sleep=off -rtc clock=vm -kernel C:/Users/dougl/zephyrproject/zephyr/build/zephyr/zephyr.elf"
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' --build 'C:\Users\dougl\zephyrproject\zephyr\build' --target run
    PS C:\Users\dougl\zephyrproject\zephyr>

    Thanks.

  • Update, I installed the qemu for 64-bit windows from here (link), re-built, and re-ran and it worked.

Related