Description
Go version
go version devel go1.25-5eaeb7b455 Thu Apr 3 15:36:36 2025 -0700 linux/s390x
Output of go env
in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='/usr/bin/gccgo'
GO111MODULE=''
GOARCH='s390x'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -march=z196 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1226758756=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='s390x'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/opt/ollama/go.mod'
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/goroot'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/goroot/pkg/tool/linux_s390x'
GOVCS=''
GOVERSION='devel go1.25-5eaeb7b455 Thu Apr 3 15:36:36 2025 -0700'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
I'm trying to compile Ollama
with -march=z15 -mtune=z15 -mvx -mzvector
but runtime/cgo
is reporting that hardware vector support is not available on z196 while my actual machine is z15.
$ uname -a
Linux aitest 5.14.0-575.el9.s390x #1 SMP Tue Mar 25 17:28:06 UTC 2025 s390x s390x s390x GNU/Linux
$ CGO_CPPFLAGS="-I/opt/openblas-libs/include" CGO_LDFLAGS="-L/opt/openblas-libs/lib -lopenblas" CC="gcc -march=z15 -mtune=z15 -mvx -mzvector" go run . serve
# runtime/cgo
cc1: error: hardware vector support not available on z196
Running a check on the environment variables reported that the machine type is indeed enforced as z196, which is incorrect.
$ go env | grep GOGCCFLAGS
GOGCCFLAGS='-fPIC -m64 -march=z196 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2459717027=/tmp/go-build -gno-record-gcc-switches'
Trying to override the GOGCCFLAGS
was met with go: GOGCCFLAGS cannot be modified
as follows
$ go env -w GOGCCFLAGS="-fPIC -m64 -march=z15 -mtune=z15 -mvx -mzvector -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2459717027=/tmp/go-build -gno-record-gcc-switches"
go: GOGCCFLAGS cannot be modified
What did you see happen?
My Ollama development project fails to compile with -march=z15 -mtune=z15 -mvx -mzvector
because the machine type is enforced to z196
which is incorrect.
What did you expect to see?
I was expecting Go to use the correct machine type i.e., z15 = -march=z15
, z16 = -march=z16
instead of defaulting to -march=z196
which is very old. Otherwise, a possible method of overriding the GOGCCFLAGS
to fix this bug.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status