gccgo: Fix build on Hurd #4477

Manually merged
Hellseher merged 3 commits from yelninei/goos-hurd into go-team 2026-02-08 01:02:40 +01:00 AGit
Member
  • guix/build-system/go.scm (go-target): Add case for hurd.

Change-Id: Ib2ec622d8dd4795afd3b8164ab5e910bbadb563b

tested to crossbuild a go application and noticed the goos value is wrong.
GOOS value from https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go

Sadly go-std fails with default go.

go: unsupported GOOS/GOARCH pair hurd/386
Building 'std' failed.
Here are the results of `go env`:
go: unsupported GOOS/GOARCH pair hurd/386

hurd is not a valid goos according to https://go.dev/doc/install/source#environment

* guix/build-system/go.scm (go-target): Add case for hurd. Change-Id: Ib2ec622d8dd4795afd3b8164ab5e910bbadb563b tested to crossbuild a go application and noticed the goos value is wrong. GOOS value from https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go Sadly `go-std` fails with default go. ``` go: unsupported GOOS/GOARCH pair hurd/386 Building 'std' failed. Here are the results of `go env`: go: unsupported GOOS/GOARCH pair hurd/386 ``` hurd is not a valid goos according to https://go.dev/doc/install/source#environment
Yelninei requested review from go 2025-11-25 16:18:49 +01:00
guix-cuirass-bot approved these changes 2025-11-25 17:08:56 +01:00
Dismissed
guix-cuirass-bot left a comment
Collaborator

Evaluation succeeded but produced no new builds.

Evaluation succeeded but [produced no new builds](https://pulls.ci.guix.gnu.org/eval/1135).
Author
Member

Hurd should work with gccgo but i am not sure how to use with go-build-system.

When cross-compiling to hurd the#:go used is (default-go) and not (default-gccgo) because (supported-package? (default-go)) only checks the native system and not the target.

Hurd should work with gccgo but i am not sure how to use with go-build-system. When cross-compiling to hurd the`#:go` used is `(default-go)` and not `(default-gccgo)` because `(supported-package? (default-go))` only checks the native system and not the target.
Yelninei changed title from build-system: go: Set correct GOOS for Hurd. to WIP: build-system: go: Set correct GOOS for Hurd. 2025-12-22 20:06:51 +01:00
Yelninei force-pushed yelninei/goos-hurd from d1e8ca95f9 to d088096a30 2025-12-22 20:37:25 +01:00 Compare
Yelninei changed title from WIP: build-system: go: Set correct GOOS for Hurd. to build-system: go: Set correct GOOS for Hurd. 2025-12-22 20:37:39 +01:00
Author
Member

WIth this change go is only used if it is supported by both the system and target, falling back to gccgo if not.

ALso the change for the correct hurd goos.

WIth this change go is only used if it is supported by both the system and target, falling back to gccgo if not. ALso the change for the correct hurd goos.
Yelninei changed title from build-system: go: Set correct GOOS for Hurd. to build-system: go: When cross compiling check if target supports go. 2025-12-22 20:57:57 +01:00
Yelninei changed title from build-system: go: When cross compiling check if target supports go. to WIP: build-system: go: When cross compiling check if target supports go. 2025-12-22 21:16:13 +01:00
Author
Member

Tried to cross compile a simple hello world and it failed with

starting phase `build'
go: cannot install cross-compiled binaries when GOBIN is set
Building 'example/hello' failed.

So it seems like cross compiling does not work at all currently as that is also the error i get when trying to build from x86_64-linux->aarch64-linux

Tried to cross compile a simple hello world and it failed with ``` starting phase `build' go: cannot install cross-compiled binaries when GOBIN is set Building 'example/hello' failed. ``` So it seems like cross compiling does not work at all currently as that is also the error i get when trying to build from x86_64-linux->aarch64-linux
Author
Member

Then with an unset GOBIN gccgo failed linking

I guess we need a gccgo cross compiler instead of the native gccgo

starting phase `build'
example/hello
# example/hello
ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgobegin.a when searching for -lgobegin
ld: cannot find -lgobegin: No such file or directory
ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgo.so when searching for -lgo
ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgo.a when searching for -lgo
ld: cannot find -lgo: No such file or directory
ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgo.so when searching for -lgo
ld: skipping incompatible /gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/lib/libm.so when searching for -lm
ld: skipping incompatible /gnu/store/q1s19kv8bdq9ssfdgznzgkmfmj90vdfd-glibc-2.41-static/lib/libm.a when searching for -lm
ld: skipping incompatible /gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/lib/libm.so when searching for -lm
ld: skipping incompatible /gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/lib/libm.so when searching for -lm
ld: cannot find -lm: No such file or directory
ld: skipping incompatible /gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/lib/libm.so when searching for -lm
ld: skipping incompatible /gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/lib/libm.so when searching for -lm
ld: skipping incompatible /gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/lib/libm.so when searching for -lm
ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgcc_s.so.1 when searching for libgcc_s.so.1
ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgcc_s.so.1 when searching for libgcc_s.so.1
ld: cannot find libgcc_s.so.1: No such file or directory
ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgcc_s.so.1 when searching for libgcc_s.so.1
ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/libgcc.a when searching for -lgcc
ld: cannot find -lgcc: No such file or directory
collect2: error: ld returned 1 exit status
Then with an unset GOBIN gccgo failed linking I guess we need a gccgo cross compiler instead of the native gccgo ``` starting phase `build' example/hello # example/hello ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgobegin.a when searching for -lgobegin ld: cannot find -lgobegin: No such file or directory ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgo.so when searching for -lgo ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgo.a when searching for -lgo ld: cannot find -lgo: No such file or directory ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgo.so when searching for -lgo ld: skipping incompatible /gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/lib/libm.so when searching for -lm ld: skipping incompatible /gnu/store/q1s19kv8bdq9ssfdgznzgkmfmj90vdfd-glibc-2.41-static/lib/libm.a when searching for -lm ld: skipping incompatible /gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/lib/libm.so when searching for -lm ld: skipping incompatible /gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/lib/libm.so when searching for -lm ld: cannot find -lm: No such file or directory ld: skipping incompatible /gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/lib/libm.so when searching for -lm ld: skipping incompatible /gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/lib/libm.so when searching for -lm ld: skipping incompatible /gnu/store/yj053cys0724p7vs9kir808x7fivz17m-glibc-2.41/lib/libm.so when searching for -lm ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgcc_s.so.1 when searching for libgcc_s.so.1 ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgcc_s.so.1 when searching for libgcc_s.so.1 ld: cannot find libgcc_s.so.1: No such file or directory ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/../../../libgcc_s.so.1 when searching for libgcc_s.so.1 ld: skipping incompatible /gnu/store/1yfv2j7x1yx8fvxg3hxrknl2zfyp6il4-gccgo-12.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/12.5.0/libgcc.a when searching for -lgcc ld: cannot find -lgcc: No such file or directory collect2: error: ld returned 1 exit status ```
Yelninei changed title from WIP: build-system: go: When cross compiling check if target supports go. to WIP: build-system: go: Support cross compilation 2025-12-22 21:31:25 +01:00
Yelninei force-pushed yelninei/goos-hurd from d088096a30 to 03596d297b 2025-12-24 14:53:59 +01:00 Compare
Yelninei changed title from WIP: build-system: go: Support cross compilation to WIP: gccgo on Hurd 2025-12-24 14:54:41 +01:00
Author
Member

I think I'll only try to solve the native case first, the cross stuff is a bit more involved.

gccgo fails to build

make[4]: Leaving directory '/tmp/guix-build-gccgo-14.3.0.drv-0/build/i586-unknown-gnu/libgo'
make[3]: Leaving directory '/tmp/guix-build-gccgo-14.3.0.drv-0/build/i586-unknown-gnu/libgo'
make[2]: Leaving directory '/tmp/guix-build-gccgo-14.3.0.drv-0/build/i586-unknown-gnu/libgo'
make[2]: Entering directory '/tmp/guix-build-gccgo-14.3.0.drv-0/build/gotools'
/tmp/guix-build-gccgo-14.3.0.drv-0/gcc-14.3.0/stage-gcc.sh /tmp/guix-build-gccgo-14.3.0.drv-0/build/./gcc/gccgo -B/tmp/guix-build-gccgo-14.3.0.drv-0/build/./gcc/ -B/gnu/store/d50plsik3hqnhl8ckdjmsny4lwwscwjb-gccgo-14.3.0/i586-unknown-gnu/bin/ -B/gnu/store/d50plsik3hqnhl8ckdjmsny4lwwscwjb-gccgo-14.3.0/i586-unknown-gnu/lib/ -isystem /gnu/store/d50plsik3hqnhl8ckdjmsny4lwwscwjb-gccgo-14.3.0/i586-unknown-gnu/include -isystem /gnu/store/d50plsik3hqnhl8ckdjmsny4lwwscwjb-gccgo-14.3.0/i586-unknown-gnu/sys-include   -g -O2 -I ../i586-unknown-gnu/libgo -static-libstdc++ -static-libgcc -B/gnu/store/npc9q7wb9l0n7pcs7w8qx7ajz47xc1vi-glibc-2.41/lib -Wl,-dynamic-linker -Wl,/gnu/store/npc9q7wb9l0n7pcs7w8qx7ajz47xc1vi-glibc-2.41/lib/ld.so.1 -Wl,-rpath=/gnu/store/1a34h464pyg359gac8mr87zjjldl00z2-gccgo-14.3.0-lib/lib  -L ../i586-unknown-gnu/libgo -L ../i586-unknown-gnu/libgo/.libs -o go ../../gcc-14.3.0/gotools/../libgo/go/cmd/go/alldocs.go ../../gcc-14.3.0/gotools/../libgo/go/cmd/go/go11.go ../../gcc-14.3.0/gotools/../libgo/go/cmd/go/main.go ../i586-unknown-gnu/libgo/libgotool.a  
go1: error: ‘-fsplit-stack’ currently only supported on GNU/Linux
go1: error: ‘-fsplit-stack’ is not supported by this compiler configuration
make[2]: *** [Makefile:820: go] Error 1
make[2]: Leaving directory '/tmp/guix-build-gccgo-14.3.0.drv-0/build/gotools'
make[1]: *** [Makefile:15827: all-gotools] Error 2
make[1]: Leaving directory '/tmp/guix-build-gccgo-14.3.0.drv-0/build'
make: *** [Makefile:1100: all] Error 2
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("-j" "1" "--max-load=1" "LDFLAGS_FOR_TARGET=-B/gnu/store/npc9q7wb9l0n7pcs7w8qx7ajz47xc1vi-glibc-2.41/lib -Wl,-dynamic-linker -Wl,/gnu/store/npc9q7wb9l0n7pcs7w8qx7ajz47xc1vi-glibc-2.41/lib/ld.so.1" "LDFLAGS=-Wl,-rpath=/gnu/store/npc9q7wb9l0n7pcs7w8qx7ajz47xc1vi-glibc-2.41/lib -Wl,-dynamic-linker -Wl,/gnu/store/npc9q7wb9l0n7pcs7w8qx7ajz47xc1vi-glibc-2.41/lib/ld.so.1" "BOOT_CFLAGS=-O2 -g0") exit-status: 2 term-signal: #f stop-signal: #f> 
phase `build' failed after 17472.7 seconds

the configure script correctly determins that -fsplit-stack does not work

checking whether -fsplit-stack is supported... no
checking whether linker supports split/non-split linked together... no
checking whether linker supports split stack... no
checking whether compiler is llgo... no

to be investigated,

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104290

https://gcc.gnu.org/cgit/gcc/commit/?id=29eacf043b6e8560c5c42d67f7f9b11e4e2cb156

I think I'll only try to solve the native case first, the cross stuff is a bit more involved. gccgo fails to build ``` make[4]: Leaving directory '/tmp/guix-build-gccgo-14.3.0.drv-0/build/i586-unknown-gnu/libgo' make[3]: Leaving directory '/tmp/guix-build-gccgo-14.3.0.drv-0/build/i586-unknown-gnu/libgo' make[2]: Leaving directory '/tmp/guix-build-gccgo-14.3.0.drv-0/build/i586-unknown-gnu/libgo' make[2]: Entering directory '/tmp/guix-build-gccgo-14.3.0.drv-0/build/gotools' /tmp/guix-build-gccgo-14.3.0.drv-0/gcc-14.3.0/stage-gcc.sh /tmp/guix-build-gccgo-14.3.0.drv-0/build/./gcc/gccgo -B/tmp/guix-build-gccgo-14.3.0.drv-0/build/./gcc/ -B/gnu/store/d50plsik3hqnhl8ckdjmsny4lwwscwjb-gccgo-14.3.0/i586-unknown-gnu/bin/ -B/gnu/store/d50plsik3hqnhl8ckdjmsny4lwwscwjb-gccgo-14.3.0/i586-unknown-gnu/lib/ -isystem /gnu/store/d50plsik3hqnhl8ckdjmsny4lwwscwjb-gccgo-14.3.0/i586-unknown-gnu/include -isystem /gnu/store/d50plsik3hqnhl8ckdjmsny4lwwscwjb-gccgo-14.3.0/i586-unknown-gnu/sys-include -g -O2 -I ../i586-unknown-gnu/libgo -static-libstdc++ -static-libgcc -B/gnu/store/npc9q7wb9l0n7pcs7w8qx7ajz47xc1vi-glibc-2.41/lib -Wl,-dynamic-linker -Wl,/gnu/store/npc9q7wb9l0n7pcs7w8qx7ajz47xc1vi-glibc-2.41/lib/ld.so.1 -Wl,-rpath=/gnu/store/1a34h464pyg359gac8mr87zjjldl00z2-gccgo-14.3.0-lib/lib -L ../i586-unknown-gnu/libgo -L ../i586-unknown-gnu/libgo/.libs -o go ../../gcc-14.3.0/gotools/../libgo/go/cmd/go/alldocs.go ../../gcc-14.3.0/gotools/../libgo/go/cmd/go/go11.go ../../gcc-14.3.0/gotools/../libgo/go/cmd/go/main.go ../i586-unknown-gnu/libgo/libgotool.a go1: error: ‘-fsplit-stack’ currently only supported on GNU/Linux go1: error: ‘-fsplit-stack’ is not supported by this compiler configuration make[2]: *** [Makefile:820: go] Error 1 make[2]: Leaving directory '/tmp/guix-build-gccgo-14.3.0.drv-0/build/gotools' make[1]: *** [Makefile:15827: all-gotools] Error 2 make[1]: Leaving directory '/tmp/guix-build-gccgo-14.3.0.drv-0/build' make: *** [Makefile:1100: all] Error 2 error: in phase 'build': uncaught exception: %exception #<&invoke-error program: "make" arguments: ("-j" "1" "--max-load=1" "LDFLAGS_FOR_TARGET=-B/gnu/store/npc9q7wb9l0n7pcs7w8qx7ajz47xc1vi-glibc-2.41/lib -Wl,-dynamic-linker -Wl,/gnu/store/npc9q7wb9l0n7pcs7w8qx7ajz47xc1vi-glibc-2.41/lib/ld.so.1" "LDFLAGS=-Wl,-rpath=/gnu/store/npc9q7wb9l0n7pcs7w8qx7ajz47xc1vi-glibc-2.41/lib -Wl,-dynamic-linker -Wl,/gnu/store/npc9q7wb9l0n7pcs7w8qx7ajz47xc1vi-glibc-2.41/lib/ld.so.1" "BOOT_CFLAGS=-O2 -g0") exit-status: 2 term-signal: #f stop-signal: #f> phase `build' failed after 17472.7 seconds ``` the configure script correctly determins that `-fsplit-stack` does not work ``` checking whether -fsplit-stack is supported... no checking whether linker supports split/non-split linked together... no checking whether linker supports split stack... no checking whether compiler is llgo... no ``` to be investigated, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104290 https://gcc.gnu.org/cgit/gcc/commit/?id=29eacf043b6e8560c5c42d67f7f9b11e4e2cb156
Author
Member

The patch fixes gccgo, i am not sure what to do with it, it should be in gcc itself and not only gccgo.

The patch is now in the gcc trees for v13,v14 and v15.

I have built a gccgo@12 with this and assume that others are fine as well as gcc14 failed with the same error before.

root@childhurd ~# /gnu/store/4wk2mahk016yngdwf3xpm21hqmrky3g1-gccgo-12.5.0/bin/go env
GO111MODULE=""
GOARCH="386"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT="fieldtrack"
GOFLAGS=""
GOHOSTARCH="386"
GOHOSTOS="hurd"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="hurd"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/gnu/store/4wk2mahk016yngdwf3xpm21hqmrky3g1-gccgo-12.5.0"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/gnu/store/4wk2mahk016yngdwf3xpm21hqmrky3g1-gccgo-12.5.0/libexec/gcc/i586-unknown-gnu/12.5.0"
GOVCS=""
GOVERSION="go1.18 gccgo (GCC) 12.5.0"
GCCGO="/gnu/store/4wk2mahk016yngdwf3xpm21hqmrky3g1-gccgo-12.5.0/bin/gccgo"
GO386="sse2"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m32 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build291457190=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

Also a simple hello world example works without issues.

The patch fixes gccgo, i am not sure what to do with it, it should be in gcc itself and not only gccgo. The patch is now in the gcc trees for v13,v14 and v15. I have built a gccgo@12 with this and assume that others are fine as well as gcc14 failed with the same error before. ``` root@childhurd ~# /gnu/store/4wk2mahk016yngdwf3xpm21hqmrky3g1-gccgo-12.5.0/bin/go env GO111MODULE="" GOARCH="386" GOBIN="" GOCACHE="/root/.cache/go-build" GOENV="/root/.config/go/env" GOEXE="" GOEXPERIMENT="fieldtrack" GOFLAGS="" GOHOSTARCH="386" GOHOSTOS="hurd" GOINSECURE="" GOMODCACHE="/root/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="hurd" GOPATH="/root/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/gnu/store/4wk2mahk016yngdwf3xpm21hqmrky3g1-gccgo-12.5.0" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/gnu/store/4wk2mahk016yngdwf3xpm21hqmrky3g1-gccgo-12.5.0/libexec/gcc/i586-unknown-gnu/12.5.0" GOVCS="" GOVERSION="go1.18 gccgo (GCC) 12.5.0" GCCGO="/gnu/store/4wk2mahk016yngdwf3xpm21hqmrky3g1-gccgo-12.5.0/bin/gccgo" GO386="sse2" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m32 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build291457190=/tmp/go-build -gno-record-gcc-switches -funwind-tables" ``` Also a simple hello world example works without issues.
Yelninei changed title from WIP: gccgo on Hurd to gccgo on Hurd 2025-12-24 21:53:58 +01:00
Yelninei changed title from gccgo on Hurd to gccgo: Fix build on Hurd 2025-12-24 21:54:20 +01:00
Author
Member

gccgo@14 fails on x86_64-gnu with

checking for syscall... no

../../../gcc-14.3.0/libgo/runtime/go-nosys.c:509:1: error: conflicting types for ‘syscall’; have ‘int(int, ...)’
  509 | syscall(int number __attribute__ ((unused)), ...)
      | ^~~~~~~
In file included from ../../../gcc-14.3.0/libgo/runtime/go-nosys.c:28:
/gnu/store/hias0bz1y4bj4pxch06a4n36wdwhq0p5-glibc-2.41/include/unistd.h:1091:17: note: previous declaration of ‘syscall’ with type ‘long int(long int, ...)’
 1091 | extern long int syscall (long int __sysno, ...) __THROW;
      |                 ^~~~~~~
make[4]: *** [Makefile:1526: runtime/go-nosys.lo] Error 1

This is fixed in gcc 15 with.

github.com/golang/gofrontend@f9ea980105

gccgo@14 fails on x86_64-gnu with ``` checking for syscall... no ../../../gcc-14.3.0/libgo/runtime/go-nosys.c:509:1: error: conflicting types for ‘syscall’; have ‘int(int, ...)’ 509 | syscall(int number __attribute__ ((unused)), ...) | ^~~~~~~ In file included from ../../../gcc-14.3.0/libgo/runtime/go-nosys.c:28: /gnu/store/hias0bz1y4bj4pxch06a4n36wdwhq0p5-glibc-2.41/include/unistd.h:1091:17: note: previous declaration of ‘syscall’ with type ‘long int(long int, ...)’ 1091 | extern long int syscall (long int __sysno, ...) __THROW; | ^~~~~~~ make[4]: *** [Makefile:1526: runtime/go-nosys.lo] Error 1 ``` This is fixed in gcc 15 with. https://github.com/golang/gofrontend/commit/f9ea9801058aa98a421784da12b76cda0b4c6cf2
Author
Member
/gnu/store/w0rph5aq7lkdagnkvpbiyihkkcwsiv91-gccgo-15.2.0/bin/go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT="fieldtrack,regabiwrappers"
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="hurd"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="hurd"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/gnu/store/w0rph5aq7lkdagnkvpbiyihkkcwsiv91-gccgo-15.2.0"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/gnu/store/w0rph5aq7lkdagnkvpbiyihkkcwsiv91-gccgo-15.2.0/libexec/gcc/x86_64-unknown-gnu/15.2.0"
GOVCS=""
GOVERSION="go1.18 gccgo (GCC) 15.2.0"
GCCGO="/gnu/store/w0rph5aq7lkdagnkvpbiyihkkcwsiv91-gccgo-15.2.0/bin/gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2414352222=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

gcc@15 works on x86_64-gnu.

Should default gccgo beupdated to track default/latest gcc?

``` /gnu/store/w0rph5aq7lkdagnkvpbiyihkkcwsiv91-gccgo-15.2.0/bin/go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/root/.cache/go-build" GOENV="/root/.config/go/env" GOEXE="" GOEXPERIMENT="fieldtrack,regabiwrappers" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="hurd" GOINSECURE="" GOMODCACHE="/root/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="hurd" GOPATH="/root/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/gnu/store/w0rph5aq7lkdagnkvpbiyihkkcwsiv91-gccgo-15.2.0" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/gnu/store/w0rph5aq7lkdagnkvpbiyihkkcwsiv91-gccgo-15.2.0/libexec/gcc/x86_64-unknown-gnu/15.2.0" GOVCS="" GOVERSION="go1.18 gccgo (GCC) 15.2.0" GCCGO="/gnu/store/w0rph5aq7lkdagnkvpbiyihkkcwsiv91-gccgo-15.2.0/bin/gccgo" GOAMD64="v1" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2414352222=/tmp/go-build -gno-record-gcc-switches -funwind-tables" ``` gcc@15 works on x86_64-gnu. Should default gccgo beupdated to track default/latest gcc?
Member

Hi, thank you for your R&D work to bring Go to Hurd.

Sorry for no replay for a long time, I have no Hurd machine to check the native build only Qemu VM, how did you check?

Hi, thank you for your R&D work to bring Go to Hurd. Sorry for no replay for a long time, I have no Hurd machine to check the native build only Qemu VM, how did you check?
Author
Member

i have both a i586-gnu and x86_64-gnu childhurd (with hurd-vm-service-type) and offload the builds with something like

./pre-inst-env guix build gccgo@VERSION -s i586-gnu

and then wait 4h for gcc to bootstrap (you probably need to run them with at least 3G of ram and 7-8GiB of disk size).

WIth this patch it works for gccgo@12,13,14,15 on i586-gnu and gccgo@15 on x86_64-gnu (it needs the other patch i mentioned for the older versions).

I odn't quite like that the patch is only in gccgo and not the default gc where it should really belong.

What do you think of bumping the default gccgo to 15 (latest) and putting the patch to the default gcc@15 patches and then gccgo@15 will inherit automatically?

This would be relatively easy now while gcc@15 has not many dependants yet.
Adding it to the other gcc's is a lot harder because they have a lot of dependant packages but if the default gccgo is bumped then the fact that the older ones don't build should be ok.

Is gccgo used on other platforms or are all the other ones supported by the default go?

The other thing setting the correct GOOS is a nice thing for technical correctness but cross compiling in go-build-system in general seems to be broken atm. I opened an issue for that here guix/guix#5063

i have both a i586-gnu and x86_64-gnu childhurd (with hurd-vm-service-type) and offload the builds with something like ``` ./pre-inst-env guix build gccgo@VERSION -s i586-gnu ``` and then wait 4h for gcc to bootstrap (you probably need to run them with at least 3G of ram and 7-8GiB of disk size). WIth this patch it works for gccgo@12,13,14,15 on i586-gnu and gccgo@15 on x86_64-gnu (it needs the other patch i mentioned for the older versions). I odn't quite like that the patch is only in gccgo and not the default gc where it should really belong. What do you think of bumping the default gccgo to 15 (latest) and putting the patch to the default gcc@15 patches and then gccgo@15 will inherit automatically? This would be relatively easy now while gcc@15 has not many dependants yet. Adding it to the other gcc's is a lot harder because they have a lot of dependant packages but if the default gccgo is bumped then the fact that the older ones don't build should be ok. Is gccgo used on other platforms or are all the other ones supported by the default go? The other thing setting the correct GOOS is a nice thing for technical correctness but cross compiling in go-build-system in general seems to be broken atm. I opened an issue for that here guix/guix#5063
Hellseher requested review from hurd 2026-01-10 19:21:32 +01:00
Yelninei force-pushed yelninei/goos-hurd from 9023f841d9 to f7a79e3229 2026-01-10 19:37:21 +01:00 Compare
Author
Member

@Hellseher I did exactly that in the latest update and am currently rebuilding both gccgo.

As the default go seems to be supported by all but powerpc-linux and hurd the bump of the default-gccgo should not rebuild much.

I also put the patch on the default gcc-15 so it can be automatically removed when gcc-15 eventually gets updated to 15.3.

There are still some uses of gccgo-12 and gccgo-14 should these be updated aswell? maybe there should be an unversioned gccgo symbol (pointing to gccgo-15) that everything that uses gccgo references?

go-golang-org-x-tools gccgo-1.14
go-1.17                       gccgo-12

but updating thesemight need to go on a go-team branch.

@Hellseher I did exactly that in the latest update and am currently rebuilding both gccgo. As the default go seems to be supported by all but powerpc-linux and hurd the bump of the default-gccgo should not rebuild much. I also put the patch on the default gcc-15 so it can be automatically removed when gcc-15 eventually gets updated to 15.3. There are still some uses of gccgo-12 and gccgo-14 should these be updated aswell? maybe there should be an unversioned gccgo symbol (pointing to gccgo-15) that everything that uses gccgo references? ``` go-golang-org-x-tools gccgo-1.14 go-1.17 gccgo-12 ``` but updating thesemight need to go on a go-team branch.
guix-cuirass-bot left a comment
Collaborator
Results of evaluation [195175](https://pulls.ci.guix.gnu.org/eval/195175) for commit f7a79e322981942b4696c7bb0ed0065d8d5c69a1: - Successfully built 27 packages: [`gcc-toolchain-15.2.0`](https://pulls.ci.guix.gnu.org/build/1193282/details), [`hyprlang-0.6.7`](https://pulls.ci.guix.gnu.org/build/1193281/details), [`hyprgraphics-0.4.0`](https://pulls.ci.guix.gnu.org/build/1193280/details), [`hyprutils-0.10.4`](https://pulls.ci.guix.gnu.org/build/1193279/details), [`rr-5.9.0-0.7fe1e36`](https://pulls.ci.guix.gnu.org/build/1193278/details), [`xdg-desktop-portal-hyprland-1.3.11`](https://pulls.ci.guix.gnu.org/build/1193277/details), [`hyprwayland-scanner-0.4.5`](https://pulls.ci.guix.gnu.org/build/1193276/details), [`libgccjit-15.2.0`](https://pulls.ci.guix.gnu.org/build/1193275/details), [`gcc-15.2.0`](https://pulls.ci.guix.gnu.org/build/1193274/details), [`gccgo-15.2.0`](https://pulls.ci.guix.gnu.org/build/1193273/details), and [17 more](https://pulls.ci.guix.gnu.org/eval/195175?status=succeeded)
Author
Member

@Hellseher Any update on this?

@Hellseher Any update on this?
Member

@Yelninei wrote in #4477 (comment):

@Hellseher Any update on this?

Hi, sorry did not have a chance yet to work on go-team branch, still on python.
Maybe @guix/hurd may give some review points meanwhile?

@Yelninei wrote in https://codeberg.org/guix/guix/pulls/4477#issuecomment-10127541: > @Hellseher Any update on this? Hi, sorry did not have a chance yet to work on go-team branch, still on python. Maybe @guix/hurd may give some review points meanwhile?
Author
Member

guix/hurd currently consists of janneke and myself.

the gcc patch is already in the trees for gcc-13,14 and 15.
For supporting x86_64-gnu one needs gcc-14+ but that is difficult to change and would need a second patch to fix the build.

Whether the gccgo used should be updated is a decision for guix/go. And from what I can see only hurd and 32bit powerpc are not supported by the normal go.

The GOOS change is trivial but cross compiling currently does not seem to work (especially when the target is not support by the regular go)

guix/hurd currently consists of janneke and myself. the gcc patch is already in the trees for gcc-13,14 and 15. For supporting x86_64-gnu one needs gcc-14+ but that is difficult to change and would need a second patch to fix the build. Whether the gccgo used should be updated is a decision for guix/go. And from what I can see only hurd and 32bit powerpc are not supported by the normal go. The GOOS change is trivial but cross compiling currently does not seem to work (especially when the target is not support by the regular go)
Member

75b299934f * build-system: go: Update default-gccgo to gccgo@15.
e4e34a57e5 * gnu: gccgo-15: Fix build on Hurd.
2e2914da5a * build-system: go: Set correct GOOS for Hurd.

75b299934fb * build-system: go: Update default-gccgo to gccgo@15. e4e34a57e59 * gnu: gccgo-15: Fix build on Hurd. 2e2914da5ad * build-system: go: Set correct GOOS for Hurd.
Hellseher changed target branch from master to go-team 2026-02-08 01:02:15 +01:00
Hellseher manually merged commit 75b299934f into go-team 2026-02-08 01:02:40 +01:00
Sign in to join this conversation.
No reviewers
guix/go
guix/core-packages
guix/hurd
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
guix/guix!4477
No description provided.