Search code examples
zephyr-rtos

Zephyr cmake error `string sub-command REGEX, mode MATCH needs at least 5 arguments total to command.`


Hi I'm trying to run the getting started guide, but I'm having issues, I'm currently on the zephyr directory and I want to run the example, so I try west build -p auto -b qemu_x86 samples/basic/blinky but it gives instead

-- west build: generating a build system
Including boilerplate (Zephyr base (cached)): /content/zephyrproject/zephyr/cmake/app/boilerplate.cmake
-- Application: /content/zephyrproject/zephyr/samples/basic/blinky
-- Zephyr version: 2.3.99 (/content/zephyrproject/zephyr)
-- Board: qemu_x86
-- Found toolchain: zephyr (/usr/zephyr-sdk-0.11.3)
-- Found west: /root/.local/bin/west (found suitable version "0.7.2", minimum required is "0.7.1")
/usr/zephyr-sdk-0.11.3/sysroots/x86_64-pokysdk-linux/usr/bin/dtc: error while loading shared libraries: libunwind.so.8: cannot open shared object file: No such file or directory
CMake Error at /content/zephyrproject/zephyr/cmake/host-tools.cmake:63 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  /content/zephyrproject/zephyr/cmake/app/boilerplate.cmake:490 (include)
  /content/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
  /content/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
  CMakeLists.txt:4 (find_package)


CMake Error at /content/zephyrproject/zephyr/cmake/host-tools.cmake:68 (if):
  if given arguments:

    "VERSION_GREATER" "1.4.6"

  Unknown arguments specified
Call Stack (most recent call first):
  /content/zephyrproject/zephyr/cmake/app/boilerplate.cmake:490 (include)
  /content/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
  /content/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
  CMakeLists.txt:4 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: /usr/local/bin/cmake -B/content/zephyrproject/zephyr/build -S/content/zephyrproject/zephyr/samples/basic/blinky -GNinja -DBOARD=qemu_x86

There is a google colab attempting to reproduce the problem.


Solution

  • The error is caused by an outdated DTC version. Either update or use the one in the SDK installation:

    ln -s <zephyr-install-dir>/sysroots/x86_64-pokysdk-linux/usr/bin/dtc ~/.local/bin/dtc
    

    and ensure your .local/bin is in $PATH before /usr/bin

    You can check the version by:

    dtc --version
    

    it shall be greater than 1.4.6.

    Ubuntu 18.0.4 has version 1.4.5