From c3fff12f2b6911f1ab96e2a42bbdae13f3ec460d Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 18 May 2026 00:17:25 -0600 Subject: [PATCH] fix(ollama): fix macOS segfault and exclude mlx/rocm/jetpack variants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - pkg_link called webi_link which called pkg_link — infinite recursion causing SIGSEGV on macOS; fixed by switching to WEBI_SINGLE-style paths so the template's webi_link handles symlinking directly - macOS pkg_src now points to the flat ollama binary (not ./bin/ollama) - mlx, rocm, jetpack5, jetpack6 tagged as variants so generic installs get the standard build instead of a GPU-specific one --- internal/releases/ollama/variants.go | 11 ++-------- ollama/install.sh | 32 +++++++++------------------- ollama/releases.conf | 2 +- 3 files changed, 13 insertions(+), 32 deletions(-) diff --git a/internal/releases/ollama/variants.go b/internal/releases/ollama/variants.go index 224edc9..f061cb9 100644 --- a/internal/releases/ollama/variants.go +++ b/internal/releases/ollama/variants.go @@ -1,7 +1,4 @@ // Package ollama provides variant tagging for Ollama releases. -// -// Ollama publishes GPU accelerator builds: -rocm (AMD), -jetpack5 -// and -jetpack6 (NVIDIA Jetson). package ollamadist import ( @@ -11,14 +8,10 @@ import ( ) // TagVariants tags ollama-specific build variants. +// Suffix variants (mlx, rocm, jetpack5, jetpack6) are handled by the +// conf-driven loop in classifypkg.TagVariants; this handles the rest. func TagVariants(assets []storage.Asset) { for i := range assets { - lower := strings.ToLower(assets[i].Filename) - for _, v := range []string{"rocm", "jetpack5", "jetpack6"} { - if strings.Contains(lower, "-"+v) { - assets[i].Variants = append(assets[i].Variants, v) - } - } // Ollama-darwin.zip (capital O) is the macOS .app bundle. // Installable by Go (extract .app), but not in legacy cache. if strings.HasPrefix(assets[i].Filename, "Ollama-") { diff --git a/ollama/install.sh b/ollama/install.sh index 2d0100f..c731a52 100644 --- a/ollama/install.sh +++ b/ollama/install.sh @@ -13,35 +13,33 @@ __init_ollama() { pkg_cmd_name="ollama" pkg_dst_dir="${HOME}/.local/opt/ollama" - pkg_dst="${pkg_dst_dir}" + pkg_dst_cmd="${HOME}/.local/bin/ollama" pkg_src_dir="${HOME}/.local/opt/ollama-v${WEBI_VERSION}" - pkg_src="${pkg_src_dir}" - - # linux default: bin/ollama + lib/ollama/ hierarchy - pkg_dst_cmd="${HOME}/.local/opt/ollama/bin/ollama" pkg_src_cmd="${HOME}/.local/opt/ollama-v${WEBI_VERSION}/bin/ollama" my_os=$(uname -s) if test "Darwin" = "${my_os}"; then - pkg_dst_cmd="${HOME}/.local/opt/ollama/ollama" + pkg_dst_cmd="${HOME}/.local/bin/ollama" pkg_src_cmd="${HOME}/.local/opt/ollama-v${WEBI_VERSION}/ollama" fi + pkg_dst="${pkg_dst_cmd}" + pkg_src="${pkg_src_cmd}" + # pkg_install must be defined by every package pkg_install() { - if test -f ./ollama; then - # macOS tgz: flat — bare binary + dylibs/mlx backends in root - mkdir -p "${pkg_src_dir}" - mv ./* "${pkg_src_dir}/" - chmod a+x "${pkg_src_cmd}" - elif test -d ./bin; then + if test -d ./bin; then # linux tar.zst: bin/ollama + lib/ollama/ mkdir -p "${pkg_src_dir}" mv ./bin "${pkg_src_dir}/bin" if test -d ./lib; then mv ./lib "${pkg_src_dir}/lib" fi + elif test -f ./ollama; then + # macOS tgz: flat — bare binary + dylibs/mlx backends in root + mkdir -p "${pkg_src_dir}" + mv ./* "${pkg_src_dir}/" elif test -d ./Ollama.app; then # macOS zip: install app bundle to /Applications mv -f ./Ollama.app /Applications/Ollama.app @@ -49,22 +47,12 @@ __init_ollama() { # older bare binary format mkdir -p "$(dirname "${pkg_src_cmd}")" mv ./ollama-* "${pkg_src_cmd}" - chmod a+x "${pkg_src_cmd}" else echo "error: unrecognized ollama archive format" >&2 return 1 fi } - pkg_link() { - if test -d /Applications/Ollama.app; then - mkdir -p "${HOME}/.local/bin" - ln -sf /Applications/Ollama.app/Contents/Resources/ollama "${HOME}/.local/bin/ollama" - return 0 - fi - webi_link - } - pkg_get_current_version() { # 'ollama --version' has output in this format: # ollama version is 0.3.10 diff --git a/ollama/releases.conf b/ollama/releases.conf index bf5fcb1..eb48a2d 100644 --- a/ollama/releases.conf +++ b/ollama/releases.conf @@ -1,2 +1,2 @@ github_releases = jmorganca/ollama -variants = rocm jetpack5 jetpack6 +variants = mlx rocm jetpack5 jetpack6