Skip to content

Conversation

@zephyrbot
Copy link

@zephyrbot zephyrbot commented Jul 27, 2024

Backport d080847~5..d080847 from #75849.

Fixes #75319

cfriedt added 5 commits July 27, 2024 12:18
This reverts commit 269729a.

Signed-off-by: Chris Friedt <[email protected]>
(cherry picked from commit 6a0593d)
A corner case involving C++, posix, networking, and native_sim
was causing problems.

Even though C and C++ builds should include zephyr/posix/.. in
the default search path with `CONFIG_POSIX_API=y`, for some
reason, the native compiler pulls in /usr/include first anyway.

The stat.h header pulled in <sys/types.h> (which is normally
fine) but due to the native build, it was pulling in
/usr/include/sys/types.h, from the host toolchain.

Explicitly include <zephyr/posix/posix_types.h> instead of
<sys/types.h> from stat.h, and continue using the workarounds
for native builds (explicitly including zephyr/posix/arpa/net.h
from net/sockets.h .

Signed-off-by: Chris Friedt <[email protected]>
(cherry picked from commit 81f5205)
A number of types such as uid_t, gitd_t, etc, were defined in
sys/stat.h to workaround compatibility issues many years ago.

Since posix_types.h is slated to become equivalent to
sys/types.h in terms of standard headers, move these types
to where they belong.

For more information, please see

https://pubs.opengroup.org/onlinepubs/9699919799/\
 basedefs/sys_types.h.html

Signed-off-by: Chris Friedt <[email protected]>
(cherry picked from commit 6667b50)
Simplify the conditions for pthread type declaration

Signed-off-by: Chris Friedt <[email protected]>
(cherry picked from commit 6cf557d)
Prior to the fixes in the previous commits, combining a build
for native_sim with

CONFIG_CPP=y
CONFIG_POSIX_API=y
CONFIG_STD_CPP20=y
CONFIG_REQUIRES_FULL_LIBCPP=y

would fail.

It succeeds now.

This change adds a testcase to monitor that scenario in CI.

Note: this was partially necessary because the deprecation of
CONFIG_NET_SOCKETS_POSIX_NAMES is not yet complete, so there
is a dependency cycle, and also because <sys/types.h> was
pulling in the host <sys/types.h> instead of Zephyr's or one
of the embedded OSes we support.

Signed-off-by: Chris Friedt <[email protected]>
(cherry picked from commit d080847)
@zephyrbot zephyrbot added Backport Backport PR and backport failure issues area: POSIX POSIX API Library area: Networking labels Jul 27, 2024
@nashif nashif merged commit 905f22b into v3.7-branch Aug 6, 2024
@nashif nashif deleted the backport-75849-to-v3.7-branch branch August 6, 2024 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Networking area: POSIX POSIX API Library Backport Backport PR and backport failure issues

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants