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

[BUG] Build fails with -DMLX_BUILD_PYTHON_BINDINGS=ON #1796

Closed
NAThompson opened this issue Jan 26, 2025 · 1 comment · Fixed by #1799
Closed

[BUG] Build fails with -DMLX_BUILD_PYTHON_BINDINGS=ON #1796

NAThompson opened this issue Jan 26, 2025 · 1 comment · Fixed by #1799

Comments

@NAThompson
Copy link
Contributor

Describe the bug

Following the C++ build instructions and defining -DMLX_BUILD_PYTHON_BINDINGS=ON, I get:

CMake Error at python/src/CMakeLists.txt:33 (set_target_properties):
  set_target_properties called with incorrect number of arguments.

To Reproduce

(venv_mlx) ➜  build git:(main) git log
commit 0cea88bcc5e98e81a24d92eed8870a6976999f05 (HEAD -> main, origin/main, origin/HEAD)
Author: Nick <[email protected]>
Date:   Sat Jan 25 16:02:36 2025 -0800

    Use @ matrix multiplication syntax to document matrix-matrix multiplication (#1793)

    Co-authored-by: Nick Thompson <[email protected]>
(venv_mlx) ➜  build git:(main) cmake -DMLX_BUILD_PYTHON_BINDINGS=ON ../
-- Building MLX for arm64 processor on Darwin
-- Building METAL sources
-- Building with macOS SDK version 15.2

-- Accelerate found /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk/System/Library/Frameworks/Accelerate.framework
-- Checking for module 'mpi-c'
--   Package 'mpi-c' not found
-- Could NOT find MPI_C (missing: MPI_C_LIB_NAMES MPI_C_HEADER_DIR MPI_C_WORKS)
-- Checking for module 'mpi-cxx'
--   Package 'mpi-cxx' not found
-- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_HEADER_DIR MPI_CXX_WORKS)
-- Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND)
-- Downloading json
-- Using the multi-header code from /Users/nathompson7/mlx/build/_deps/json-src/include/
-- Downloading gguflib
-- Version: 10.2.1
-- Build type:
-- Building Python bindings.
CMake Error at python/src/CMakeLists.txt:33 (set_target_properties):
  set_target_properties called with incorrect number of arguments.


CMake Deprecation Warning at build/_deps/doctest-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Configuring incomplete, errors occurred!

Expected behavior

No error or actionable error message.

Desktop (please complete the following information):

  • OS Version: [e.g. MacOS 14.1.2]
  • Version [e.g. 0.7.0]
@NAThompson
Copy link
Contributor Author

I believe this gets us close to the problem:

diff --git a/python/src/CMakeLists.txt b/python/src/CMakeLists.txt
index bcba3a8..d623bfd 100644
--- a/python/src/CMakeLists.txt
+++ b/python/src/CMakeLists.txt
@@ -30,6 +30,10 @@ if(NOT MLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY)
   set(MLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
 endif()

+if(NOT DEFINED LIBRARY_OUTPUT_DIRECTORY)
+    message(WARNING "LIBRARY_OUTPUT_DIRECTORY is undefined")
+endif()
+
 set_target_properties(
   core
   PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${MLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY}

With this patch applied, we get:

CMake Warning at python/src/CMakeLists.txt:34 (message):
  LIBRARY_OUTPUT_DIRECTORY is undefined


CMake Error at python/src/CMakeLists.txt:37 (set_target_properties):
  set_target_properties called with incorrect number of arguments.

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 a pull request may close this issue.

1 participant