Skip to content

Commit

Permalink
docs: cgo secp256k1 ldflags
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianToledano committed Nov 3, 2023
1 parent cd19bac commit dd11805
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crypto/keys/secp256k1/internal/secp256k1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,16 @@
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 makes use of go-ethereum and Cosmos's cgo secp256k1, C linker will fail with duplicated symbols. To avoid
this `ldflags` must set to allow multiple definitions. This only works with Linux machines.

#### Gcc

+ `go build -tags libsecp256k1_sdk -ldflags=all="-extldflags=-Wl,--allow-multiple-definition"`

#### Clang

+ `go build -tags libsecp256k1_sdk -ldflags=all="-extldflags=-zmuldefs"`

0 comments on commit dd11805

Please sign in to comment.