[GH-ISSUE #1712] Ollama version #967

Closed
opened 2026-04-12 10:39:49 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @xyproto on GitHub (Dec 25, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/1712

Hi, maintainer of the Arch Linux ollama package here.

ollama --version is "0.0.0" after building Ollama from source on Arch Linux. Is this intentional? Is there something this PKGBUILD is missing?

Thanks in advance.

pkgname=ollama
pkgdesc='Create, run and share large language models (LLMs)'
pkgver=0.1.17
pkgrel=2
arch=(x86_64)
url='https://github.com/jmorganca/ollama'
license=(MIT)
makedepends=(cmake git go setconf)
_ollamacommit=6b5bdfa6c9321405174ad443f21c2e41db36a867 # tag: v0.1.17
# The git submodule commit hashes are here:
# https://github.com/jmorganca/ollama/tree/v0.1.17/llm/llama.cpp
_ggmlcommit=9e232f0234073358e7031c1b8d7aa45020469a3b
_ggufcommit=a7aee47b98e45539d491071b25778b833b77e387
source=(git+$url#commit=$_ollamacommit
        ggml::git+https://github.com/ggerganov/llama.cpp#commit=$_ggmlcommit
        gguf::git+https://github.com/ggerganov/llama.cpp#commit=$_ggufcommit
        sysusers.conf
        tmpfiles.d
        ollama.service)
b2sums=('SKIP'
        'SKIP'
        'SKIP'
        '3aabf135c4f18e1ad745ae8800db782b25b15305dfeaaa031b4501408ab7e7d01f66e8ebb5be59fc813cfbff6788d08d2e48dcf24ecc480a40ec9db8dbce9fec'
        'c890a741958d31375ebbd60eeeb29eff965a6e1e69f15eb17ea7d15b575a4abee176b7d407b3e1764aa7436862a764a05ad04bb9901a739ffd81968c09046bb6'
        'a773bbf16cf5ccc2ee505ad77c3f9275346ddf412be283cfeaee7c2e4c41b8637a31aaff8766ed769524ebddc0c03cf924724452639b62208e578d98b9176124')

prepare() {
  cd $pkgname

  rm -frv llm/llama.cpp/gg{ml,uf}

  # Copy git submodule files instead of symlinking because the build process is sensitive to symlinks.
  cp -r "$srcdir/ggml" llm/llama.cpp/ggml
  cp -r "$srcdir/gguf" llm/llama.cpp/gguf

  # Do not git clone when "go generate" is being run.
  sed -i 's,git submodule,true,g' llm/llama.cpp/generate_linux.go

  # Do not build with CUDA, but turn LTO on
  sed -i 's,LLAMA_CUBLAS=on,LLAMA_LTO=on,g' llm/llama.cpp/generate_linux.go

  # Set build mode to release
  sed -i '33s/DebugMode/ReleaseMode/;45s/DebugMode/ReleaseMode/' "$srcdir/ollama/server/routes.go"
}

build() {
  cd $pkgname
  export CGO_CFLAGS="$CFLAGS" CGO_CPPFLAGS="$CPPFLAGS" CGO_CXXFLAGS="$CXXFLAGS" CGO_LDFLAGS="$LDFLAGS"
  go generate ./...
  go build -buildmode=pie -trimpath -mod=readonly -modcacherw -ldflags=-linkmode=external -ldflags=-buildid=''
}


check() {
  cd ${pkgname/-cuda}
  go test ./...
}

package() {
  install -Dm755 $pkgname/$pkgname "$pkgdir/usr/bin/$pkgname"
  install -dm700 "$pkgdir/var/lib/ollama"
  install -Dm644 ollama.service "$pkgdir/usr/lib/systemd/system/ollama.service"
  install -Dm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/ollama.conf"
  install -Dm644 tmpfiles.d "$pkgdir/usr/lib/tmpfiles.d/ollama.conf"
  install -Dm644 $pkgname/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
Originally created by @xyproto on GitHub (Dec 25, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/1712 Hi, maintainer of the Arch Linux [`ollama`](https://gitlab.archlinux.org/archlinux/packaging/packages/ollama/) package here. `ollama --version` is "0.0.0" after building Ollama from source on Arch Linux. Is this intentional? Is there something this `PKGBUILD` is missing? Thanks in advance. ```bash pkgname=ollama pkgdesc='Create, run and share large language models (LLMs)' pkgver=0.1.17 pkgrel=2 arch=(x86_64) url='https://github.com/jmorganca/ollama' license=(MIT) makedepends=(cmake git go setconf) _ollamacommit=6b5bdfa6c9321405174ad443f21c2e41db36a867 # tag: v0.1.17 # The git submodule commit hashes are here: # https://github.com/jmorganca/ollama/tree/v0.1.17/llm/llama.cpp _ggmlcommit=9e232f0234073358e7031c1b8d7aa45020469a3b _ggufcommit=a7aee47b98e45539d491071b25778b833b77e387 source=(git+$url#commit=$_ollamacommit ggml::git+https://github.com/ggerganov/llama.cpp#commit=$_ggmlcommit gguf::git+https://github.com/ggerganov/llama.cpp#commit=$_ggufcommit sysusers.conf tmpfiles.d ollama.service) b2sums=('SKIP' 'SKIP' 'SKIP' '3aabf135c4f18e1ad745ae8800db782b25b15305dfeaaa031b4501408ab7e7d01f66e8ebb5be59fc813cfbff6788d08d2e48dcf24ecc480a40ec9db8dbce9fec' 'c890a741958d31375ebbd60eeeb29eff965a6e1e69f15eb17ea7d15b575a4abee176b7d407b3e1764aa7436862a764a05ad04bb9901a739ffd81968c09046bb6' 'a773bbf16cf5ccc2ee505ad77c3f9275346ddf412be283cfeaee7c2e4c41b8637a31aaff8766ed769524ebddc0c03cf924724452639b62208e578d98b9176124') prepare() { cd $pkgname rm -frv llm/llama.cpp/gg{ml,uf} # Copy git submodule files instead of symlinking because the build process is sensitive to symlinks. cp -r "$srcdir/ggml" llm/llama.cpp/ggml cp -r "$srcdir/gguf" llm/llama.cpp/gguf # Do not git clone when "go generate" is being run. sed -i 's,git submodule,true,g' llm/llama.cpp/generate_linux.go # Do not build with CUDA, but turn LTO on sed -i 's,LLAMA_CUBLAS=on,LLAMA_LTO=on,g' llm/llama.cpp/generate_linux.go # Set build mode to release sed -i '33s/DebugMode/ReleaseMode/;45s/DebugMode/ReleaseMode/' "$srcdir/ollama/server/routes.go" } build() { cd $pkgname export CGO_CFLAGS="$CFLAGS" CGO_CPPFLAGS="$CPPFLAGS" CGO_CXXFLAGS="$CXXFLAGS" CGO_LDFLAGS="$LDFLAGS" go generate ./... go build -buildmode=pie -trimpath -mod=readonly -modcacherw -ldflags=-linkmode=external -ldflags=-buildid='' } check() { cd ${pkgname/-cuda} go test ./... } package() { install -Dm755 $pkgname/$pkgname "$pkgdir/usr/bin/$pkgname" install -dm700 "$pkgdir/var/lib/ollama" install -Dm644 ollama.service "$pkgdir/usr/lib/systemd/system/ollama.service" install -Dm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/ollama.conf" install -Dm644 tmpfiles.d "$pkgdir/usr/lib/tmpfiles.d/ollama.conf" install -Dm644 $pkgname/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } ```
Author
Owner

@igorschlum commented on GitHub (Dec 25, 2023):

Hi @xyproto brew install ollama doesn't install the last version of ollama and show 0.0.0 as version number with ollama --version so this issue could be similar to https://github.com/jmorganca/ollama/issues/1638

<!-- gh-comment-id:1869155427 --> @igorschlum commented on GitHub (Dec 25, 2023): Hi @xyproto brew install ollama doesn't install the last version of ollama and show 0.0.0 as version number with ollama --version so this issue could be similar to https://github.com/jmorganca/ollama/issues/1638
Author
Owner

@xyproto commented on GitHub (Dec 26, 2023):

@igorschlum Ollama in Homebrew is only at 0.1.15 / 0.1.16 so I don't believe it's representative for this issue.

Manual modification of the version number may be needed for the 0.1.15 or 0.1.16 Homebrew package: https://github.com/Homebrew/homebrew-core/pull/157426#issuecomment-1862806511

And this may break the 0.1.17 go tests (because they check if the version is 0.0.0).

Fixing --version should ideally not be handled when packaging the software.

<!-- gh-comment-id:1869184270 --> @xyproto commented on GitHub (Dec 26, 2023): @igorschlum Ollama in Homebrew is only at 0.1.15 / 0.1.16 so I don't believe it's representative for this issue. Manual modification of the version number may be needed for the 0.1.15 or 0.1.16 Homebrew package: https://github.com/Homebrew/homebrew-core/pull/157426#issuecomment-1862806511 And this may break the 0.1.17 go tests (because they check if the version is 0.0.0). Fixing `--version` should ideally not be handled when packaging the software.
Author
Owner

@igorschlum commented on GitHub (Dec 26, 2023):

@xyproto Sorry, with Ollama download from ollama website. version is 0.0.0 but under, client is 0.1.17.

(base) igor@MacStudiodeIgor ~ % ollama --version
ollama version is 0.0.0
Warning: client version is 0.1.17

We still need a way to update brew script, and I don't know how to do that.

<!-- gh-comment-id:1869768647 --> @igorschlum commented on GitHub (Dec 26, 2023): @xyproto Sorry, with Ollama download from ollama website. version is 0.0.0 but under, client is 0.1.17. (base) igor@MacStudiodeIgor ~ % ollama --version ollama version is 0.0.0 Warning: client version is 0.1.17 We still need a way to update brew script, and I don't know how to do that.
Author
Owner

@xyproto commented on GitHub (Dec 26, 2023):

Ideally, versions should not be modified when the package is packaged, but fixed in the source code, in my opinion.

(In general, for updating the Homebrew package, this CI configuration has worked for me for other projects written in Go: https://github.com/jmorganca/ollama/pull/709).

The main thing I'm wondering about is why ollama --version is 0.0.0, and if this is on purpose or not.

<!-- gh-comment-id:1869804712 --> @xyproto commented on GitHub (Dec 26, 2023): Ideally, versions should not be modified when the package is packaged, but fixed in the source code, in my opinion. (In general, for updating the Homebrew package, this CI configuration has worked for me for other projects written in Go: https://github.com/jmorganca/ollama/pull/709). The main thing I'm wondering about is why `ollama --version` is `0.0.0`, and if this is on purpose or not.
Author
Owner

@jmorganca commented on GitHub (Dec 26, 2023):

Hi @xyproto, to set the version on build you can add this flag to go build:

export VERSION=0.1.17
go build -ldflags="-X=github.com/jmorganca/ollama/version.Version=$VERSION"

Then the version should be set

./ollama -v
ollama version is 0.1.17
<!-- gh-comment-id:1869811597 --> @jmorganca commented on GitHub (Dec 26, 2023): Hi @xyproto, to set the version on build you can add this flag to `go build`: ``` export VERSION=0.1.17 go build -ldflags="-X=github.com/jmorganca/ollama/version.Version=$VERSION" ``` Then the version should be set ``` ./ollama -v ollama version is 0.1.17 ```
Author
Owner

@jmorganca commented on GitHub (Dec 26, 2023):

I'll close this for now but do let me know if I can help at all with the build (this is something we're hoping to simplify over time). My email is also in my GitHub profile – feel free to shoot me an email anytime!

<!-- gh-comment-id:1869811898 --> @jmorganca commented on GitHub (Dec 26, 2023): I'll close this for now but do let me know if I can help at all with the build (this is something we're hoping to simplify over time). My email is also in my GitHub profile – feel free to shoot me an email anytime!
Author
Owner

@xyproto commented on GitHub (Sep 10, 2024):

@jmorganca

Is there a way to "ollama pull" without starting the Ollama server?

This is in connection with packaging models for Ollama, so that applications can depend on specific models.

This method is possible to use, but starting the Ollama server just to pull and package an image does not feel ideal:

  # Create a place to keep the models
  mkdir -p models
  export OLLAMA_MODELS="$srcdir/models"

  # Start Ollama
  ollama serve &
  serve_pid=$!

  # Try downloading the model with Ollama. Wait 1 second if the server is not ready yet. Try 10 times.
  echo "Downloading $_model:$_tag"
  for i in {1..10}; do
    ollama pull "$_model:$_tag" && break || sleep 1
  done

  # Stop Ollama
  kill $serve_pid

See also the "ollama-gemma2-2b" package for Arch Linux.

<!-- gh-comment-id:2340356880 --> @xyproto commented on GitHub (Sep 10, 2024): @jmorganca Is there a way to "ollama pull" without starting the Ollama server? This is in connection with packaging models for Ollama, so that applications can depend on specific models. This method is possible to use, but starting the Ollama server just to pull and package an image does not feel ideal: ```bash # Create a place to keep the models mkdir -p models export OLLAMA_MODELS="$srcdir/models" # Start Ollama ollama serve & serve_pid=$! # Try downloading the model with Ollama. Wait 1 second if the server is not ready yet. Try 10 times. echo "Downloading $_model:$_tag" for i in {1..10}; do ollama pull "$_model:$_tag" && break || sleep 1 done # Stop Ollama kill $serve_pid ``` See also the ["ollama-gemma2-2b" package for Arch Linux](https://gitlab.archlinux.org/archlinux/packaging/packages/ollama-gemma2-2b/-/blob/a9e84f0a77b503ca828d7bd5e921216c47fc5307/PKGBUILD).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#967