[GH-ISSUE #2347] parser/parser.go:9:2: package log/slog is not in GOROOT #27120

Closed
opened 2026-04-22 04:05:40 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @kenorb on GitHub (Feb 4, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2347

I've tried to build the project on Ubuntu 22.04 according to instructions, however I've got the error (master branch):

parser/parser.go:9:2: package log/slog is not in GOROOT

$ go generate ./...
...
Finished compression
+ '[' -z '' ']'
+ ROCM_PATH=/opt/rocm
+ '[' -z '' ']'
+ '[' -d /usr/lib/cmake/CLBlast ']'
+ '[' -d /opt/rocm ']'
+ cleanup
+ cd ../llama.cpp/examples/server/
+ git checkout CMakeLists.txt server.cpp
Updated 2 paths from the index
++ ls -A ../patches/01-cache.diff ../patches/02-shutdown.diff
+ '[' -n '../patches/01-cache.diff
../patches/02-shutdown.diff' ']'
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/01-cache.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout examples/server/server.cpp
Updated 0 paths from the index
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/02-shutdown.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout examples/server/server.cpp
Updated 0 paths from the index
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout examples/server/utils.hpp
Updated 1 path from the index

$ go build .
parser/parser.go:9:2: package log/slog is not in GOROOT (/usr/lib/go-1.18/src/log/slog)
parser/parser.go:10:2: package slices is not in GOROOT (/usr/lib/go-1.18/src/slices)

What's the reason and how to resolve it?

Originally created by @kenorb on GitHub (Feb 4, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2347 I've tried to build the project on Ubuntu 22.04 according to instructions, however I've got the error (`master` branch): > parser/parser.go:9:2: package log/slog is not in GOROOT ``` $ go generate ./... ... Finished compression + '[' -z '' ']' + ROCM_PATH=/opt/rocm + '[' -z '' ']' + '[' -d /usr/lib/cmake/CLBlast ']' + '[' -d /opt/rocm ']' + cleanup + cd ../llama.cpp/examples/server/ + git checkout CMakeLists.txt server.cpp Updated 2 paths from the index ++ ls -A ../patches/01-cache.diff ../patches/02-shutdown.diff + '[' -n '../patches/01-cache.diff ../patches/02-shutdown.diff' ']' + for patch in ../patches/*.diff ++ grep '^+++ ' ../patches/01-cache.diff ++ cut -f2 '-d ' ++ cut -f2- -d/ + for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/) + cd ../llama.cpp + git checkout examples/server/server.cpp Updated 0 paths from the index + for patch in ../patches/*.diff ++ grep '^+++ ' ../patches/02-shutdown.diff ++ cut -f2 '-d ' ++ cut -f2- -d/ + for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/) + cd ../llama.cpp + git checkout examples/server/server.cpp Updated 0 paths from the index + for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/) + cd ../llama.cpp + git checkout examples/server/utils.hpp Updated 1 path from the index $ go build . parser/parser.go:9:2: package log/slog is not in GOROOT (/usr/lib/go-1.18/src/log/slog) parser/parser.go:10:2: package slices is not in GOROOT (/usr/lib/go-1.18/src/slices) ``` What's the reason and how to resolve it?
Author
Owner

@MichaelFomenko commented on GitHub (Feb 4, 2024):

your go version is too old. Install the Snap Paket version 20.

<!-- gh-comment-id:1925819125 --> @MichaelFomenko commented on GitHub (Feb 4, 2024): your go version is too old. Install the Snap Paket version 20.
Author
Owner

@alexhegit commented on GitHub (Feb 5, 2024):

Yes. I got the same issue with go version 1.18. and fix it with 1.21. You can refer to https://www.fosslinux.com/68795/install-go-on-ubuntu.htm to install go v1.21.

<!-- gh-comment-id:1926373743 --> @alexhegit commented on GitHub (Feb 5, 2024): Yes. I got the same issue with go version 1.18. and fix it with 1.21. You can refer to https://www.fosslinux.com/68795/install-go-on-ubuntu.htm to install go v1.21.
Author
Owner

@jmorganca commented on GitHub (Feb 20, 2024):

Yes Go 1.21 or later is required for Ollama. Sorry you hit an issue!

<!-- gh-comment-id:1953453901 --> @jmorganca commented on GitHub (Feb 20, 2024): Yes Go 1.21 or later is required for Ollama. Sorry you hit an issue!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#27120