diff --git a/Makefile b/Makefile index ec2afb88d9..f1ce7b6fe6 100644 --- a/Makefile +++ b/Makefile @@ -14,9 +14,7 @@ GOFLAGS := "" GOLANG_CROSS_VERSION ?= v1.22.4 GOPATH ?= '$(HOME)/go' -# --allow-multiple-definitions need to be set when you are importing both cosmos-sdk -# and go-ethereum: https://github.com/cosmos/cosmos-sdk/tree/release/v0.47.x/crypto/keys/secp256k1/internal/secp256k1 -ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \ +build_ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \ -X github.com/cosmos/cosmos-sdk/version.ServerName=zetacored \ -X github.com/cosmos/cosmos-sdk/version.ClientName=zetaclientd \ -X github.com/cosmos/cosmos-sdk/version.Version=$(NODE_VERSION) \ @@ -25,16 +23,19 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \ -X github.com/zeta-chain/node/pkg/constant.Version=$(NODE_VERSION) \ -X github.com/zeta-chain/node/pkg/constant.CommitHash=$(NODE_COMMIT) \ -X github.com/zeta-chain/node/pkg/constant.BuildTime=$(BUILDTIME) \ - -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb \ - -extldflags=-Wl,--allow-multiple-definition + -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb + +# --allow-multiple-definitions need to be set when you are importing both cosmos-sdk +# and go-ethereum: https://github.com/cosmos/cosmos-sdk/tree/release/v0.47.x/crypto/keys/secp256k1/internal/secp256k1 +all_ldflags = -extldflags=-Wl,--allow-multiple-definition # enable libsecp256k1_sdk to bypass the btcec breaking change: # https://github.com/btcsuite/btcd/issues/2243 -BUILD_FLAGS := -ldflags '$(ldflags)' -tags pebbledb,ledger,libsecp256k1_sdk +BUILD_FLAGS := -ldflags '$(build_ldflags) $(all_ldflags)' -tags pebbledb,ledger,libsecp256k1_sdk TEST_DIR ?= "./..." -TEST_BUILD_FLAGS := -ldflags=all="-extldflags=-Wl,--allow-multiple-definition" -tags pebbledb,ledger,libsecp256k1_sdk -HSM_BUILD_FLAGS := -ldflags=all="-extldflags=-Wl,--allow-multiple-definition" -tags pebbledb,ledger,hsm_test +TEST_BUILD_FLAGS := -ldflags='$(all_ldflags)' -tags pebbledb,ledger,libsecp256k1_sdk +HSM_BUILD_FLAGS := -ldflags='$(all_ldflags)' -tags pebbledb,ledger,libsecp256k1_sdk,hsm_test export DOCKER_BUILDKIT := 1 diff --git a/contrib/rpcimportable/test.sh b/contrib/rpcimportable/test.sh index 16a536f7d3..3ba925bc6f 100755 --- a/contrib/rpcimportable/test.sh +++ b/contrib/rpcimportable/test.sh @@ -6,4 +6,9 @@ set -eo pipefail cd "$(dirname "$0")" -go test -tags libsecp256k1_sdk -ldflags=all="-extldflags=-Wl,--allow-multiple-definition" ./... +# --allow-multiple-definitions need to be set when you are importing both cosmos-sdk +# and go-ethereum: https://github.com/cosmos/cosmos-sdk/tree/release/v0.47.x/crypto/keys/secp256k1/internal/secp256k1 +# +# enable libsecp256k1_sdk to bypass the btcec breaking change: +# https://github.com/btcsuite/btcd/issues/2243 +go test -tags libsecp256k1_sdk -ldflags="-extldflags=-Wl,--allow-multiple-definition" ./...