Skip to content

Commit a1a6619

Browse files
stephanosiocfriedt
authored andcommitted
cmake: Do not include zephyr_stdint.h for native POSIX archs
This commit updates the Zephyr build system such that it does not include the `zephyr_stdint.h`, which tries to define Zephyr's own type system, when compiling for the native POSIX architecture. The native POSIX architecture compiles with the host toolchain and headers, and there can be conflicts if we arbitrarily define our own type system (e.g. mismatch between the types and the specifiers defined in `inttypes.h`). Note that this is not meant to be a permanent fix; instead, it is meant to serve as a temporary workaround until we no longer need to define our own type system. For more details, refer to the issue #37718. Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent ac029cf commit a1a6619

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,12 @@ zephyr_compile_options($<$<COMPILE_LANGUAGE:ASM>:$<TARGET_PROPERTY:asm,required>
237237

238238
# @Intent: Enforce standard integer type correspondance to match Zephyr usage.
239239
# (must be after compiler specific flags)
240-
zephyr_compile_options("SHELL: $<TARGET_PROPERTY:compiler,imacros> ${ZEPHYR_BASE}/include/toolchain/zephyr_stdint.h")
240+
if(NOT CONFIG_ARCH_POSIX)
241+
# `zephyr_stdint.h` is not included for the POSIX (native) arch because it
242+
# compiles with the host toolchain/headers and there can be conflicts if we
243+
# arbitrarily redefine our own type system (see #37718).
244+
zephyr_compile_options("SHELL: $<TARGET_PROPERTY:compiler,imacros> ${ZEPHYR_BASE}/include/toolchain/zephyr_stdint.h")
245+
endif()
241246

242247
# Common toolchain-agnostic assembly flags
243248
zephyr_compile_options(

0 commit comments

Comments
 (0)