Skip to content

fix(lazy-deps): set CMAKE_POLICY_VERSION_MINIMUM=3.5 for native builds - #39816

Open
MwC-Trexx wants to merge 1 commit into
NousResearch:mainfrom
MwC-Trexx:fix/cmake4-policy-version-minimum
Open

fix(lazy-deps): set CMAKE_POLICY_VERSION_MINIMUM=3.5 for native builds#39816
MwC-Trexx wants to merge 1 commit into
NousResearch:mainfrom
MwC-Trexx:fix/cmake4-policy-version-minimum

Conversation

@MwC-Trexx

Copy link
Copy Markdown

Problem

On macOS 26 with cmake 4.x, ensure("platform.matrix") fails at the cmake configure step before it even gets to compile:

CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

cmake 4.x dropped support for cmake_minimum_required(VERSION < 3.5). python-olm 3.2.16 bundles libolm source with CMakeLists.txt declaring VERSION 3.4.

Fix

Set CMAKE_POLICY_VERSION_MINIMUM=3.5 in the build environment passed to uv/pip. cmake 4.x reads this env var and treats the project as though it declared the minimum as 3.5. One env key, no source patching, no platform gating.

Relationship to #31354

#31354 fixes the C++ const-pointer compile error in list.hh. This fixes the cmake configure error that fires before compilation starts. On macOS 26 / cmake 4.3.x, both are needed. Without this change, #31354's patched source build still aborts at the configure step.

Note: the subprocess in _python_olm_macos_install (added by #31354) doesn't pass an explicit env=, so it'll also need this fix when that PR merges — either inherit it from the calling process or pass env={**os.environ, "CMAKE_POLICY_VERSION_MINIMUM": "3.5"} directly.

Testing

# Fresh hermes venv, cmake 4.3.3, Apple clang 21.0.0 (macOS 26)
uv pip uninstall python-olm mautrix
CMAKE_POLICY_VERSION_MINIMUM=3.5 uv pip install "mautrix[encryption]==0.21.0"
# → installs cleanly; previously failed at cmake configure step

cmake 4.x dropped support for cmake_minimum_required(VERSION < 3.5).
python-olm 3.2.16 bundles libolm with a CMakeLists.txt that declares
VERSION 3.4, so any feature install that pulls in python-olm (currently
mautrix[encryption] for platform.matrix) fails to configure on macOS 26
with cmake 4.3.x:

  CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 has been removed from CMake.

CMAKE_POLICY_VERSION_MINIMUM=3.5 tells cmake 4.x to treat the project
as though it declared 3.5, which unblocks the configure step.

Complements NousResearch#31354 (C++ const-pointer patch): that PR fixes the compile
error; this one fixes the configure error that would prevent cmake from
even getting there on cmake 4.x.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have platform/matrix Matrix adapter (E2EE) dependencies Pull requests that update a dependency file labels Jun 5, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for isolating the CMake policy issue. The current lazy-install path has moved since this branch.

Problems

  • The change only adds the variable to uv_env (tools/lazy_deps.py:359 in this PR). On current main, if uv is absent or returns nonzero, the fallback at tools/lazy_deps.py:702 runs python -m pip install without env=, so it can still reach the same native build without CMAKE_POLICY_VERSION_MINIMUM.
  • Current main replaced the base branch's os.environ copy with hermes_subprocess_env(inherit_credentials=False) at tools/lazy_deps.py:659-661 in 9c6229ce; salvage should preserve that credential-safe environment.

Suggested changes

  • Add the policy variable to the current sanitized environment and pass it to both uv and pip install subprocesses.
  • Add tests that assert both installer tiers receive the variable.

Automated hermes-sweeper review.

Comment thread tools/lazy_deps.py

venv_root = Path(sys.executable).parent.parent
uv_env = {**os.environ, "VIRTUAL_ENV": str(venv_root)}
# cmake 4.x removed compatibility with cmake_minimum_required < 3.5.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please carry this explicit environment into the python -m pip install fallback as well. Current main's fallback runs without env= at tools/lazy_deps.py:702, so an unavailable or failed uv binary would still invoke CMake without this policy setting.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file P3 Low — cosmetic, nice to have platform/matrix Matrix adapter (E2EE) sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants