From 9c2f464c840cd2ab82d974f3e2e5b1d8430aad41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Toledano?= Date: Fri, 3 Nov 2023 18:07:43 +0100 Subject: [PATCH] docs: cgo secp256k1 ldflags (#18357) Co-authored-by: Marko --- crypto/keys/secp256k1/internal/secp256k1/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crypto/keys/secp256k1/internal/secp256k1/README.md b/crypto/keys/secp256k1/internal/secp256k1/README.md index b621008dff..92183f11fd 100644 --- a/crypto/keys/secp256k1/internal/secp256k1/README.md +++ b/crypto/keys/secp256k1/internal/secp256k1/README.md @@ -3,3 +3,17 @@ This package is copied from https://github.com/ethereum/go-ethereum/tree/8fddf27a989e246659fd018ea9be37b2b4f55326/crypto/secp256k1 Unlike the rest of go-ethereum it is [3-clause BSD](https://opensource.org/licenses/BSD-3-Clause) licensed so compatible with our Apache2.0 license. We opt to copy in here rather than depend on go-ethereum to avoid issues with vendoring of the GPL parts of that repository by downstream. + +## Duplicate Symbols + +If a project is importing [go-ethereum](https://github.com/ethereum/go-ethereum) and the Cosmos SDK, cgo secp256k1 will only work on linux operating systems due to duplicated symbols. If you are testing on a mac, we recommend using a docker container or something similar. + +To avoid duplicate symbol errors `ldflags` must be set to allow for multiple definitions. + +#### Gcc + + + `go build -tags libsecp256k1_sdk -ldflags=all="-extldflags=-Wl,--allow-multiple-definition"` + +#### Clang + + + `go build -tags libsecp256k1_sdk -ldflags=all="-extldflags=-zmuldefs"` \ No newline at end of file