Browse Source

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
jmorganca 2 months ago
parent
commit
fba7f04ca0
1 changed files with 4 additions and 0 deletions
  1. 4 0
      ml/backend/ggml/ggml/src/ggml.go

+ 4 - 0
ml/backend/ggml/ggml/src/ggml.go

@@ -47,6 +47,10 @@ var OnceLoad = sync.OnceFunc(func() {
 		exe = "."
 		exe = "."
 	}
 	}
 
 
+	if eval, err := filepath.EvalSymlinks(exe); err == nil {
+		exe = eval
+	}
+
 	// PATH, LD_LIBRARY_PATH, and DYLD_LIBRARY_PATH are often
 	// PATH, LD_LIBRARY_PATH, and DYLD_LIBRARY_PATH are often
 	// set by the parent process, however, use a default value
 	// set by the parent process, however, use a default value
 	// if the environment variable is not set.
 	// if the environment variable is not set.