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

[Bug]: Build Failed! Issues with building Go 1.19, ignite v0.27.2, cosmos-sdk v0.47.12 (upgrading from ignitev0.26 to v0.27.2) #21098

Closed
1 task done
noslav opened this issue Jul 28, 2024 · 12 comments
Labels

Comments

@noslav
Copy link

noslav commented Jul 28, 2024

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

Building cosmos-sdk app is failing.


go test ./...                                                    ─╯
# github.com/cosmos/gogoproto/proto
../../../../.asdf/installs/golang/1.19/packages/pkg/mod/github.com/cosmos/[email protected]/proto/merge.go:260:25: type func(x *descriptorpb.FileDescriptorProto, y *descriptorpb.FileDescriptorProto) bool of func(x, y *descriptorpb.FileDescriptorProto) bool {…} does not match inferred type func(a *descriptorpb.FileDescriptorProto, b *descriptorpb.FileDescriptorProto) int for func(a E, b E) int
# golang.org/x/crypto/sha3
../../../../.asdf/installs/golang/1.19/packages/pkg/mod/golang.org/x/[email protected]/sha3/xor.go:25:10: undefined: subtle.XORBytes


FAIL	github.com/covalenthq/covenet/app [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet/client/cli [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet/keeper [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet/types [build failed]

My go.mod

module github.com/covalenthq/covenet

go 1.19

require (
	cosmossdk.io/api v0.3.1
	github.com/cometbft/cometbft v0.37.5
	github.com/cometbft/cometbft-db v0.8.0
	github.com/cosmos/cosmos-sdk v0.47.12
	github.com/cosmos/gogoproto v1.4.10
	github.com/cosmos/ibc-go/v7 v7.6.0
	github.com/ethereum/go-ethereum v1.9.7
	github.com/golang/protobuf v1.5.4
	github.com/gorilla/mux v1.8.0
	github.com/grpc-ecosystem/grpc-gateway v1.16.0
	github.com/spf13/cast v1.6.0
	github.com/spf13/cobra v1.8.0
	github.com/spf13/pflag v1.0.5
	github.com/stretchr/testify v1.9.0
	google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80
	google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80
	google.golang.org/grpc v1.62.1
	gopkg.in/yaml.v2 v2.4.0
)

Cosmos SDK Version

0.47.12

How to reproduce?

ignite27 version ─╯
·
· 🛸 Ignite CLI v28.5.0 is available!
·
· To upgrade your Ignite CLI version, see the upgrade doc: https://docs.ignite.com/guide/install#upgrading-your-ignite-cli-installation
·
··

Ignite CLI version: v0.27.2
Ignite CLI build date: 2023-10-18T11:34:58Z
Ignite CLI source hash: f3ab0d709ec41e31a1c57f2fe86c8902d8a50497
Ignite CLI config version: v1
Cosmos SDK version: v0.47.3
Your OS: darwin
Your arch: arm64
Your Node.js version: v21.7.3
Your go version: go version go1.19 darwin/arm64
Your uname -a: Darwin Pranays-MacBook-Pro-3.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64
Your cwd: /Users/pranay/Documents/covalent/covenet/covenet
Is on Gitpod: false

go env                                                           ─╯
GO111MODULE=""
GOARCH="arm64"
GOBIN="/Users/pranay/.asdf/installs/golang/1.19/packages/bin"
GOCACHE="/Users/pranay/Library/Caches/go-build"
GOENV="/Users/pranay/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/pranay/.asdf/installs/golang/1.19/packages/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/pranay/.asdf/installs/golang/1.19/packages"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/pranay/.asdf/installs/golang/1.19/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/pranay/.asdf/installs/golang/1.19/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
AR="ar"
CC="/usr/bin/gcc -I/opt/homebrew/Cellar/unixodbc/2.3.11/include"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/pranay/Documents/covalent/covenet/covenet/go.mod"
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 -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_k/ddfvbjvn2fq5drm_yv5fprjr0000gn/T/go-build1539602794=/tmp/go-build -gno-record-gcc-switches -fno-common"
@noslav noslav added the T:Bug label Jul 28, 2024
@noslav noslav changed the title [Bug]: Build Failed! Issues with building Go 1.19, ignite v0.27.2, cosmos-idk v0.47.12 (upgrading from ignitev0.26 to v0.27.2) [Bug]: Build Failed! Issues with building Go 1.19, ignite v0.27.2, cosmos-sdk v0.47.12 (upgrading from ignitev0.26 to v0.27.2) Jul 28, 2024
@noslav
Copy link
Author

noslav commented Jul 28, 2024

Even tried upgrading golang to 1.20

One issue gets resolved

# golang.org/x/crypto/sha3
../../../../.asdf/installs/golang/1.19/packages/pkg/mod/golang.org/x/[email protected]/sha3/xor.go:25:10: undefined: subtle.XORBytes

but other remains -

# github.com/cosmos/gogoproto/proto
../../../../.asdf/installs/golang/1.20/packages/pkg/mod/github.com/cosmos/[email protected]/proto/merge.go:260:25: type func(x *descriptorpb.FileDescriptorProto, y *descriptorpb.FileDescriptorProto) bool of func(x, y *descriptorpb.FileDescriptorProto) bool {…} does not match inferred type func(a *descriptorpb.FileDescriptorProto, b *descriptorpb.FileDescriptorProto) int for func(a E, b E) int
?   	github.com/covalenthq/covenet/docs	[no test files]
?   	github.com/covalenthq/covenet/testutil	[no test files]
FAIL	github.com/covalenthq/covenet/app [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet/client/cli [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet/keeper [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet/types [build failed]
FAIL

@noslav
Copy link
Author

noslav commented Jul 28, 2024

I believe the problem is here

/Users/pranay/.asdf/installs/golang/1.21.0/packages/pkg/mod/github.com/cosmos/[email protected]/proto/merge.go

	slices.SortFunc(fds.File, func(x, y *descriptorpb.FileDescriptorProto) bool {
		return *x.Name < *y.Name
	})

I see this slices.SortFunc package/fn is only usable since golang 1.21, so I tried upgrading to golang 1.21 as well but still failed here -

go test ./...                                                    ─╯
# github.com/cosmos/gogoproto/proto
../../../../.asdf/installs/golang/1.21.0/packages/pkg/mod/github.com/cosmos/[email protected]/proto/merge.go:123:28: type func(x *descriptorpb.FileDescriptorProto, y *descriptorpb.FileDescriptorProto) bool of func(x, y *descriptorpb.FileDescriptorProto) bool {…} does not match inferred type func(a *descriptorpb.FileDescriptorProto, b *descriptorpb.FileDescriptorProto) int for func(a E, b E) int
?   	github.com/covalenthq/covenet/docs	[no test files]
?   	github.com/covalenthq/covenet/testutil	[no test files]
FAIL	github.com/covalenthq/covenet/app [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet/client/cli [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet/keeper [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet/types [build failed]
FAIL

@julienrbrt
Copy link
Member

v0.47 cannot use the latest gogoproto due to a breaking change in the Go x/exp library

@noslav
Copy link
Author

noslav commented Jul 30, 2024

v0.47 cannot use the latest gogoproto due to a breaking change in the Go x/exp library

it is using -> github.com/cosmos/gogoproto v1.4.10 this is not the latest (there's v1.4.11/12 and v1.5.0)

@noslav
Copy link
Author

noslav commented Jul 30, 2024

v0.47 cannot use the latest gogoproto due to a breaking change in the Go x/exp library

I see that issue here - how to resolve it?

please note the version of gogoproto is only 1.4.10 (with x.xx.11 and x.xx.12 available) while latest is 1.5.0

../../../../.asdf/installs/golang/1.21.0/packages/pkg/mod/github.com/cosmos/[email protected]/proto/merge.go:260:25: type func(x *descriptorpb.FileDescriptorProto, y *descriptorpb.FileDescriptorProto) bool of func(x, y *descriptorpb.FileDescriptorProto) bool {…} does not match inferred type func(a *descriptorpb.FileDescriptorProto, b *descriptorpb.FileDescriptorProto) int for func(a E, b E) int
?   	github.com/covalenthq/covenet/docs	[no test files]
?   	github.com/covalenthq/covenet/testutil	[no test files]
FAIL	github.com/covalenthq/covenet/app [build failed]
FAIL	github.com/covalenthq/covenet/cmd/covenetd/cmd [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet/client/cli [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet/keeper [build failed]
FAIL	github.com/covalenthq/covenet/x/covenet/types [build failed]
FAIL

@julienrbrt
Copy link
Member

Do you have this line in your app go.mod:

	// stick with compatible version or x/exp in v0.47.x line
	golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb

@noslav
Copy link
Author

noslav commented Aug 2, 2024

that resolved it! thanks! However I'm now on golang 1.19 with SDK v0.46.12

go 1.19

require (
	github.com/cosmos/cosmos-sdk v0.46.12
	github.com/golang/protobuf v1.5.4
	github.com/gorilla/mux v1.8.0
	github.com/grpc-ecosystem/grpc-gateway v1.16.0
	github.com/spf13/cast v1.5.0
	github.com/spf13/cobra v1.6.1
	github.com/stretchr/testify v1.8.4
	google.golang.org/grpc v1.64.1
	gopkg.in/yaml.v2 v2.4.0
)

require (
	cosmossdk.io/errors v1.0.0-beta.7
	github.com/cosmos/gogoproto v1.4.10
	github.com/cosmos/ibc-go/v5 v5.0.0
	github.com/ethereum/go-ethereum v1.10.26
	github.com/gogo/protobuf v1.3.3
	github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0
	github.com/ignite/cli v0.25.1
	github.com/spf13/pflag v1.0.5
	github.com/spf13/viper v1.13.0
	github.com/tendermint/spn v0.2.1-0.20220921200247-8bafad876bdd
	github.com/tendermint/tendermint v0.34.27
	github.com/tendermint/tm-db v0.6.7
	google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1
)

The next version upgrade is going to be interesting.

@noslav noslav closed this as completed Aug 2, 2024
@noslav
Copy link
Author

noslav commented Aug 6, 2024

Do you have this line in your app go.mod:

	// stick with compatible version or x/exp in v0.47.x line
	golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb

Can you please provide me the source for this file - if you have it? @julienrbrt

@julienrbrt
Copy link
Member

Do you have this line in your app go.mod:

	// stick with compatible version or x/exp in v0.47.x line
	golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb

Can you please provide me the source for this file - if you have it? @julienrbrt

You should just add a replace golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb at the end of the scaffolded go.mod in your chain

@noslav
Copy link
Author

noslav commented Aug 13, 2024

Do you have this line in your app go.mod:

	// stick with compatible version or x/exp in v0.47.x line
	golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb

Can you please provide me the source for this file - if you have it? @julienrbrt

You should just add a replace golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb at the end of the scaffolded go.mod in your chain

I understood that @julienrbrt, I'm just wondering where you've been getting the actual replacements. Is this something you've used internally? or is an external team building on the cosmos-sdk also doing the same? (and if so can we see the source file)

@julienrbrt
Copy link
Member

Chiming back here, we've deleted the x/exp dependency in gogoproto 1.7.0.

@julienrbrt
Copy link
Member

To answer your question, from here: https://github.com/cosmos/cosmos-sdk/blob/release/v0.47.x/go.mod#L202-L203
However, as mentioned above, we've fixed the root issue in gogoproto by removing the problematic dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🥳 Done
Development

No branches or pull requests

2 participants