ml-explore / mlx

MLX: An array framework for Apple silicon
https://ml-explore.github.io/mlx/
MIT License
17.48k stars 1.01k forks source link

[BUG] Unable to build recent commits related to osx deployment #1602

Closed chimezie closed 6 days ago

chimezie commented 6 days ago

Describe the bug Getting an error while trying to build any commits beyond 073076ac7dce7cc36d4753d8cbb7bdbdf17a0f68 (i.e., commits beginning with 9d7fa6b - Use osx deployment target to pick Metal version related to #1595 and #1601)

To Reproduce

% git checkout master
% git pull
% pip install -U  .                                                         

Expected behavior A build without error

Desktop (please complete the following information):

Additional context The error is:

% pip install -U  .                                                         
Processing /path/to/mlx
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: mlx
  Building wheel for mlx (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for mlx (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [157 lines of output]
      running bdist_wheel
      running build
      running build_py
      copying python/mlx/_os_warning.py -> build/lib.macosx-10.9-universal2-cpython-311/mlx
      [..snip..]
      running build_ext
      CMake Warning at /private/var/folders/_7/1_8y8v7x0y94v6y52ryvrrhm0000gn/T/pip-build-env-dldgc7s1/overlay/lib/python3.11/site-packages/cmake/data/share/cmake-3.31/Modules/Platform/Darwin-Initialize.cmake:311 (message):
        Ignoring CMAKE_OSX_SYSROOT value:

         /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk

        because the directory does not exist.
      Call Stack (most recent call first):
        /private/var/folders/_7/1_8y8v7x0y94v6y52ryvrrhm0000gn/T/pip-build-env-dldgc7s1/overlay/lib/python3.11/site-packages/cmake/data/share/cmake-3.31/Modules/CMakeSystemSpecificInitialize.cmake:34 (include)
        CMakeLists.txt:3 (project)

      -- The C compiler identification is AppleClang 16.0.0.16000026
      -- The CXX compiler identification is AppleClang 16.0.0.16000026
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - failed
      -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
      -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - broken
      CMake Error at /private/var/folders/_7/1_8y8v7x0y94v6y52ryvrrhm0000gn/T/pip-build-env-dldgc7s1/overlay/lib/python3.11/site-packages/cmake/data/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message):
        The C compiler

          "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc"

        is not able to compile a simple test program.

        It fails with the following output:

          Change Dir: '/path/to/mlx/build/temp.macosx-10.9-universal2-cpython-311/mlx.core/CMakeFiles/CMakeScratch/TryCompile-uYqxst'

          Run Build Command(s): /private/var/folders/_7/1_8y8v7x0y94v6y52ryvrrhm0000gn/T/pip-build-env-dldgc7s1/overlay/lib/python3.11/site-packages/cmake/data/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_61bb6/fast
          /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_61bb6.dir/build.make CMakeFiles/cmTC_61bb6.dir/build
          Building C object CMakeFiles/cmTC_61bb6.dir/testCCompiler.c.o
          /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc   -arch arm64 -MD -MT CMakeFiles/cmTC_61bb6.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_61bb6.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_61bb6.dir/testCCompiler.c.o -c /path/to/mlx/build/temp.macosx-10.9-universal2-cpython-311/mlx.core/CMakeFiles/CMakeScratch/TryCompile-uYqxst/testCCompiler.c
          Linking C executable cmTC_61bb6
          /private/var/folders/_7/1_8y8v7x0y94v6y52ryvrrhm0000gn/T/pip-build-env-dldgc7s1/overlay/lib/python3.11/site-packages/cmake/data/bin/cmake -E cmake_link_script CMakeFiles/cmTC_61bb6.dir/link.txt --verbose=1
          ld: library 'System' not found
          cc: error: linker command failed with exit code 1 (use -v to see invocation)
          /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc  -arch arm64 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_61bb6.dir/testCCompiler.c.o -o cmTC_61bb6
          make[1]: *** [cmTC_61bb6] Error 1
          make: *** [cmTC_61bb6/fast] Error 2

        CMake will not be able to correctly generate this project.
      Call Stack (most recent call first):
        CMakeLists.txt:3 (project)

      -- Configuring incomplete, errors occurred!
      Traceback (most recent call last):
        File "/path/to/venv/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        [..snip..]
        File "/private/var/folders/_7/1_8y8v7x0y94v6y52ryvrrhm0000gn/T/pip-build-env-dldgc7s1/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 502, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 98, in build_extension
        File "/path/to/sytem/wide/Python/Versions/3.11/lib/python3.11/subprocess.py", line 571, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['cmake', '/path/to/mlx', '-DCMAKE_INSTALL_PREFIX=/path/to/mlx/build/lib.macosx-10.9-universal2-cpython-311/mlx/', '-DCMAKE_BUILD_TYPE=Release', '-DBUILD_SHARED_LIBS=ON', '-DMLX_BUILD_PYTHON_BINDINGS=ON', '-DMLX_BUILD_TESTS=OFF', '-DMLX_BUILD_BENCHMARKS=OFF', '-DMLX_BUILD_EXAMPLES=OFF', '-DMLX_PYTHON_BINDINGS_OUTPUT_DIRECTORY=/path/to/mlx/build/lib.macosx-10.9-universal2-cpython-311/mlx/', '-DMLX_VERSION=0.20.0.dev20241119+2419edd5']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mlx
Failed to build mlx
awni commented 6 days ago

Thanks for flagging, I believe #1601 closes this