croc
croc copied to clipboard
Can't compile using gcc-go
Describe the bug Application gets error when trying to compile using gcc-go on Arch Linux.
To Reproduce Steps to reproduce the behavior:
- Get croc PKGBUILD that Arch Linux uses
- run makepkg -si in directory with PKGBUILD
- See error
# github.com/schollz/peerdiscovery
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
381 | type PacketConn4 struct {
| ^
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type ipv4.genericOpt)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
396 | type PacketConn6 struct {
| ^
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type ipv6.genericOpt)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
vendor/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
Expected behavior Application should build as it does when using regular go.
Version croc version v8.6.12-c373b38
Additional context
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/micwoj92/.cache/go-build"
GOENV="/home/micwoj92/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/micwoj92/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0"
GCCGO="/usr/bin/gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build599677254=/tmp/go-build -gno-record-gcc-switches -funwind-tables"
Its a weird error you are getting, what version of gcc-go are you using? Does building with normal go on the same system work?
Its a weird error you are getting, what version of gcc-go are you using?
go version go1.14.4 gccgo (GCC) 10.2.0 linux/amd64
Does building with normal go on the same system work?
yes
What if you update to the latest version of go gcc
Arch Linux currently has gcc 10.2.0 in repos, I will compile 10.3.0 from source and report back.
Getting exactly same error, go version it reports go version go1.14.6 gccgo (GCC) 10.3.0 linux/amd64
Last version I can build is 6.4.10, with 6.4.11 peerdiscovery bumped from 1.4.1 to 1.5.0
Now I tried using go get command from peerdiscovery readme
$ go get -u github.com/schollz/peerdiscovery
# github.com/schollz/peerdiscovery
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
381 | type PacketConn4 struct {
| ^
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type ipv4.genericOpt)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:381:6: error: incompatible type for receiver (cannot use type PacketConn4 as type socket.Conn)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
396 | type PacketConn6 struct {
| ^
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type ipv6.genericOpt)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
../../go/src/github.com/schollz/peerdiscovery/peerdiscovery.go:396:6: error: incompatible type for receiver (cannot use type PacketConn6 as type socket.Conn)
So I guess issue should be opened there?
Sure, I'm really not sure what's going on here. I don't use gcc-go, so will have to wait for someone who does.
apparently fixed in gcc 13 https://github.com/schollz/peerdiscovery/issues/22#issuecomment-1304873966
Now on gcc 13 getting error in different package https://github.com/twmb/murmur3/issues/11
Stale issue message
With gccgo lagging behind and missing language features (such as generics) I don't think it makes sense to keep this issue open.
go version go1.18 gccgo (GCC) 13.2.1 20230801 linux/amd64