From fba7f04ca01fb03fa7a55e22b0533b6e93325d77 Mon Sep 17 00:00:00 2001 From: jmorganca Date: Thu, 13 Feb 2025 22:43:07 -0800 Subject: [PATCH] ml/backend/ggml: optionally evaluate os.Executable() symlinks for Intel macOS hosts, optionally evaluate symlinks to os.Executable ahead of loading backends, fixing issues where 'ollama' is a symlink and is run manually in the command line --- ml/backend/ggml/ggml/src/ggml.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ml/backend/ggml/ggml/src/ggml.go b/ml/backend/ggml/ggml/src/ggml.go index 3920e37dc..3efe3f73a 100644 --- a/ml/backend/ggml/ggml/src/ggml.go +++ b/ml/backend/ggml/ggml/src/ggml.go @@ -47,6 +47,10 @@ var OnceLoad = sync.OnceFunc(func() { exe = "." } + if eval, err := filepath.EvalSymlinks(exe); err == nil { + exe = eval + } + // PATH, LD_LIBRARY_PATH, and DYLD_LIBRARY_PATH are often // set by the parent process, however, use a default value // if the environment variable is not set.