Skip to content

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

@SkybuckFlying

Description

@SkybuckFlying

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions