[PR #8827] [MERGED] ml/backend/ggml: fix library loading on macOS amd64 #12785

Closed
opened 2026-04-13 00:09:36 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/8827
Author: @jmorganca
Created: 2/4/2025
Status: Merged
Merged: 2/4/2025
Merged by: @jmorganca

Base: mainHead: jmorganca/darwin-rpath


📝 Commits (5)

  • 9fab6ec ml/backend/ggml: fix library loading on macOS amd64
  • b104a6b set CMAKE_INSTALL_RPATH
  • 6db0446 use default path relative to exe
  • d70beda warn instead of erroring if os.Executable() fails
  • 807fd5c update comment casing

📊 Changes

4 files changed (+46 additions, -23 deletions)

View changed files

📝 CMakeLists.txt (+5 -0)
📝 llm/server.go (+9 -3)
📝 ml/backend/ggml/ggml/src/ggml.go (+29 -17)
📝 scripts/build_darwin.sh (+3 -3)

📄 Description

This PR fixes runtime library linking on macOS amd64 targets. macOS strips DYLD_LIBRARY and so using rpath is required. This PR sets the rpath for the dynamic libraries to the library's directory. It also changes the default lookup path when DYLD_LIBRARY_PATH isn't set on macOS to be the executable directory (it used to be the current working directory or ., which wouldn't work when running in an app bundle).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/8827 **Author:** [@jmorganca](https://github.com/jmorganca) **Created:** 2/4/2025 **Status:** ✅ Merged **Merged:** 2/4/2025 **Merged by:** [@jmorganca](https://github.com/jmorganca) **Base:** `main` ← **Head:** `jmorganca/darwin-rpath` --- ### 📝 Commits (5) - [`9fab6ec`](https://github.com/ollama/ollama/commit/9fab6ec29f7d17d650f357d1dba8f7e3538530df) ml/backend/ggml: fix library loading on macOS amd64 - [`b104a6b`](https://github.com/ollama/ollama/commit/b104a6b62835b78027af61009d7d2d5c9c07afdc) set CMAKE_INSTALL_RPATH - [`6db0446`](https://github.com/ollama/ollama/commit/6db0446c57a10fe999231e1b331b303d87058b10) use default path relative to exe - [`d70beda`](https://github.com/ollama/ollama/commit/d70bedafa4b26bc9d9c994b7475ceffb16132754) warn instead of erroring if os.Executable() fails - [`807fd5c`](https://github.com/ollama/ollama/commit/807fd5c000ecc203a92b2efb37ab64c340b5c728) update comment casing ### 📊 Changes **4 files changed** (+46 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+5 -0) 📝 `llm/server.go` (+9 -3) 📝 `ml/backend/ggml/ggml/src/ggml.go` (+29 -17) 📝 `scripts/build_darwin.sh` (+3 -3) </details> ### 📄 Description This PR fixes runtime library linking on macOS amd64 targets. macOS strips DYLD_LIBRARY and so using rpath is required. This PR sets the rpath for the dynamic libraries to the library's directory. It also changes the default lookup path when `DYLD_LIBRARY_PATH` isn't set on macOS to be the executable directory (it used to be the current working directory or `.`, which wouldn't work when running in an app bundle). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 00:09:36 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#12785