Skip to content

fatal error: sys/_timespec.h: No such file or directory with v3.7.0-rc2 #75319

@0x6e

Description

@0x6e

I've started a discussion regarding this issue, but received no feedback so far.

Describe the bug
Compiling my application with v3.7.0-rc2 fails to build:

FAILED: zephyr/lib/os/zvfs/CMakeFiles/lib__os__zvfs.dir/zvfs_eventfd.c.obj 
ccache /usr/bin/gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=1024 -D__ZEPHYR__=1 -I<path>/build-native/zephyr/include/generated/zephyr -I<path>/zephyr/include -I<path>/build-native/zephyr/include/generated -I<path>/zephyr/soc/native/inf_clock -I<path>/zephyr/boards/native/native_sim -I<path>/zephyr/scripts/native_simulator/common/src/include -I<path>/zephyr/scripts/native_simulator/native/src/include -g -Wshadow -fno-strict-aliasing -Os -imacros <path>/build-native/zephyr/include/generated/zephyr/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=<path>/slint/examples/printerdemo_mcu/zephyr=CMAKE_SOURCE_DIR -fmacro-prefix-map=<path>/zephyr=ZEPHYR_BASE -fmacro-prefix-map=<path>=WEST_TOPDIR -ffunction-sections -fdata-sections -m64 -fPIC -fvisibility=hidden -fno-freestanding -std=c11 -MD -MT zephyr/lib/os/zvfs/CMakeFiles/lib__os__zvfs.dir/zvfs_eventfd.c.obj -MF zephyr/lib/os/zvfs/CMakeFiles/lib__os__zvfs.dir/zvfs_eventfd.c.obj.d -o zephyr/lib/os/zvfs/CMakeFiles/lib__os__zvfs.dir/zvfs_eventfd.c.obj -c <path>/zephyr/lib/os/zvfs/zvfs_eventfd.c
In file included from <path>/zephyr/include/zephyr/toolchain.h:50,
                 from <path>/zephyr/include/zephyr/kernel_includes.h:23,
                 from <path>/zephyr/include/zephyr/kernel.h:17,
                 from <path>/zephyr/lib/os/zvfs/zvfs_eventfd.c:9:
<path>/zephyr/include/zephyr/posix/posix_types.h:51:21: error: ‘pthread_attr_t’ undeclared here (not in a function); did you mean ‘pthread_attr’?
   51 | BUILD_ASSERT(sizeof(pthread_attr_t) >= sizeof(struct pthread_attr));
      |                     ^~~~~~~~~~~~~~
<path>/zephyr/include/zephyr/toolchain/gcc.h:87:52: note: in definition of macro ‘BUILD_ASSERT’
   87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
      |                                                    ^~~~
<path>/zephyr/include/zephyr/toolchain/gcc.h:87:51: error: expression in static assertion is not an integer
   87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
      |                                                   ^
<path>/zephyr/include/zephyr/posix/posix_types.h:51:1: note: in expansion of macro ‘BUILD_ASSERT’
   51 | BUILD_ASSERT(sizeof(pthread_attr_t) >= sizeof(struct pthread_attr));
      | ^~~~~~~~~~~~
<path>/zephyr/include/zephyr/posix/posix_types.h:70:21: error: ‘pthread_mutexattr_t’ undeclared here (not in a function); did you mean ‘pthread_mutexattr’?
   70 | BUILD_ASSERT(sizeof(pthread_mutexattr_t) >= sizeof(struct pthread_mutexattr));
      |                     ^~~~~~~~~~~~~~~~~~~
<path>/zephyr/include/zephyr/toolchain/gcc.h:87:52: note: in definition of macro ‘BUILD_ASSERT’
   87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
      |                                                    ^~~~
<path>/zephyr/include/zephyr/toolchain/gcc.h:87:51: error: expression in static assertion is not an integer
   87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
      |                                                   ^
<path>/zephyr/include/zephyr/posix/posix_types.h:70:1: note: in expansion of macro ‘BUILD_ASSERT’
   70 | BUILD_ASSERT(sizeof(pthread_mutexattr_t) >= sizeof(struct pthread_mutexattr));
      | ^~~~~~~~~~~~
<path>/zephyr/include/zephyr/posix/posix_types.h:83:21: error: ‘pthread_condattr_t’ undeclared here (not in a function); did you mean ‘pthread_condattr’?
   83 | BUILD_ASSERT(sizeof(pthread_condattr_t) >= sizeof(struct pthread_condattr));
      |                     ^~~~~~~~~~~~~~~~~~
<path>/zephyr/include/zephyr/toolchain/gcc.h:87:52: note: in definition of macro ‘BUILD_ASSERT’
   87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
      |                                                    ^~~~
<path>/zephyr/include/zephyr/toolchain/gcc.h:87:51: error: expression in static assertion is not an integer
   87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
      |                                                   ^
<path>/zephyr/include/zephyr/posix/posix_types.h:83:1: note: in expansion of macro ‘BUILD_ASSERT’
   83 | BUILD_ASSERT(sizeof(pthread_condattr_t) >= sizeof(struct pthread_condattr));
      | ^~~~~~~~~~~~
<path>/zephyr/include/zephyr/posix/posix_types.h:107:21: error: ‘pthread_once_t’ undeclared here (not in a function); did you mean ‘pthread_once’?
  107 | BUILD_ASSERT(sizeof(pthread_once_t) >= sizeof(struct pthread_once));
      |                     ^~~~~~~~~~~~~~
<path>/zephyr/include/zephyr/toolchain/gcc.h:87:52: note: in definition of macro ‘BUILD_ASSERT’
   87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
      |                                                    ^~~~
<path>/zephyr/include/zephyr/toolchain/gcc.h:87:51: error: expression in static assertion is not an integer
   87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
      |                                                   ^
<path>/zephyr/include/zephyr/posix/posix_types.h:107:1: note: in expansion of macro ‘BUILD_ASSERT’
  107 | BUILD_ASSERT(sizeof(pthread_once_t) >= sizeof(struct pthread_once));
      | ^~~~~~~~~~~~
In file included from <path>/zephyr/include/zephyr/posix/unistd.h:20,
                 from <path>/zephyr/include/zephyr/net/socket.h:1416,
                 from <path>/zephyr/lib/os/zvfs/zvfs_eventfd.c:10:
<path>/zephyr/include/zephyr/posix/sys/stat.h:40:10: fatal error: sys/_timespec.h: No such file or directory
   40 | #include <sys/_timespec.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.

To Reproduce
I wasn't able to find any existing samples that set CONFIG_POSIX_API=y which also failed to build.

Note

Edited by @ycsin

west build -b native_sim -p auto samples/hello_world/ -- -DCONFIG_CPP=y -DCONFIG_POSIX_API=y -DCONFIG_STD_CPP20=y -DCONFIG_REQUIRES_FULL_LIBCPP=y

Expected behavior
The applicaiton should compile.

Impact
Cannot update to v3.7.0-rc2 (or future versions).

Environment (please complete the following information):

  • OS: Ubuntu 24.04
  • Toolchain: Zephyr SDK 0.16.8
  • v3.7.0-rc2

Additional context
Git bisect shows the breakage is introduced by the following change: 487a8756c32320f0f1fbe1fbe342849ef89e7440 posix: eventfd: fix dependency cycle between net and posix.

Edited by cfriedt. link to commit:
487a875

Metadata

Metadata

Assignees

Labels

area: POSIXPOSIX API LibrarybugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions