#1486·ggml

Windows build fails due to MLX backend (undefined symbols, no Windows build tags)

Author: SkybuckFlyingCreated May 12, 2026Updated Jun 22, 2026

I attempted to build Ollama from source on Windows 11 using Go 1.26 and Visual Studio 2022.

Even with CGO disabled (GGML-only) or CGO enabled (CUDA), the build always fails because the MLX backend is compiled on Windows. MLX is Apple-only (Metal), but the code has no build tags to exclude it on non-darwin platforms.

Errors include: undefined: mlx.Array undefined: mlx.NewArray undefined: mlx.AsType undefined: mlx.LoadSafetensorsNative ... (hundreds more)

This happens even when using: go build -tags ggml go build -tags cuda

The MLX code under x/mlxrunner/mlx is always included because it has no build constraints like: //go:build darwin or //go:build !windows

As a result, the open-source repo cannot be built on Windows at all.

The official Windows binary works, but the source code in this repo does not match the Windows build pipeline.

Expected behavior:

  • MLX should be excluded on Windows
  • GGML-only and CUDA builds should work
  • Windows should have proper build tags

Actual behavior:

  • MLX is always compiled
  • Build fails with undefined MLX symbols
  • No way to disable MLX via tags

Please add proper build constraints for MLX or provide a Windows-compatible build path.