[GH-ISSUE #480] Build failure with v0.0.18 #77896

Closed
opened 2026-05-08 20:03:43 -05:00 by GiteaMirror · 8 comments
Owner

Originally created by @p-linnane on GitHub (Sep 6, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/480

Hello 👋 . I'm a maintainer for the Homebrew project. While packaging v0.0.18 of ollama, we're encountering a build failure. Here is the error:

go build -trimpath -o=/home/linuxbrew/.linuxbrew/Cellar/ollama/0.0.18/bin/ollama -ldflags=-s -w
  go: downloading github.com/spf13/cobra v1.7.0
  go: downloading github.com/chzyer/readline v1.5.1
  go: downloading github.com/dustin/go-humanize v1.0.1
  go: downloading github.com/olekukonko/tablewriter v0.0.5
  go: downloading golang.org/x/crypto v0.10.0
  go: downloading github.com/mattn/go-runewidth v0.0.14
  go: downloading github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
  go: downloading golang.org/x/term v0.10.0
  go: downloading github.com/gin-contrib/cors v1.4.0
  go: downloading github.com/gin-gonic/gin v1.9.1
  go: downloading golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
  go: downloading gonum.org/v1/gonum v0.13.0
  go: downloading github.com/spf13/pflag v1.0.5
  go: downloading github.com/rivo/uniseg v0.2.0
  go: downloading golang.org/x/sys v0.11.0
  go: downloading github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
  go: downloading github.com/gin-contrib/sse v0.1.0
  go: downloading github.com/mattn/go-isatty v0.0.19
  go: downloading golang.org/x/net v0.10.0
  go: downloading github.com/go-playground/validator/v10 v10.14.0
  go: downloading github.com/pelletier/go-toml/v2 v2.0.8
  go: downloading github.com/ugorji/go/codec v1.2.11
  go: downloading google.golang.org/protobuf v1.30.0
  go: downloading gopkg.in/yaml.v3 v3.0.1
  go: downloading github.com/gabriel-vasile/mimetype v1.4.2
  go: downloading github.com/go-playground/universal-translator v0.18.1
  go: downloading github.com/leodido/go-urn v1.2.4
  go: downloading golang.org/x/text v0.10.0
  go: downloading github.com/go-playground/locales v0.14.1
  llm/ggml_llama.go:31:12: pattern llama.cpp/ggml/build/*/bin/*: no matching files found

Relates to https://github.com/Homebrew/homebrew-core/pull/141639

Originally created by @p-linnane on GitHub (Sep 6, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/480 Hello 👋 . I'm a maintainer for the [Homebrew](https://brew.sh) project. While packaging v0.0.18 of ollama, we're encountering a build failure. Here is the error: ```shell go build -trimpath -o=/home/linuxbrew/.linuxbrew/Cellar/ollama/0.0.18/bin/ollama -ldflags=-s -w go: downloading github.com/spf13/cobra v1.7.0 go: downloading github.com/chzyer/readline v1.5.1 go: downloading github.com/dustin/go-humanize v1.0.1 go: downloading github.com/olekukonko/tablewriter v0.0.5 go: downloading golang.org/x/crypto v0.10.0 go: downloading github.com/mattn/go-runewidth v0.0.14 go: downloading github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db go: downloading golang.org/x/term v0.10.0 go: downloading github.com/gin-contrib/cors v1.4.0 go: downloading github.com/gin-gonic/gin v1.9.1 go: downloading golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 go: downloading gonum.org/v1/gonum v0.13.0 go: downloading github.com/spf13/pflag v1.0.5 go: downloading github.com/rivo/uniseg v0.2.0 go: downloading golang.org/x/sys v0.11.0 go: downloading github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 go: downloading github.com/gin-contrib/sse v0.1.0 go: downloading github.com/mattn/go-isatty v0.0.19 go: downloading golang.org/x/net v0.10.0 go: downloading github.com/go-playground/validator/v10 v10.14.0 go: downloading github.com/pelletier/go-toml/v2 v2.0.8 go: downloading github.com/ugorji/go/codec v1.2.11 go: downloading google.golang.org/protobuf v1.30.0 go: downloading gopkg.in/yaml.v3 v3.0.1 go: downloading github.com/gabriel-vasile/mimetype v1.4.2 go: downloading github.com/go-playground/universal-translator v0.18.1 go: downloading github.com/leodido/go-urn v1.2.4 go: downloading golang.org/x/text v0.10.0 go: downloading github.com/go-playground/locales v0.14.1 llm/ggml_llama.go:31:12: pattern llama.cpp/ggml/build/*/bin/*: no matching files found ``` Relates to https://github.com/Homebrew/homebrew-core/pull/141639
GiteaMirror added the bug label 2026-05-08 20:03:43 -05:00
Author
Owner

@mxyng commented on GitHub (Sep 6, 2023):

Hi @p-linnane. There's been some changes to how ollama is operates which requires (slightly) different build steps. Starting 0.0.18, it's necessary to call go generate ./... before go build . which will populate the build directories shown in the log outputs. go generate requires cmake so that'll need to be a build dependency.

Alternatively, you can pull the binary artifacts directly from GitHub releases.

<!-- gh-comment-id:1709219076 --> @mxyng commented on GitHub (Sep 6, 2023): Hi @p-linnane. There's been some changes to how ollama is operates which requires (slightly) different build steps. Starting 0.0.18, it's necessary to call `go generate ./...` before `go build .` which will populate the build directories shown in the log outputs. `go generate` requires `cmake` so that'll need to be a build dependency. Alternatively, you can pull the binary artifacts directly from GitHub releases.
Author
Owner

@p-linnane commented on GitHub (Sep 6, 2023):

Thank you for the quick response @mxyng. I've adjusted our build process to match what you provided. We were able to successfully build on Linux, macOS 12, and macOS 13. The build on macOS 11 failed though. Is building on macOS 11 supported by ollama?

Here is the GitHub Actions run, and here is the error for reference:

 [ 36%] Built target BUILD_INFO
  In file included from /tmp/ollama-20230907-5642-1jaaga7/llm/llama.cpp/ggml/ggml.c:248:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h:24:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h:289:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h:26:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:43:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfiguration.h:12:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:49:
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOTypes.h:81:49: error: expected ';' after top level declarator
  typedef mach_vm_address_t       IOVirtualAddress __kernel_ptr_semantics;
                                                  ^
                                                  ;
  In file included from /tmp/ollama-20230907-5642-1jaaga7/llm/llama.cpp/ggml/ggml.c:248:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h:24:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h:289:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h:26:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:43:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfiguration.h:12:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:52:
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h:120:53: error: expected ';' after top level declarator
  typedef natural_t OSAsyncReference[kOSAsyncRefCount] __kernel_ptr_semantics;
                                                      ^
                                                      ;
  2 errors generated.
  make[3]: *** [CMakeFiles/ggml.dir/ggml.c.o] Error 1
  make[2]: *** [CMakeFiles/ggml.dir/all] Error 2
  make[1]: *** [examples/server/CMakeFiles/server.dir/rule] Error 2
  make: *** [server] Error 2
  llm/llama.cpp/generate_darwin_amd64.go:10: running "cmake": exit status 2
<!-- gh-comment-id:1709244264 --> @p-linnane commented on GitHub (Sep 6, 2023): Thank you for the quick response @mxyng. I've adjusted our build process to match what you provided. We were able to successfully build on Linux, macOS 12, and macOS 13. The build on macOS 11 failed though. Is building on macOS 11 supported by ollama? [Here](https://github.com/Homebrew/homebrew-core/actions/runs/6103230879) is the GitHub Actions run, and here is the error for reference: ```shell [ 36%] Built target BUILD_INFO In file included from /tmp/ollama-20230907-5642-1jaaga7/llm/llama.cpp/ggml/ggml.c:248: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h:24: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h:289: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h:26: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:43: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfiguration.h:12: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:49: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOTypes.h:81:49: error: expected ';' after top level declarator typedef mach_vm_address_t IOVirtualAddress __kernel_ptr_semantics; ^ ; In file included from /tmp/ollama-20230907-5642-1jaaga7/llm/llama.cpp/ggml/ggml.c:248: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h:24: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h:289: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h:26: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:43: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfiguration.h:12: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:52: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h:120:53: error: expected ';' after top level declarator typedef natural_t OSAsyncReference[kOSAsyncRefCount] __kernel_ptr_semantics; ^ ; 2 errors generated. make[3]: *** [CMakeFiles/ggml.dir/ggml.c.o] Error 1 make[2]: *** [CMakeFiles/ggml.dir/all] Error 2 make[1]: *** [examples/server/CMakeFiles/server.dir/rule] Error 2 make: *** [server] Error 2 llm/llama.cpp/generate_darwin_amd64.go:10: running "cmake": exit status 2 ```
Author
Owner

@jmorganca commented on GitHub (Sep 6, 2023):

Hi @p-linnane thanks for maintaining this brew formula. Sorry this caused an issue. We do have a pre-built binary that might make things a bit easier as @mxyng mentioned. It's published with our GitHub releases.

That said, re this error, it seems to be using another version of the MacOS SDK (12.1) even though it's on macOS 11.

From the logs:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:52:
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h:120:53: error: expected ';' after top level declarator
  typedef natural_t OSAsyncReference[kOSAsyncRefCount] __kernel_ptr_semantics;

Do you know if there's a way to force it to use the MacOSX11 sdk?

<!-- gh-comment-id:1709255509 --> @jmorganca commented on GitHub (Sep 6, 2023): Hi @p-linnane thanks for maintaining this brew formula. Sorry this caused an issue. We do have a pre-built binary that might make things a bit easier as @mxyng mentioned. It's published with our GitHub releases. That said, re this error, it seems to be using another version of the MacOS SDK (12.1) even though it's on macOS 11. From the logs: ``` In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:52: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h:120:53: error: expected ';' after top level declarator typedef natural_t OSAsyncReference[kOSAsyncRefCount] __kernel_ptr_semantics; ``` Do you know if there's a way to force it to use the `MacOSX11` sdk?
Author
Owner

@p-linnane commented on GitHub (Sep 6, 2023):

We require everything to be built from source in our core repository, so that's why we aren't using the pre-built binaries.

We utilize the latest SDK available for the underlying OS. 12.1 is the final release for macOS 11, which is why we use that. We utilize the 13.1 SDK on macOS 12 for the same reasons, and that built fine. I'm wondering if some kind of change was made that broke compatibility with the older OS.

<!-- gh-comment-id:1709261780 --> @p-linnane commented on GitHub (Sep 6, 2023): We require everything to be built from source in our core repository, so that's why we aren't using the pre-built binaries. We utilize the latest SDK available for the underlying OS. [12.1 is the final release for macOS 11](https://developer.apple.com/support/xcode/), which is why we use that. We utilize the 13.1 SDK on macOS 12 for the same reasons, and that built fine. I'm wondering if some kind of change was made that broke compatibility with the older OS.
Author
Owner

@jmorganca commented on GitHub (Sep 6, 2023):

@p-linnane makes sense, I've got a big sur box handy let me keep digging into this

<!-- gh-comment-id:1709262247 --> @jmorganca commented on GitHub (Sep 6, 2023): @p-linnane makes sense, I've got a big sur box handy let me keep digging into this
Author
Owner

@jmorganca commented on GitHub (Sep 7, 2023):

@p-linnane this seems similar: https://github.com/llvm/llvm-project/issues/54988

On first look it seems like is setting the environment variables to use the 11.0 SDK, yet the errors show it's importing 12.1

CMAKE_INCLUDE_PATH: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
  CMAKE_LIBRARY_PATH: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
  PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/11
  HOMEBREW_GIT: /usr/bin/git
  HOMEBREW_SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk

Do you know where these env vars get set? Setting these to 12.1 might fix the issue. Similar issue here: https://github.com/llvm/llvm-project/issues/54988

<!-- gh-comment-id:1709286585 --> @jmorganca commented on GitHub (Sep 7, 2023): @p-linnane this seems similar: https://github.com/llvm/llvm-project/issues/54988 On first look it seems like is setting the environment variables to use the 11.0 SDK, yet the errors show it's importing 12.1 ``` CMAKE_INCLUDE_PATH: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers CMAKE_LIBRARY_PATH: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/11 HOMEBREW_GIT: /usr/bin/git HOMEBREW_SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk ``` Do you know where these env vars get set? Setting these to 12.1 might fix the issue. Similar issue here: https://github.com/llvm/llvm-project/issues/54988
Author
Owner

@p-linnane commented on GitHub (Sep 7, 2023):

Thanks for the pointer. We were able to fix it by setting the SDKROOT variable on macOS 11.

<!-- gh-comment-id:1709410879 --> @p-linnane commented on GitHub (Sep 7, 2023): Thanks for the pointer. We were able to fix it by setting the `SDKROOT` variable on macOS 11.
Author
Owner

@jmorganca commented on GitHub (Sep 7, 2023):

Awesome. Thanks for debugging this 😊

<!-- gh-comment-id:1709426173 --> @jmorganca commented on GitHub (Sep 7, 2023): Awesome. Thanks for debugging this 😊
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#77896