zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.88k stars 6.63k forks source link

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

Closed 0x6e closed 3 months ago

0x6e commented 4 months ago

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):

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: 487a8756c32320f0f1fbe1fbe342849ef89e7440

github-actions[bot] commented 4 months ago

Hi @0x6e! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

ycsin commented 4 months ago

Would you be able to share the full compile log & autoconf.h?

EDIT: nvm, I managed to reproduce this

west build -b native_sim -p auto zephyr/samples/hello_world/ -- -DCONFIG_CPP=y -DCONFIG_POSIX_API=y -DCONFIG_STD_CPP20=y -DCONFIG_REQUIRES_FULL_LIBCPP=y
ycsin commented 4 months ago

I'm not sure what is the root cause yet, it compiles fine if this line is disabled:

https://github.com/zephyrproject-rtos/zephyr/blob/6700a154be3ca29be50fb4f1e35d899de69be5ca/include/zephyr/net/socket.h#L1416

Can't really understand the magic here, cc @jukkar @cfriedt @rlubos

cfriedt commented 4 months ago

@ycsin - can you make a PR?

I think there likely won't be a problem if that line is removed

0x6e commented 4 months ago

Removing the specified line allows my project to build.

aescolar commented 4 months ago

Sorry to join the party late, I forgot about this issue. The issue here is that that kconfig combination leads to a non allowed kconfig setup. (POSIX_API enabled but using the host glibc . Due to CONFIG_REQUIRES_FULL_LIBCPP=y setting CONFIG_PICOLIBC_SUPPORTED to n). Note that even if the liked PR avoids the build error, you are very likely to end up with a not working executable, or one which is doing quite weird things.

0x6e commented 4 months ago

Wouldn't it be better to report this as an unsupported configuration then, rather just failing to compile with some obscure message?

aescolar commented 4 months ago

Wouldn't it be better to report this as an unsupported configuration then, rather just failing to compile with some obscure message?

Of course

0x6e commented 4 months ago

Is there an appropriate place to add such a check, and a place to add a test for this?

0x6e commented 4 months ago

I'm a bit frustrated that this has been closed as completed. The compiler error has just changed now that the #75351 has been merged:

[58/117] Building C object zephyr/lib/os/zvfs/CMakeFiles/lib__os__zvfs.dir/zvfs_eventfd.c.obj
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/to>/slint/examples/printerdemo_mcu/zephyr/build-native/zephyr/include/generated/zephyr -I<path/to>/zephyr/include -I<path/to>/slint/examples/printerdemo_mcu/zephyr/build-native/zephyr/include/generated -I<path/to>/zephyr/soc/native/inf_clock -I<path/to>/zephyr/boards/native/native_sim -I<path/to>/zephyr/scripts/native_simulator/common/src/include -I<path/to>/zephyr/scripts/native_simulator/native/src/include -g -Wshadow -fno-strict-aliasing -Os -imacros <path/to>/slint/examples/printerdemo_mcu/zephyr/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/to>/slint/examples/printerdemo_mcu/zephyr=CMAKE_SOURCE_DIR -fmacro-prefix-map=<path/to>/zephyr=ZEPHYR_BASE -fmacro-prefix-map=<path/to>=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/to>/zephyr/lib/os/zvfs/zvfs_eventfd.c
In file included from /usr/include/x86_64-linux-gnu/sys/socket.h:26,
                 from /usr/include/netinet/in.h:23,
                 from /usr/include/arpa/inet.h:22,
                 from <path/to>/zephyr/include/zephyr/net/socket.h:1406,
                 from <path/to>/zephyr/lib/os/zvfs/zvfs_eventfd.c:10:
/usr/include/x86_64-linux-gnu/bits/types/struct_iovec.h:26:8: error: redefinition of ‘struct iovec’
   26 | struct iovec
      |        ^~~~~
In file included from <path/to>/zephyr/include/zephyr/net/socket.h:29:
<path/to>/zephyr/include/zephyr/net/net_ip.h:240:8: note: originally defined here
  240 | struct iovec {
      |        ^~~~~
In file included from /usr/include/x86_64-linux-gnu/bits/socket.h:38,
                 from /usr/include/x86_64-linux-gnu/sys/socket.h:33:
/usr/include/x86_64-linux-gnu/bits/socket_type.h:26:3: error: redeclaration of enumerator ‘SOCK_STREAM’
   26 |   SOCK_STREAM = 1,              /* Sequenced, reliable, connection-based
      |   ^~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:85:9: note: previous definition of ‘SOCK_STREAM’ with type ‘enum net_sock_type’
   85 |         SOCK_STREAM = 1,           /**< Stream socket type   */
      |         ^~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/socket_type.h:29:3: error: redeclaration of enumerator ‘SOCK_DGRAM’
   29 |   SOCK_DGRAM = 2,               /* Connectionless, unreliable datagrams
      |   ^~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:86:9: note: previous definition of ‘SOCK_DGRAM’ with type ‘enum net_sock_type’
   86 |         SOCK_DGRAM,                /**< Datagram socket type */
      |         ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/socket_type.h:32:3: error: redeclaration of enumerator ‘SOCK_RAW’
   32 |   SOCK_RAW = 3,                 /* Raw protocol interface.  */
      |   ^~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:87:9: note: previous definition of ‘SOCK_RAW’ with type ‘enum net_sock_type’
   87 |         SOCK_RAW                   /**< RAW socket type      */
      |         ^~~~~~~~
/usr/include/x86_64-linux-gnu/bits/socket.h:183:8: error: redefinition of ‘struct sockaddr’
  183 | struct sockaddr
      |        ^~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:385:8: note: originally defined here
  385 | struct sockaddr {
      |        ^~~~~~~~
/usr/include/x86_64-linux-gnu/bits/socket.h:196:8: error: redefinition of ‘struct sockaddr_storage’
  196 | struct sockaddr_storage
      |        ^~~~~~~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:400:8: note: originally defined here
  400 | struct sockaddr_storage {
      |        ^~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/socket.h:262:8: error: redefinition of ‘struct msghdr’
  262 | struct msghdr
      |        ^~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:247:8: note: originally defined here
  247 | struct msghdr {
      |        ^~~~~~
/usr/include/x86_64-linux-gnu/bits/socket.h:280:8: error: redefinition of ‘struct cmsghdr’
  280 | struct cmsghdr
      |        ^~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:258:8: note: originally defined here
  258 | struct cmsghdr {
      |        ^~~~~~~
/usr/include/netinet/in.h:31:8: error: redefinition of ‘struct in_addr’
   31 | struct in_addr
      |        ^~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:151:8: note: originally defined here
  151 | struct in_addr {
      |        ^~~~~~~
/usr/include/netinet/in.h:42:5: error: redeclaration of enumerator ‘IPPROTO_IP’
   42 |     IPPROTO_IP = 0,        /* Dummy protocol for TCP.  */
      |     ^~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:63:9: note: previous definition of ‘IPPROTO_IP’ with type ‘enum net_ip_protocol’
   63 |         IPPROTO_IP = 0,            /**< IP protocol (pseudo-val for setsockopt() */
      |         ^~~~~~~~~~
/usr/include/netinet/in.h:44:5: error: redeclaration of enumerator ‘IPPROTO_ICMP’
   44 |     IPPROTO_ICMP = 1,      /* Internet Control Message Protocol.  */
      |     ^~~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:64:9: note: previous definition of ‘IPPROTO_ICMP’ with type ‘enum net_ip_protocol’
   64 |         IPPROTO_ICMP = 1,          /**< ICMP protocol   */
      |         ^~~~~~~~~~~~
/usr/include/netinet/in.h:46:5: error: redeclaration of enumerator ‘IPPROTO_IGMP’
   46 |     IPPROTO_IGMP = 2,      /* Internet Group Management Protocol. */
      |     ^~~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:65:9: note: previous definition of ‘IPPROTO_IGMP’ with type ‘enum net_ip_protocol’
   65 |         IPPROTO_IGMP = 2,          /**< IGMP protocol   */
      |         ^~~~~~~~~~~~
/usr/include/netinet/in.h:48:5: error: redeclaration of enumerator ‘IPPROTO_IPIP’
   48 |     IPPROTO_IPIP = 4,      /* IPIP tunnels (older KA9Q tunnels use 94).  */
      |     ^~~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:66:9: note: previous definition of ‘IPPROTO_IPIP’ with type ‘enum net_ip_protocol’
   66 |         IPPROTO_IPIP = 4,          /**< IPIP tunnels    */
      |         ^~~~~~~~~~~~
/usr/include/netinet/in.h:50:5: error: redeclaration of enumerator ‘IPPROTO_TCP’
   50 |     IPPROTO_TCP = 6,       /* Transmission Control Protocol.  */
      |     ^~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:67:9: note: previous definition of ‘IPPROTO_TCP’ with type ‘enum net_ip_protocol’
   67 |         IPPROTO_TCP = 6,           /**< TCP protocol    */
      |         ^~~~~~~~~~~
/usr/include/netinet/in.h:56:5: error: redeclaration of enumerator ‘IPPROTO_UDP’
   56 |     IPPROTO_UDP = 17,      /* User Datagram Protocol.  */
      |     ^~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:68:9: note: previous definition of ‘IPPROTO_UDP’ with type ‘enum net_ip_protocol’
   68 |         IPPROTO_UDP = 17,          /**< UDP protocol    */
      |         ^~~~~~~~~~~
/usr/include/netinet/in.h:64:5: error: redeclaration of enumerator ‘IPPROTO_IPV6’
   64 |     IPPROTO_IPV6 = 41,     /* IPv6 header.  */
      |     ^~~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:69:9: note: previous definition of ‘IPPROTO_IPV6’ with type ‘enum net_ip_protocol’
   69 |         IPPROTO_IPV6 = 41,         /**< IPv6 protocol   */
      |         ^~~~~~~~~~~~
/usr/include/netinet/in.h:94:5: error: redeclaration of enumerator ‘IPPROTO_RAW’
   94 |     IPPROTO_RAW = 255,     /* Raw IP packets.  */
      |     ^~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:71:9: note: previous definition of ‘IPPROTO_RAW’ with type ‘enum net_ip_protocol’
   71 |         IPPROTO_RAW = 255,         /**< RAW IP packets  */
      |         ^~~~~~~~~~~
/usr/include/netinet/in.h:113:5: error: redeclaration of enumerator ‘IPPROTO_ICMPV6’
  113 |     IPPROTO_ICMPV6 = 58,   /* ICMPv6.  */
      |     ^~~~~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:70:9: note: previous definition of ‘IPPROTO_ICMPV6’ with type ‘enum net_ip_protocol’
   70 |         IPPROTO_ICMPV6 = 58,       /**< ICMPv6 protocol */
      |         ^~~~~~~~~~~~~~
/usr/include/netinet/in.h:221:8: error: redefinition of ‘struct in6_addr’
  221 | struct in6_addr
      |        ^~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:139:8: note: originally defined here
  139 | struct in6_addr {
      |        ^~~~~~~~
/usr/include/netinet/in.h:237:30: error: conflicting types for ‘in6addr_any’; have ‘const struct in6_addr’
  237 | extern const struct in6_addr in6addr_any;        /* :: */
      |                              ^~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:420:30: note: previous declaration of ‘in6addr_any’ with type ‘const struct in6_addr’
  420 | extern const struct in6_addr in6addr_any;
      |                              ^~~~~~~~~~~
/usr/include/netinet/in.h:238:30: error: conflicting types for ‘in6addr_loopback’; have ‘const struct in6_addr’
  238 | extern const struct in6_addr in6addr_loopback;   /* ::1 */
      |                              ^~~~~~~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:423:30: note: previous declaration of ‘in6addr_loopback’ with type ‘const struct in6_addr’
  423 | extern const struct in6_addr in6addr_loopback;
      |                              ^~~~~~~~~~~~~~~~
/usr/include/netinet/in.h:247:8: error: redefinition of ‘struct sockaddr_in’
  247 | struct sockaddr_in
      |        ^~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:186:8: note: originally defined here
  186 | struct sockaddr_in {
      |        ^~~~~~~~~~~
/usr/include/netinet/in.h:262:8: error: redefinition of ‘struct sockaddr_in6’
  262 | struct sockaddr_in6
      |        ^~~~~~~~~~~~
<path/to>/zephyr/include/zephyr/net/net_ip.h:178:8: note: originally defined here
  178 | struct sockaddr_in6 {
      |        ^~~~~~~~~~~~
/usr/include/netinet/in.h:311:8: error: redefinition of ‘struct ipv6_mreq’
  311 | struct ipv6_mreq
      |        ^~~~~~~~~
<path/to>/zephyr/include/zephyr/net/socket.h:1280:8: note: originally defined here
 1280 | struct ipv6_mreq {
      |        ^~~~~~~~~
In file included from <path/to>/zephyr/include/zephyr/net/net_ip.h:27:
<path/to>/zephyr/include/zephyr/sys/byteorder.h:23:34: error: expected declaration specifiers or ‘...’ before ‘(’ token
   23 | #define BSWAP_32(x) ((uint32_t) ((((x) >> 24) & 0xff) | \
      |                                  ^
<path/to>/zephyr/include/zephyr/sys/byteorder.h:19:34: error: expected declaration specifiers or ‘...’ before ‘(’ token
   19 | #define BSWAP_16(x) ((uint16_t) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
      |                                  ^
<path/to>/zephyr/include/zephyr/sys/byteorder.h:23:34: error: expected declaration specifiers or ‘...’ before ‘(’ token
   23 | #define BSWAP_32(x) ((uint32_t) ((((x) >> 24) & 0xff) | \
      |                                  ^
<path/to>/zephyr/include/zephyr/sys/byteorder.h:19:34: error: expected declaration specifiers or ‘...’ before ‘(’ token
   19 | #define BSWAP_16(x) ((uint16_t) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
      |                                  ^
[90/117] Building C object zephyr/kernel/CMakeFiles/kernel.dir/work.c.obj
ninja: build stopped: subcommand failed.

I've tried to various configuration options, but as far as I can tell CONFIG_REQUIRES_FULL_LIBCPP=y and CONFIG_POSIX_API=y are incompatible options. Is that really the case? That seems to be quite a regression considering that this configuration previously worked...

cfriedt commented 4 months ago

@0x6e - it's unfortunately still necessary to workaround the existing dependency cycle between networking and posix (CONFIG_NET_SOCKETS_POSIX_NAMES, deprecated) and also avoid pulling in host headers when building for native_sim.

Fix is just going through CI.

0x6e commented 3 months ago

Thank you very much @cfriedt your changes work for me.