Skip to content

mbedtls-openipc: CMAKE_POLICY_VERSION_MINIMUM=3.5 - #2257

Closed
shipa-2 wants to merge 1 commit into
OpenIPC:masterfrom
shipa-2:pr/mbedtls-cmake-policy
Closed

mbedtls-openipc: CMAKE_POLICY_VERSION_MINIMUM=3.5#2257
shipa-2 wants to merge 1 commit into
OpenIPC:masterfrom
shipa-2:pr/mbedtls-cmake-policy

Conversation

@shipa-2

@shipa-2 shipa-2 commented Aug 11, 2026

Copy link
Copy Markdown

Summary

  • Set -DCMAKE_POLICY_VERSION_MINIMUM=3.5 so mbedtls-openipc configures on newer host CMake.

Test plan

  • make BOARD=gk7102_lite (or any board using mbedtls-openipc) configures mbedtls without CMake policy errors

Part of splitting #2256.

Made with Cursor

Newer host CMake rejects old mbedtls without an explicit policy floor.

Co-authored-by: Cursor <cursoragent@cursor.com>
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

mbedtls-openipc: set CMAKE_POLICY_VERSION_MINIMUM=3.5 for newer host CMake

🐞 Bug fix ⚙️ Configuration changes 🕐 Less than 5 minutes

Grey Divider

AI Description

• Add a CMake policy minimum version to avoid configure failures with newer host CMake.
• Keep mbedtls-openipc build options unchanged while improving forward compatibility.
Diagram

graph TD
  A["mbedtls-openipc.mk"] --> B["CMake configure opts"] --> C["Host CMake"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Patch upstream CMakeLists.txt (cmake_minimum_required / policies)
  • ➕ Fixes policy behavior at the source for all consumers, not just Buildroot packaging
  • ➕ Keeps policy logic closer to the project’s build system
  • ➖ Requires maintaining and rebasing a local patch against upstream mbedtls
  • ➖ May have broader behavioral impact than a packaging-only opt-in flag
2. Pin/limit host CMake version in the build environment
  • ➕ Avoids modifying package configuration flags
  • ➕ Can be applied globally in CI containers
  • ➖ Does not help developers with newer local CMake
  • ➖ Increases maintenance burden and reduces forward compatibility

Recommendation: Current approach is a good packaging-level fix: it resolves the immediate configure breakage on newer host CMake with minimal blast radius. Consider an upstream/patch-based solution only if more CMake policy issues appear that can’t be cleanly handled via configure flags.

Files changed (1) +2 / -1

Bug fix (1) +2 / -1
mbedtls-openipc.mkPass CMAKE_POLICY_VERSION_MINIMUM=3.5 to mbedtls-openipc CMake configure +2/-1

Pass CMAKE_POLICY_VERSION_MINIMUM=3.5 to mbedtls-openipc CMake configure

• Extends the package’s CMake configure options to set a minimum policy version of 3.5. This prevents configuration failures when building with newer host CMake versions that reject older policy defaults.

general/package/mbedtls-openipc/mbedtls-openipc.mk

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@widgetii widgetii left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for splitting this out of #2256 — the diagnosis is right (mbedtls 2.25.0 really does die on CMake 4.x), but I believe this change is redundant: master already fixes CMake 4.x policy compat globally, for every package at once.

Already fixed in Makefile:7

export CMAKE_POLICY_VERSION_MINIMUM := 3.5

Added in 656094d"Fix build with modern host toolchains (GCC 15, CMake 4.x)" (#1978). That line is present on origin/master and on this PR's own branch.

Three things I checked rather than assumed, with host cmake 4.3.3:

  1. The failure is real. Configuring mbedtls-openipc-2.25.0 (cmake_minimum_required(VERSION 2.8.12)) bare → Compatibility with CMake < 3.5 has been removed from CMake. Hard error, as you say.
  2. The env var alone is sufficient. Same tree, CMAKE_POLICY_VERSION_MINIMUM=3.5 cmake -S … -B … with no -DBuild files have been written to. CMake honours it as an environment variable, not only as a -D cache entry.
  3. The export actually reaches cmake. Buildroot's pkg-cmake.mk CONFIGURE_CMDS sets PATH and the PKG_CONFIG_* vars but never scrubs the environment (no env -i), so the top-level export propagates into every target and host cmake invocation.

So the -D here duplicates a value cmake already has. Harmless, but not load-bearing.

It would also be incomplete on its own

Even without the global export, patching mbedtls alone wouldn't get a board to build. Packages using cmake-package whose sources declare min < 3.5:

package cmake_minimum_required boards enabling
mbedtls-openipc 2.25.0 2.8.12 93 ← this PR
libwebsockets-openipc 4.2.2 2.8.12 18 ← would fail next
mini / aura-httpd / usrsctp 2.8.12 / 2.8 / 3.0 0 (dormant)

Clean: aws-webrtc 3.6.3, libsrtp 3.21, baresip/libre 3.14, fdk-aac 3.5.1, yaml-cli 3.5, ipctool/jsonfilter 3.10. lzo (3.0) and libubox (2.6) are sub-3.5 cmake packages but enabled on no board. libzlib/libyaml/libcurl/libogg/opus have low minimums but build via generic/autotools infra, so cmake never runs on them.

That gap is itself the argument for keeping this global rather than per-package.

Minor

  • The test plan checkbox is unticked and no checks have run on the branch yet — gcc-compat.yml triggers on general/package/**/*.mk, so it should fire once approved.
  • Unrelated to this PR, but worth its own issue: mbedtls 2.25.0 is from Dec 2020 and long past EOL, shipping TLS on 93 boards.

If you are hitting a configure failure on current master, could you paste the error and your cmake --version? That would point at something the global export isn't covering, which would be worth fixing properly.

-DENABLE_PROGRAMS=$(if $(BR2_PACKAGE_MBEDTLS_OPENIPC_PROGRAMS),ON,OFF) \
-DENABLE_TESTING=OFF
-DENABLE_TESTING=OFF \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already covered globally, so this line is a no-op in practice.

Makefile:7 on master has:

export CMAKE_POLICY_VERSION_MINIMUM := 3.5

(from 656094d / #1978). CMake honours CMAKE_POLICY_VERSION_MINIMUM as an environment variable as well as a -D cache entry, and Buildroot's pkg-cmake.mk CONFIGURE_CMDS doesn't scrub the environment — so the export already reaches this package's cmake invocation.

Verified with host cmake 4.3.3 against the extracted mbedtls-openipc-2.25.0 tree:

$ cmake -S mbedtls-openipc-2.25.0 -B /tmp/a
CMake Error at CMakeLists.txt:23 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

$ CMAKE_POLICY_VERSION_MINIMUM=3.5 cmake -S mbedtls-openipc-2.25.0 -B /tmp/c
-- Configuring done (0.7s)
-- Generating done (0.2s)
-- Build files have been written to: /tmp/c

The env-var form (which master already sets) is enough on its own.

@widgetii

Copy link
Copy Markdown
Member

This thread is closed as no response has been received

@widgetii widgetii closed this Aug 16, 2026
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.

2 participants