Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile using gcc-go #360

Closed
micwoj92 opened this issue Apr 13, 2021 · 12 comments
Closed

Can't compile using gcc-go #360

micwoj92 opened this issue Apr 13, 2021 · 12 comments

Comments

@micwoj92
Copy link

Describe the bug
Application gets error when trying to compile using gcc-go on Arch Linux.

To Reproduce
Steps to reproduce the behavior:

  1. Get croc PKGBUILD that Arch Linux uses
  2. run makepkg -si in directory with PKGBUILD
  3. 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"
@schollz
Copy link
Owner

schollz commented Apr 13, 2021

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?

@micwoj92
Copy link
Author

micwoj92 commented Apr 13, 2021

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

@schollz
Copy link
Owner

schollz commented Apr 14, 2021

What if you update to the latest version of go gcc

@micwoj92
Copy link
Author

Arch Linux currently has gcc 10.2.0 in repos, I will compile 10.3.0 from source and report back.

@micwoj92
Copy link
Author

Getting exactly same error, go version it reports go version go1.14.6 gccgo (GCC) 10.3.0 linux/amd64

@micwoj92
Copy link
Author

Last version I can build is 6.4.10, with 6.4.11 peerdiscovery bumped from 1.4.1 to 1.5.0

@micwoj92
Copy link
Author

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?

@schollz
Copy link
Owner

schollz commented Apr 14, 2021

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.

@micwoj92
Copy link
Author

micwoj92 commented Nov 6, 2022

apparently fixed in gcc 13 schollz/peerdiscovery#22 (comment)

@micwoj92 micwoj92 closed this as completed Nov 6, 2022
@micwoj92
Copy link
Author

micwoj92 commented May 7, 2023

Now on gcc 13 getting error in different package
twmb/murmur3#11

@micwoj92 micwoj92 reopened this May 7, 2023
Copy link

Stale issue message

@micwoj92
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants