zephyr: Windows compilation error
Discussed in https://github.com/zephyrproject-rtos/zephyr/discussions/85747
<div type='discussions-op-text'>Originally posted by ofirshe February 13, 2025 Hi, I’ve rebased onto the latest Zephyr commit (8b80c209446d8bbe9b454b91773ace14ac40d4c2) and I’m encountering compilation errors related to YAML and JSON escaping that I’ve never seen before.
Can someone help me debug this?
C:\Users\ofirs\bsp>west build -b mimxrt1060_evk
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: C:/Users/ofirs/bsp
-- CMake version: 3.29.1
-- Found Python3: C:/Python312/python.exe (found suitable version "3.12.3", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: C:/Users/ofirs/bsp/zephyr/.cache
-- Zephyr version: 4.0.99 (C:/Users/ofirs/bsp/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
CMake Warning at zephyr/cmake/modules/boards.cmake:110 (message):
Deprecated BOARD=mimxrt1060_evk specified, board automatically changed to:
mimxrt1060_evk/mimxrt1062/qspi.
Call Stack (most recent call first):
zephyr/cmake/modules/zephyr_default.cmake:133 (include)
zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
CMakeLists.txt:37 (find_package)
-- Board: mimxrt1060_evk, Revision: C, qualifiers: mimxrt1062/qspi
-- Found host-tools: zephyr 0.16.8 (C:/Users/ofirs/bsp/zephyr-sdk-0.16.8)
-- Found toolchain: zephyr 0.16.8 (C:/Users/ofirs/bsp/zephyr-sdk-0.16.8)
-- 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/ofirs/bsp/zephyr/boards/nxp/mimxrt1060_evk/mimxrt1060_evk_mimxrt1062_qspi.dts
-- Found devicetree overlay: C:/Users/ofirs/bsp/zephyr/boards/nxp/mimxrt1060_evk/mimxrt1060_evk_mimxrt1062_qspi_C.overlay
-- Generated zephyr.dts: C:/Users/ofirs/bsp/build/zephyr/zephyr.dts
-- Generated pickled edt: C:/Users/ofirs/bsp/build/zephyr/edt.pickle
-- Generated devicetree_generated.h: C:/Users/ofirs/bsp/build/zephyr/include/generated/zephyr/devicetree_generated.h
-- Including generated dts.cmake file: C:/Users/ofirs/bsp/build/zephyr/dts.cmake
Parsing C:/Users/ofirs/bsp/zephyr/Kconfig
Loaded configuration 'C:/Users/ofirs/bsp/zephyr/boards/nxp/mimxrt1060_evk/mimxrt1060_evk_mimxrt1062_qspi_defconfig'
Merged configuration 'C:/Users/ofirs/bsp/project_configuration/prj.conf'
Merged configuration 'C:/Users/ofirs/bsp/project_configuration/ethernet-phy-overlay.conf'
Configuration saved to 'C:/Users/ofirs/bsp/build/zephyr/.config'
Kconfig header saved to 'C:/Users/ofirs/bsp/build/zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: c:/users/ofirs/bsp/zephyr-sdk-0.16.8/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
-- 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/ofirs/bsp/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
Load components for MIMXRT1062:
driver_common component is included.
driver_reset component is included.
device_CMSIS component is included.
CMSIS_Include_core_cm component is included.
device_system component is included.
driver_trng component is included.
driver_enet component is included.
driver_lpi2c component is included.
driver_lpspi component is included.
driver_lpuart component is included.
driver_igpio component is included.
driver_flexspi component is included.
driver_cache_armv7_m7 component is included.
driver_ocotp component is included.
-- Configuring done (11.4s)
-- Generating done (0.7s)
-- Build files have been written to: C:/Users/ofirs/bsp/build
←[92m-- west build: building application
[1/293] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.0.99 (C:/Users/ofirs/bsp/zephyr), build: v4.0.0-5273-gaea9db6e1d08
[2/293] Generating ../build_info.yml
FAILED: build_info.yml C:/Users/ofirs/bsp/build/build_info.yml
C:\WINDOWS\system32\cmd.exe /C "cd /D C:\Users\ofirs\bsp\build\zephyr && "C:\Program Files\CMake\bin\cmake.exe" -DJSON_FILE="build_info_1.json" -DYAML_FILE="C:/Users/ofirs/bsp/build/build_info.yml" -DTEMP_FILES="build_info_1.json" -P C:/Users/ofirs/bsp/zephyr/cmake/yaml-filter.cmake"
-- Found Python3: C:/Python312/python.exe (found suitable version "3.12.3", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: C:/Users/ofirs/bsp/zephyr/cmake/..//.cache
CMake Error at C:/Users/ofirs/bsp/zephyr/cmake/modules/yaml.cmake:548 (string):
string sub-command JSON failed parsing json string: * Line 69, Column 24
Bad escape sequence in string
See Line 69, Column 1675 for detail.
.
Call Stack (most recent call first):
C:/Users/ofirs/bsp/zephyr/cmake/yaml-filter.cmake:27 (to_yaml)
[3/293] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' --build 'C:\Users\ofirs\bsp\build'
```</div>
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (17 by maintainers)
@tejlmand
where
PROJECT_PATHis set to project root:Discussed in release WG meeting and rising priority to release blocker as this sounds like this impacts multiple users.
@pillo79 I include the entire
includedirectory by addingtarget_include_directories(app PRIVATE include)in myCMakeLists.txt.Build output:
print_llext_cflags output:
print_llext_includes output:
@tejlmand On the latest Zephyr main branch, this issue is no longer reproducible (I assume recent changes have resolved it).
Which I guess will just downgrade this issue from medium to minor 😛
@pillo79 Right, it was not the file written to disk, but the input that was going into
GENERATE, but it is still the genex’es which seems to expand to some invalid JSON formatting, and thus breaking the build step, when that JSON is converted to yaml. Should have phrased it a bit different 😉@ofirshe thanks for the CMake trace.
Both from the original issue error log and your trace I have traced down the issue to be related to the generator expressions used by the llext subsys here: https://github.com/zephyrproject-rtos/zephyr/blob/ee37a94aa81f0f98879f615dd31c8cab4d322240/CMakeLists.txt#L2239
The genex expression is part of a
file(GENERATE ...)to create abuild_info_1.jsonwhich is processed at build time to create a finalbuild_info.yaml. The input to generating thebuild_info_1.jsonis:and it seems to be the expansion of the genex in
cmake::llext-edk::cflagsafaict that is causing the issue later, when converting to yaml.However, I cannot tell from the trace itself what the genex expanded into. So in order to see if there are some non-escaped special chars which impact the build stage I will need you to provide some extra details.
I have made a small a debug patch file to help further investigate this issue. Store the content as a file
debug_85774.patchand apply it using:This patch provides to custom targets which helps us understand exactly how the genex are expanded on your system. I have unfortunately not been able to reproduce on my Windows machine.
To get the expanded values, then run:
and provide the output in this issue.
You can also do it using
west build, likewest build -t print_llext_cflags( and-t print_llext_includes)after you have created the build directory.FYI @pillo79 seems we have some issues on Windows with expanding genex’es in certain cases.