Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake update appears to break compilation #453

Open
fnmut opened this issue Mar 28, 2025 · 5 comments
Open

Cmake update appears to break compilation #453

fnmut opened this issue Mar 28, 2025 · 5 comments

Comments

@fnmut
Copy link

fnmut commented Mar 28, 2025

I'm seeing this error during a build:

22.60     | CMake Error at src/h3lib/CMakeLists.txt:15 (cmake_minimum_required):
22.60     |   Compatibility with CMake < 3.5 has been removed from CMake.
22.60     |
22.60     |   Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
22.60     |   to tell CMake that the project requires at least <min> but has been updated
22.60     |   to work with policies introduced by <max> or earlier.
22.60     |
22.60     |   Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.

It appears cmake updated yesterday to version 4.0. I think this introduces this compatibility issue.

@ajfriend
Copy link
Contributor

Thanks for flagging! For now, I suppose we can just handle this by pinning the cmake version < 4

@ajfriend
Copy link
Contributor

Actually, how are you building this? I didn't run into the issue building locally just now.

@BenDRoberson
Copy link

BenDRoberson commented Mar 31, 2025

I am seeing this error in a CI build as well but I'm using an older version of h3 and not cmake version 4.0+.

  • my image is based on Ubuntu 20.04
  • h3 version is 3.7.7 - but works on versions >=4 for me. We have some dependencies that don't work on 4.0+ hence version 3.7.7
  • cmake version 3.16.3

error is exactly the same and I was able to make it build by updating the minimum version for cmake:

  • CMAKE_POLICY_VERSION_MINIMUM=3.5 allows it to build successfully
  • Alternatively manually updating src/h3lib/CMakeLists.txt to a minimum version of 3.5 with a find-replace also worked.

Looks like older h3-py builds didn't explicitly set the minimum and that's probably causing the problem - maybe cmake changed from just a warning to an error recently?

@fnmut
Copy link
Author

fnmut commented Mar 31, 2025

maybe cmake changed from just a warning to an error recently?

Yep it appears that is the case, and PyPi cmake got updated to 4.0 late last week.

Your suggestion to use CMAKE_POLICY_VERSION_MINIMUM=3.5 does resolve the issue though, so thank you.

but I'm using an older version of h3 and not cmake version 4.0+

We're also using an older version (3.7.6). The error output contains:

8.483     | An error occurred while configuring with CMake.
8.483     |   Command:
8.483     |     /tmp/tmp_tk0bqml/.venv/lib/python3.12/site-packages/cmake/data/bin/cmake /tmp/tmpupm7xrjn/h3-3.7.6

Which made me think it was using a version installed to /tmp. I made several attempts on Friday to get h3 to use a locally installed cmake (whether through system packages or PyPi) and it did not seem to want to use anything else. It's very possible I missed something obvious though.

Looks like older h3-py builds didn't explicitly set the minimum and that's probably causing the problem

My understanding is that's what this is, but it doesn't seem to be respected...

Actually, how are you building this? I didn't run into the issue building locally just now.

Here is a minimal repro dockerfile:

FROM python:3.12

RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python3 - && \
    cd /usr/local/bin && \
    ln -s /opt/poetry/bin/poetry && \
    poetry config virtualenvs.create false
                                                           WORKDIR /app

RUN poetry init --name "my_project" \
    --python "^3.12" \
    --no-interaction

RUN poetry add h3==3.7.6

docker buildx build --platform linux/amd64 .

edit:

In fact, the poetry stuff is unnecessary, it looks like you just can't install the older versions in a clean environment.

FROM python:3.12

WORKDIR /app

RUN pip install h3==3.7.6

@BenDRoberson
Copy link

Looks like older h3-py builds didn't explicitly set the minimum and that's probably causing the problem

My understanding is that's what this is, but it doesn't seem to be respected...

You're right I should have been more explicit - looks like the syntax changed from cmake_minimum_required(VERSION 3.7.2) to cmake_minimum_required(VERSION 3.15...3.26). For some reason the version seems to be respected now when you give both a min and a max, but isn't in the old version (at least as best I can tell right now)

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

No branches or pull requests

3 participants