Gravity-Bridge / Gravity-Bridge

The official repository of the Gravity Bridge Blockchain
Apache License 2.0
150 stars 109 forks source link

unable to compil gravity v1.8.1 on ARM 64 platform #248

Open rmadrona opened 1 year ago

rmadrona commented 1 year ago

go module make fails on arm64 platform, there seems to be a deprecated dependency on cosmos sdk compilation was still OK for version 1.7.2 and I have 2 sentry nodes not running on ARM64

After git cloning and processig all install steps documented in here

After a few minor changes in Makefile attached ~/.gravity/Gravity-Bridge/module$ go version go version go1.19.1 linux/arm64

uname -a Linux newton02 5.15.80-rockchip64 #22.11.1 SMP PREEMPT Wed Nov 30 11:12:47 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

~/.gravity/Gravity-Bridge/module$ make export GOFLAGS='-buildmode=pie' export CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2" export CGO_LDFLAGS="-Wl,-z,relro,-z,now -fstack-protector" go install -tags "netgo ledger" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=gravity -X github.com/cosmos/cosmos-sdk/version.AppName=gravity -X github.com/cosmos/cosmos-sdk/version.Version=v1.8.1-dirty -X github.com/cosmos/cosmos-sdk/version.Commit=ea35ec51aa921f60bb0911bd5482f12a438241e0 -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger" ' -gcflags="all=-N -l" ./cmd/gravity

github.com/cosmos/cosmos-sdk/store/iavl

../../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/tree.go:10:11: cannot use (immutableTree)(nil) (value of type immutableTree) as type Tree in variable declaration: immutableTree does not implement Tree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/tree.go:11:11: cannot use (iavl.MutableTree)(nil) (value of type "github.com/cosmos/iavl".MutableTree) as type Tree in variable declaration: "github.com/cosmos/iavl".MutableTree does not implement Tree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:69:9: cannot use tree (variable of type "github.com/cosmos/iavl".MutableTree) as type Tree in struct literal: "github.com/cosmos/iavl".MutableTree does not implement Tree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:81:9: cannot use tree (variable of type "github.com/cosmos/iavl".MutableTree) as type Tree in struct literal: "github.com/cosmos/iavl".MutableTree does not implement Tree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:92:23: cannot use &immutableTree{…} (value of type immutableTree) as type Tree in struct literal: immutableTree does not implement Tree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:101:9: cannot use &immutableTree{…} (value of type immutableTree) as type Tree in struct literal: immutableTree does not implement Tree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:209:7: impossible type switch case: immutableTree st.tree (variable of type Tree) cannot have dynamic type immutableTree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:211:7: impossible type switch case: iavl.MutableTree st.tree (variable of type Tree) cannot have dynamic type "github.com/cosmos/iavl".MutableTree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:223:7: impossible type switch case: immutableTree st.tree (variable of type Tree) cannot have dynamic type immutableTree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:225:7: impossible type switch case: iavl.MutableTree st.tree (variable of type Tree) cannot have dynamic type "github.com/cosmos/iavl".MutableTree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:101:9: too many errors make: *** [Makefile:60: install] Error 2

rmadrona commented 1 year ago

Makefile.txt

jkilpatr commented 1 year ago

this seems more like a deps or a go issue than an arch specific issue. But I'll try to investigate.

rmadrona commented 1 year ago

Hello @jkilpatr I agree there is a dependency error, and I am not able to fix it. I have repeated the same build error on another clean ARM machine : quartz64a with 6.1.0-rc1 linux kernel As a next step I will make a PR for the adjusted makefile so anyone having a raspberry can try to build. I am probably the only guy running GB on ARM64, and i think it is important to keep diversity and be more power efficient with such devices acting as relays. Please consider keeping compatibility for this platform.

flower@pimox01:~/Gravity-Bridge/module$ make export GOFLAGS='-buildmode=pie' export CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2" export CGO_LDFLAGS="-Wl,-z,relro,-z,now -fstack-protector" go install -tags "netgo ledger" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=gravity -X github.com/cosmos/cosmos-sdk/version.AppName=gravity -X github.com/cosmos/cosmos-sdk/version.Version=v1.8.2-dirty -X github.com/cosmos/cosmos-sdk/version.Commit=effa7539034369c0df51bf56e40d00c3b6956454 -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo ledger," ' -gcflags="all=-N -l" ./cmd/gravity go: downloading github.com/ethereum/go-ethereum v1.10.16 go: downloading github.com/evmos/ethermint v0.17.0 go: downloading github.com/spf13/cast v1.5.0 go: downloading github.com/pkg/errors v0.9.1 go: downloading github.com/spf13/cobra v1.5.0 go: downloading github.com/tendermint/tendermint v0.34.21 go: downloading github.com/tendermint/tm-db v0.6.7 go: downloading github.com/gorilla/mux v1.8.0 go: downloading github.com/osmosis-labs/bech32-ibc v0.3.0-rc1 go: downloading github.com/rakyll/statik v0.1.7 go: downloading google.golang.org/grpc v1.33.2 go: downloading github.com/rs/zerolog v1.27.0 go: downloading github.com/spf13/pflag v1.0.5 go: downloading github.com/spf13/viper v1.12.0 go: downloading github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 go: downloading github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d go: downloading github.com/cosmos/go-bip39 v1.0.0 go: downloading github.com/tendermint/go-amino v0.16.0 go: downloading github.com/btcsuite/btcd v0.22.1 go: downloading github.com/99designs/keyring v1.1.6 go: downloading github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 go: downloading github.com/stretchr/testify v1.8.0 go: downloading github.com/deckarep/golang-set v1.8.0 go: downloading github.com/google/uuid v1.3.0 go: downloading golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e go: downloading github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce go: downloading github.com/tyler-smith/go-bip39 v1.1.0 go: downloading github.com/go-kit/log v0.2.1 go: downloading github.com/go-logfmt/logfmt v0.5.1 go: downloading github.com/gogo/gateway v1.1.0 go: downloading github.com/gorilla/handlers v1.5.1 go: downloading github.com/cosmos/cosmos-sdk/ics23 v0.0.0-20221014140410-2582f0aab7b2 go: downloading github.com/armon/go-metrics v0.4.0 go: downloading github.com/google/btree v1.0.1 go: downloading github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 go: downloading golang.org/x/net v0.0.0-20220726230323-06994584191e go: downloading github.com/cosmos/btcutil v1.0.4 go: downloading github.com/improbable-eng/grpc-web v0.15.0 go: downloading github.com/coinbase/rosetta-sdk-go v0.7.0 go: downloading github.com/mattn/go-colorable v0.1.12 go: downloading github.com/fsnotify/fsnotify v1.5.4 go: downloading github.com/mitchellh/mapstructure v1.5.0 go: downloading github.com/spf13/afero v1.8.2 go: downloading github.com/spf13/jwalterweatherman v1.1.0 go: downloading github.com/lib/pq v1.10.6 go: downloading github.com/prometheus/client_golang v1.12.2 go: downloading github.com/rs/cors v1.8.2 go: downloading github.com/go-kit/kit v0.12.0 go: downloading github.com/prometheus/common v0.34.0 go: downloading github.com/bgentry/speakeasy v0.1.0 go: downloading github.com/mattn/go-isatty v0.0.14 go: downloading github.com/cosmos/ledger-cosmos-go v0.11.1 go: downloading github.com/tendermint/btcd v0.1.1 go: downloading github.com/davecgh/go-spew v1.1.1 go: downloading github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b go: downloading github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 go: downloading github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c go: downloading github.com/mitchellh/go-homedir v1.1.0 go: downloading github.com/mtibben/percent v0.2.1 go: downloading github.com/go-stack/stack v1.8.0 go: downloading github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 go: downloading github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 go: downloading github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d go: downloading github.com/gorilla/websocket v1.5.0 go: downloading github.com/felixge/httpsnoop v1.0.1 go: downloading github.com/holiman/uint256 v1.2.0 go: downloading golang.org/x/text v0.3.7 go: downloading github.com/hashicorp/go-immutable-radix v1.3.1 go: downloading golang.org/x/sys v0.0.0-20220727055044-e65921a090b8 go: downloading github.com/cenkalti/backoff/v4 v4.1.2 go: downloading github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f go: downloading nhooyr.io/websocket v1.8.6 go: downloading github.com/subosito/gotenv v1.4.0 go: downloading github.com/hashicorp/hcl v1.0.0 go: downloading gopkg.in/ini.v1 v1.66.6 go: downloading github.com/magiconair/properties v1.8.6 go: downloading github.com/pelletier/go-toml/v2 v2.0.2 go: downloading gopkg.in/yaml.v3 v3.0.1 go: downloading github.com/google/orderedcode v0.0.1 go: downloading github.com/pelletier/go-toml v1.9.5 go: downloading github.com/creachadair/taskgroup v0.3.2 go: downloading github.com/Workiva/go-datastructures v1.0.53 go: downloading github.com/minio/highwayhash v1.0.2 go: downloading github.com/prometheus/client_model v0.2.0 go: downloading github.com/beorn7/perks v1.0.1 go: downloading github.com/cespare/xxhash/v2 v2.1.2 go: downloading github.com/prometheus/procfs v0.7.3 go: downloading github.com/gtank/merlin v0.1.1 go: downloading github.com/cespare/xxhash v1.1.0 go: downloading github.com/libp2p/go-buffer-pool v0.1.0 go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 go: downloading github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 go: downloading github.com/cosmos/ledger-go v0.9.2 go: downloading golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 go: downloading github.com/pmezard/go-difflib v1.0.0 go: downloading filippo.io/edwards25519 v1.0.0-beta.2 go: downloading github.com/gtank/ristretto255 v0.1.2 go: downloading github.com/golang/snappy v0.0.4 go: downloading github.com/olekukonko/tablewriter v0.0.5 go: downloading github.com/prometheus/tsdb v0.7.1 go: downloading github.com/VictoriaMetrics/fastcache v1.6.0 go: downloading github.com/holiman/bloomfilter/v2 v2.0.3 go: downloading github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible go: downloading github.com/klauspost/compress v1.15.9 go: downloading github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 go: downloading github.com/zondax/hid v0.9.0 go: downloading github.com/mattn/go-runewidth v0.0.9 go: downloading github.com/tklauser/go-sysconf v0.3.7 go: downloading github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff go: downloading github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 go: downloading github.com/edsrzf/mmap-go v1.0.0 go: downloading github.com/tklauser/numcpus v0.2.3 go: downloading github.com/huin/goupnp v1.0.2 go: downloading github.com/jackpal/go-nat-pmp v1.0.2 go: downloading golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4

github.com/cosmos/cosmos-sdk/store/iavl

../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/tree.go:10:11: cannot use (immutableTree)(nil) (value of type immutableTree) as type Tree in variable declaration: immutableTree does not implement Tree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/tree.go:11:11: cannot use (iavl.MutableTree)(nil) (value of type "github.com/cosmos/iavl".MutableTree) as type Tree in variable declaration: "github.com/cosmos/iavl".MutableTree does not implement Tree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:69:9: cannot use tree (variable of type "github.com/cosmos/iavl".MutableTree) as type Tree in struct literal: "github.com/cosmos/iavl".MutableTree does not implement Tree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:81:9: cannot use tree (variable of type "github.com/cosmos/iavl".MutableTree) as type Tree in struct literal: "github.com/cosmos/iavl".MutableTree does not implement Tree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:92:23: cannot use &immutableTree{…} (value of type immutableTree) as type Tree in struct literal: immutableTree does not implement Tree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:101:9: cannot use &immutableTree{…} (value of type immutableTree) as type Tree in struct literal: immutableTree does not implement Tree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:209:7: impossible type switch case: immutableTree st.tree (variable of type Tree) cannot have dynamic type immutableTree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:211:7: impossible type switch case: iavl.MutableTree st.tree (variable of type Tree) cannot have dynamic type "github.com/cosmos/iavl".MutableTree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:223:7: impossible type switch case: immutableTree st.tree (variable of type Tree) cannot have dynamic type immutableTree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:225:7: impossible type switch case: iavl.MutableTree st.tree (variable of type Tree) cannot have dynamic type "github.com/cosmos/iavl".MutableTree (wrong type for Get method) have Get(key []byte) ([]byte, error) want Get(key []byte) (index int64, value []byte) ../../go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.5-0.20220523154235-2921a1c3c918/store/iavl/store.go:101:9: too many errors make: *** [Makefile:60: install] Error 2

jkilpatr commented 1 year ago

Thanks for bumping this. I haven't had time to dig into it properly. Really importing ethermint for it's key types has ruined what was otherwise a pretty straightforward cross compile situation. Hoping to resolve it soon.

rmadrona commented 1 year ago

Thanks for your answer. It is hard to understand why it is so critical to make cross compilation. Such ARM device is pretty cheap less than 100$ and can do a great job.

PhuongDo896 commented 1 year ago

I'm on wsl2 (ubuntu22.04) and im also have this problem