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

[Bug]: use of cgo secp256k1 conflicts with geth imports #18232

Closed
1 task done
Tracked by #18022
tac0turtle opened this issue Oct 24, 2023 · 2 comments · Fixed by #18357
Closed
1 task done
Tracked by #18022

[Bug]: use of cgo secp256k1 conflicts with geth imports #18232

tac0turtle opened this issue Oct 24, 2023 · 2 comments · Fixed by #18357
Assignees
Labels
S:zondax Squad: Zondax T:Bug

Comments

@tac0turtle
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

when importing go ethereum and using cgo version of secp256k1 in the sdk there is a c linker issue

Cosmos SDK Version

all

How to reproduce?

import the sdk and geth, then try to compile

@JulianToledano
Copy link
Contributor

Dropping here the linker issue I'm getting:

# secp256k1Geth
/Users/juliantoledano/go/go1.21.0/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
duplicate symbol '_secp256k1_ec_pubkey_serialize' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_context_set_error_callback' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_nonce_function_default' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ec_pubkey_create' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ecdsa_signature_serialize_der' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ecdsa_recoverable_signature_serialize_compact' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ec_pubkey_combine' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ecdsa_signature_parse_der' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_context_randomize' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ecdsa_signature_serialize_compact' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ec_privkey_tweak_add' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_CURVE_B' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ecdsa_recoverable_signature_parse_compact' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ecdsa_sign_recoverable' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1GoPanicError' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000000.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000004.o
duplicate symbol '_secp256k1_context_destroy' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ecdsa_verify' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_context_create' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ec_seckey_verify' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ext_scalar_mul' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ec_pubkey_tweak_add' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ecdsa_recover' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_context_set_illegal_callback' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ec_pubkey_tweak_mul' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ec_pubkey_parse' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ecdsa_signature_normalize' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ecdsa_sign' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ecdsa_recoverable_signature_convert' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_nonce_function_rfc6979' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1GoPanicIllegal' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000000.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000004.o
duplicate symbol '_secp256k1_context_clone' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ecdsa_signature_parse_compact' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
duplicate symbol '_secp256k1_ec_privkey_tweak_mul' in:
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000007.o
    /private/var/folders/xq/xwhqh6b97xzd4lcyljrw7zwc0000gn/T/go-link-926635741/000003.o
ld: 33 duplicate symbols
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@JulianToledano
Copy link
Contributor

JulianToledano commented Oct 27, 2023

If working with linux and gcc building with -ldflags=all="-extldflags=-Wl,--allow-multiple-definition" should work. Still looking for a solution on mac, as --allow-multiple-definition cannot be used.

Probably we'll need to rename all duplicate symbols to avoid the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S:zondax Squad: Zondax T:Bug
Projects
None yet
3 participants