Skip to content

LAPACKE build on macOS is not compatible with CMake 4 #1726

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

Open
dime10 opened this issue May 7, 2025 · 5 comments
Open

LAPACKE build on macOS is not compatible with CMake 4 #1726

dime10 opened this issue May 7, 2025 · 5 comments

Comments

@dime10
Copy link
Contributor

dime10 commented May 7, 2025

Building the runtime on macOS with cmake 4 installed produces the following error:

Cloning into 'reference-lapack-src'...
HEAD is now at 77a0ceb6c Merge pull request #382 from vladimir-ch/lapacke/dlantr-no-alloc-trans
CMake Error at /catalyst/runtime/build/_lapacke-accelerate/src/lapacke-accelerate-build/_deps/reference-lapack-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

  Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.

The upstream project in question uses the following line, which is no longer compatible with cmake 4:

cmake_minimum_required(VERSION 3.2)

In the meantime, we might have to require CMake < 4 in Catalyst to warn users early about the incompatibility.
Eventually, we'll have to find a way to update the dependency to use a more recent CMake version 🤔

@dime10
Copy link
Contributor Author

dime10 commented May 7, 2025

I guess reference lapack repo has since upgraded to a higher version
https://github.com/Reference-LAPACK/lapack/blob/master/CMakeLists.txt#L1,
but the project we use to build lapacke for us has not
https://github.com/lepus2589/accelerate-lapacke/blob/master/CMakeLists.txt#L26.

@lepus2589
Copy link

lepus2589 commented May 8, 2025

You can't simply pull in a more recent version of Reference LAPACK, because it contains v3.12.1. The LAPACKE library from v3.12.1 could require symbols, that Mac OS 15 Sequoia's Accelerate doesn't provide, causing linking errors.

I discussed this here lepus2589/accelerate-lapacke#4 and also provided a workaround here lepus2589/accelerate-lapacke#5.

Unfortunately, CMake v4 has introduced quite some incompatibilities and as the CMake version is not available in presets, you also can't use conditional presets to fix this.

@lepus2589
Copy link

I see you're directly including my project via ExternalProject_Add(). My workaround doesn't really help there, because it requires user intervention (modifying CMakeUserPresets.json).

The initial project was not intended for direct inclusion. But I'm happy to support alternative approaches or additional changes, that make direct inclusion more convenient. Let me know what would help the most.

@dime10
Copy link
Contributor Author

dime10 commented May 8, 2025

@lepus2589 Thanks for the fast update on this! I don't have a good idea right now on how to best approach it, but if I think of something I'll get back to you, appreciate the support :)

@lepus2589
Copy link

I did some refactoring to the project and integrated the CMake v4 check into the code. Nothing else should have changed for you as a consumer.

Unfortunately, I can't really do anything about CMAKE_OSX_SYSROOT. This is explicitly meant to be configured by the end user on their machine per the CMake docs.

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

2 participants