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

Compilation problems with Go v1.20 and 1.21 #3

Closed
aabbtree77 opened this issue Aug 10, 2023 · 8 comments
Closed

Compilation problems with Go v1.20 and 1.21 #3

aabbtree77 opened this issue Aug 10, 2023 · 8 comments

Comments

@aabbtree77
Copy link
Contributor

  1. The following error occurs when running "go build" in the libp2p-vpn folder (Ubuntu 22.04):
go version
go version go1.21.0 linux/amd64

go build
# github.com/lucas-clemente/quic-go/internal/qtls
../../go/pkg/mod/github.com/lucas-clemente/[email protected]/internal/qtls/go120.go:5:13: cannot use "The version of quic-go you're using can't be built on Go 1.20 yet. For more details, please see https://github.com/lucas-clemente/quic-go/wiki/quic-go-and-Go-versions." (untyped string constant "The version of quic-go you're using can't be built on Go 1.20 yet. F...) as int value in variable declaration

Turning the line "go 1.19" to "go 1.21" inside go.mod, followed by "go mod tidy" does not change anything.

  1. Running "go mod tidy" on a newly cloned original repo without anything else indicates the indirect packages:

go 1.19

require (
  github.com/ipfs/go-log/v2 v2.5.1
  github.com/libp2p/go-buffer-pool v0.1.0
  github.com/libp2p/go-libp2p v0.24.2
  github.com/multiformats/go-multiaddr v0.8.0
  github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8
  github.com/vishvananda/netlink v1.1.0
)

require (
     github.com/benbjohnson/clock v1.3.0 // indirect
     ....
     google.golang.org/protobuf v1.28.1 // indirect
     lukechampine.com/blake3 v1.1.7 // indirect
)

Afterwards, I bump up the Go version, enforce "latest" and remove the indirects:

module github.com/balena/go-libp2p-vpn

go 1.21

require (
	github.com/ipfs/go-log/v2 latest
	github.com/libp2p/go-buffer-pool latest
	github.com/libp2p/go-libp2p latest
	github.com/multiformats/go-multiaddr latest
	github.com/songgao/water latest
	github.com/vishvananda/netlink latest
)

Running "go mod tidy" now brings all the latest versions:

module github.com/balena/go-libp2p-vpn

go 1.21

require (
	github.com/ipfs/go-log/v2 v2.5.1
	github.com/libp2p/go-buffer-pool v0.1.0
	github.com/libp2p/go-libp2p v0.29.2
	github.com/multiformats/go-multiaddr v0.11.0
	github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8
	github.com/vishvananda/netlink v1.1.0
)

require (
	github.com/benbjohnson/clock v1.3.5 // indirect
	github.com/beorn7/perks v1.0.1 // indirect
	github.com/cespare/xxhash/v2 v2.2.0 // indirect
	github.com/containerd/cgroups v1.1.0 // indirect
	github.com/coreos/go-systemd/v22 v22.5.0 // indirect
	github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
	github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
	github.com/docker/go-units v0.5.0 // indirect
	github.com/elastic/gosigar v0.14.2 // indirect
	github.com/flynn/noise v1.0.0 // indirect
	github.com/francoispqt/gojay v1.2.13 // indirect
	github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
	github.com/godbus/dbus/v5 v5.1.0 // indirect
	github.com/gogo/protobuf v1.3.2 // indirect
	github.com/golang/mock v1.6.0 // indirect
	github.com/golang/protobuf v1.5.3 // indirect
	github.com/google/gopacket v1.1.19 // indirect
	github.com/google/pprof v0.0.0-20230705174524-200ffdc848b8 // indirect
	github.com/gorilla/websocket v1.5.0 // indirect
	github.com/huin/goupnp v1.2.0 // indirect
	github.com/ipfs/go-cid v0.4.1 // indirect
	github.com/jackpal/go-nat-pmp v1.0.2 // indirect
	github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
	github.com/klauspost/compress v1.16.7 // indirect
	github.com/klauspost/cpuid/v2 v2.2.5 // indirect
	github.com/koron/go-ssdp v0.0.4 // indirect
	github.com/libp2p/go-cidranger v1.1.0 // indirect
	github.com/libp2p/go-flow-metrics v0.1.0 // indirect
	github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect
	github.com/libp2p/go-msgio v0.3.0 // indirect
	github.com/libp2p/go-nat v0.2.0 // indirect
	github.com/libp2p/go-netroute v0.2.1 // indirect
	github.com/libp2p/go-reuseport v0.3.0 // indirect
	github.com/libp2p/go-yamux/v4 v4.0.1 // indirect
	github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
	github.com/mattn/go-isatty v0.0.19 // indirect
	github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
	github.com/miekg/dns v1.1.55 // indirect
	github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
	github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
	github.com/minio/sha256-simd v1.0.1 // indirect
	github.com/mr-tron/base58 v1.2.0 // indirect
	github.com/multiformats/go-base32 v0.1.0 // indirect
	github.com/multiformats/go-base36 v0.2.0 // indirect
	github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect
	github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
	github.com/multiformats/go-multibase v0.2.0 // indirect
	github.com/multiformats/go-multicodec v0.9.0 // indirect
	github.com/multiformats/go-multihash v0.2.3 // indirect
	github.com/multiformats/go-multistream v0.4.1 // indirect
	github.com/multiformats/go-varint v0.0.7 // indirect
	github.com/onsi/ginkgo/v2 v2.11.0 // indirect
	github.com/opencontainers/runtime-spec v1.0.2 // indirect
	github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/prometheus/client_golang v1.14.0 // indirect
	github.com/prometheus/client_model v0.4.0 // indirect
	github.com/prometheus/common v0.37.0 // indirect
	github.com/prometheus/procfs v0.8.0 // indirect
	github.com/quic-go/qpack v0.4.0 // indirect
	github.com/quic-go/qtls-go1-19 v0.3.3 // indirect
	github.com/quic-go/qtls-go1-20 v0.2.3 // indirect
	github.com/quic-go/quic-go v0.36.4 // indirect
	github.com/quic-go/webtransport-go v0.5.3 // indirect
	github.com/raulk/go-watchdog v1.3.0 // indirect
	github.com/spaolacci/murmur3 v1.1.0 // indirect
	github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df // indirect
	go.uber.org/atomic v1.11.0 // indirect
	go.uber.org/dig v1.17.0 // indirect
	go.uber.org/fx v1.20.0 // indirect
	go.uber.org/multierr v1.11.0 // indirect
	go.uber.org/zap v1.24.0 // indirect
	golang.org/x/crypto v0.11.0 // indirect
	golang.org/x/exp v0.0.0-20230725012225-302865e7556b // indirect
	golang.org/x/mod v0.12.0 // indirect
	golang.org/x/net v0.12.0 // indirect
	golang.org/x/sync v0.3.0 // indirect
	golang.org/x/sys v0.10.0 // indirect
	golang.org/x/text v0.11.0 // indirect
	golang.org/x/tools v0.11.0 // indirect
	google.golang.org/protobuf v1.30.0 // indirect
	lukechampine.com/blake3 v1.2.1 // indirect
)

Oddly, I get nearly the same quic-go issue:

go build
# github.com/quic-go/quic-go/internal/qtls
../../go/pkg/mod/github.com/quic-go/[email protected]/internal/qtls/go121.go:5:13: cannot use "The version of quic-go you're using can't be built on Go 1.21 yet. For more details, please see https://github.com/quic-go/quic-go/wiki/quic-go-and-Go-versions." (untyped string constant "The version of quic-go you're using can't be built on Go 1.21 yet. F...) as int value in variable declaration
# github.com/libp2p/go-libp2p/p2p/protocol/identify
../../go/pkg/mod/github.com/libp2p/[email protected]/p2p/protocol/identify/id.go:559:25: type func(a multiaddr.Multiaddr, b multiaddr.Multiaddr) bool of func(a, b ma.Multiaddr) bool {…} does not match inferred type func(a multiaddr.Multiaddr, b multiaddr.Multiaddr) int for func(a E, b E) int
../../go/pkg/mod/github.com/libp2p/[email protected]/p2p/protocol/identify/obsaddr.go:217:22: type func(first *observedAddr, second *observedAddr) bool of func(first, second *observedAddr) bool {…} does not match inferred type func(a *observedAddr, b *observedAddr) int for func(a E, b E) int

I could also note that in the past I have been able to solve this quic-go issue when going from Go v1.16 to v1.19, but not this time.

It is possible to get through this go-quic error by experimenting with different versions of Go (1.20 or 1.21), go-libp2p, and go-quic, but I do not remember precise numbers anymore and there were still some go-libp2p errors about generic type conversions thrown in the end of the compilation of this code with go build.

  1. One can find examples where go-libp2p works with go-quic and Go v1.20. No doubt it is possible to hunt for correct versions there, but I would like to avoid that and move on to Go v1.21.

  2. The code compiles with Go v19.12.

@balena
Copy link
Owner

balena commented Aug 10, 2023

@aabbtree77 if you agree, the reported problem should move to github.com/lucas-clemente/quic-go, as it is used as a dependency of github.com/libp2p/go-libp2p.

Also, go-libp2p currently requires Go 1.19 as you can see here: https://github.com/libp2p/go-libp2p/blob/master/go.mod. There is this too to play with.

@aabbtree77
Copy link
Contributor Author

I agree with you, go-libp2p doesn't support v1.21 yet, as indicated in #2468.

Let's wait for the August 22-24 2023 release then, that should solve the problem #2428.

After skimming through some issues I see that go-libp2p is quite actively developed with some breaking changes, I am afraid to touch any 3-5 year old libp2p codes now.

I mostly need this to ssh into computers without proper IPs, and awl solves this fairly well for me, one can even get access to remote Linux terminal from Android, but it is slow and not so reliable, so I keep looking around. Eyeballing goose now.

Ideally, also something free, open and simple/reliable to send a message from PC to PC directly in Go.

This version stuff is such a mess everywhere. I spent an evening compiling Android code for awl, and I should probably report a similar issue there, but it takes time and I do not remember all the fixes anymore.

@balena
Copy link
Owner

balena commented Aug 11, 2023

I've had some experience actually adding the networking level required for connectivity so you could use ssh or any other regular network protocol.

You can take a look at wireguard-go-vsock. It essentially implements a "Bind" that aims opening WireGuard over hosts with VSOCK. Of course in this case, as the objective is just to establish a TCP/IP stack host to guest, other more lightweight alternatives exist and may be more suitable, such as SOCAT. Anyways, once you establish this network link, you can use iptables to promote NAT (masquerade) to your guest.

I leave it as another option to you case you feel it suits your needs.

go-libp2p-vpn has only one advantage compared to all other projects you mentioned: it's very simple to hack. In fact it has been created as a proof of concept project, feel free to fork and modify as you want.

@mooijtech
Copy link

The last error is due to a signature change in slices where an int is currently returned instead of bool, references: golang/go#61374

@balena
Copy link
Owner

balena commented Aug 12, 2023

Which error you're referring to @mooijtech?

@mooijtech
Copy link

@balena This one:

# github.com/libp2p/go-libp2p/p2p/protocol/identify
../../go/pkg/mod/github.com/libp2p/[email protected]/p2p/protocol/identify/id.go:559:25: type func(a multiaddr.Multiaddr, b multiaddr.Multiaddr) bool of func(a, b ma.Multiaddr) bool {…} does not match inferred type func(a multiaddr.Multiaddr, b multiaddr.Multiaddr) int for func(a E, b E) int
../../go/pkg/mod/github.com/libp2p/[email protected]/p2p/protocol/identify/obsaddr.go:217:22: type func(first *observedAddr, second *observedAddr) bool of func(first, second *observedAddr) bool {…} does not match inferred type func(a *observedAddr, b *observedAddr) int for func(a E, b E) int

There is a pull request to fix this but it hasn't been merged.

@balena
Copy link
Owner

balena commented Aug 12, 2023

Interesting @mooijtech but from the error message I can't infer the problem comes from this project but from go-libp2p

@mooijtech
Copy link

Correct this issue is from go-libp2p.

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

No branches or pull requests

3 participants