Skip to content

Fix installed static MLX package on Windows#3848

Open
yingjiacai wants to merge 1 commit into
ml-explore:mainfrom
yingjiacai:fix/windows-static-install
Open

Fix installed static MLX package on Windows#3848
yingjiacai wants to merge 1 commit into
ml-explore:mainfrom
yingjiacai:fix/windows-static-install

Conversation

@yingjiacai

Copy link
Copy Markdown

Proposed changes

Fix the installed static MLX package on Windows so downstream CMake
projects can link against mlx.lib without requiring mlx.dll.

The changes:

  • Compile the dlfcn-win32 implementation directly into the static MLX
    library instead of exposing a FetchContent-only target to installed
    consumers.
  • Link the required Windows Psapi.lib system library.
  • Represent the downloaded OpenBLAS import library as an imported CMake
    target and install the .lib file.
  • Keep cudnn_frontend as a build-only dependency.
  • Reconstruct the required CUDA, cuDNN, and OpenBLAS dependencies in the
    installed MLX CMake package.

Testing

Manually verified on Windows using MSVC, Ninja, CUDA 13.0, and cuDNN 9.19:

  • Configured and built MLX with BUILD_SHARED_LIBS=OFF
  • Installed MLX successfully
  • Verified that mlx.lib is installed without requiring mlx.dll
  • Rebuilt and ran the downstream mlx_cpp_inference project against the
    installed static MLX package
  • Ran pre-commit run --all-files successfully

Checklist

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

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 this pull request may close these issues.

1 participant