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

docs: cgo secp256k1 ldflags #18357

Merged
merged 4 commits into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 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,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"`
Loading