Skip to content

Add Zephyr 4.1+ build compatibility for wolfssl_tls_sock sample.#9765

Open
night1rider wants to merge 14 commits intowolfSSL:masterfrom
night1rider:zephyr-4_3_0-posix-fix
Open

Add Zephyr 4.1+ build compatibility for wolfssl_tls_sock sample.#9765
night1rider wants to merge 14 commits intowolfSSL:masterfrom
night1rider:zephyr-4_3_0-posix-fix

Conversation

@night1rider
Copy link
Contributor

@night1rider night1rider commented Feb 12, 2026

Add Zephyr 4.1+ build compatibility for wolfssl_tls_sock sample

Problem

The wolfssl_tls_sock sample fails to build on Zephyr >= 4.1. Zephyr deprecated CONFIG_PTHREAD_IPC, CONFIG_POSIX_CLOCK, and CONFIG_NET_SOCKETS_POSIX_NAMES in 3.7 (v3.7.0 release notes) and removed them by 4.1 (PR #82398), which the sample depended on. Additionally, Zephyr's min()/max() macros in sys/util.h collide with wolfSSL's static inline definitions.

Solution

  • Version-conditional Kconfig: CMakeLists.txt now parses $ZEPHYR_BASE/VERSION and selects either zephyr_legacy.conf (< 4.1) or zephyr_v4.1.conf (>= 4.1) via EXTRA_CONF_FILE.
  • zephyr_legacy.conf: Original options for Zephyr < 4.1. These were deprecated in 3.7 (v3.7.0 release notes - POSIX deprecations) and removed by 4.1 (PR #82398):
    • CONFIG_PTHREAD_IPC=y
    • CONFIG_POSIX_CLOCK=y
    • CONFIG_NET_SOCKETS_POSIX_NAMES=y
  • zephyr_v4.1.conf: Replacement options for Zephyr >= 4.1:
  • user_settings.h: Added WOLFSSL_HAVE_MIN/WOLFSSL_HAVE_MAX to prevent macro collision with Zephyr's sys/util.h (all versions).

Testing

Successfully compiled wolfssl_tls_sock on Zephyr 4.3 with zephyr-sdk-0.17.4 for both native_sim and frdm_rw612/rw612 targets.

Compatibility

Zephyr Version Kconfig Fragment
< 4.1 zephyr_legacy.conf
>= 4.1 zephyr_v4.1.conf

TODO

  • Add CI workflow to build wolfssl_tls_sock against multiple Zephyr versions to catch compatibility regressions in future releases.
  • Investigate more about the min/max issue and create a better solution

@night1rider night1rider self-assigned this Feb 13, 2026
@night1rider
Copy link
Contributor Author

Jenkins retest this please

@night1rider night1rider force-pushed the zephyr-4_3_0-posix-fix branch 2 times, most recently from b5f11c7 to bd4a6a9 Compare March 5, 2026 21:07
@night1rider night1rider force-pushed the zephyr-4_3_0-posix-fix branch 2 times, most recently from c5d0add to 103d90b Compare March 6, 2026 06:59
…, reposition sys/types.h, and add missing macros to tracking list.

Update benchmark app for native sim to use a sleep function for the timer, and remove timer for waiting on server and instead use a share variable both threads can access.
@night1rider night1rider force-pushed the zephyr-4_3_0-posix-fix branch from 103d90b to e47c696 Compare March 6, 2026 07:02
@night1rider
Copy link
Contributor Author

Jenkins retest this please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant