Can't use in conjunction with bdk
ulrichard opened this issue · 6 comments
I would like to use this library in conjunction with https://crates.io/crates/bdk
But when I uncomment the block starting on line 160 of https://github.com/ulrichard/bdk/blob/feature/proof_of_reserves/src/wallet/reserves.rs, I get a linker error. I never had a linker error in rust before.
DWARF error: could not find variable specification at offset 739b
bdk/target/debug/deps/libbitcoinconsensus-76f1899f601e64c9.rlib(pubkey.o): in function ecdsa_signature_parse_der_lax(secp256k1_context_struct const*, secp256k1_ecdsa_signature*, unsigned char const*, unsigned long)': .cargo/registry/src/github.com-1ecc6299db9ec823/bitcoinconsensus-0.17.1/bitcoin/src/pubkey.cpp:35: undefined reference to secp256k1_ecdsa_signature_parse_compact'
/usr/bin/ld: .cargo/registry/src/github.com-1ecc6299db9ec823/bitcoinconsensus-0.17.1/bitcoin/src/pubkey.cpp:164: undefined reference to secp256k1_ecdsa_signature_parse_compact' /usr/bin/ld: .cargo/registry/src/github.com-1ecc6299db9ec823/bitcoinconsensus-0.17.1/bitcoin/src/pubkey.cpp:158: undefined reference to secp256k1_ecdsa_signature_parse_compact'
/usr/bin/ld: bdk/target/debug/deps/libbitcoinconsensus-76f1899f601e64c9.rlib(pubkey.o): in function CPubKey::Verify(uint256 const&, std::vector<unsigned char, std::allocator<unsigned char> > const&) const': .cargo/registry/src/github.com-1ecc6299db9ec823/bitcoinconsensus-0.17.1/bitcoin/src/pubkey.cpp:174: undefined reference to secp256k1_ec_pubkey_parse'
/usr/bin/ld: .cargo/registry/src/github.com-1ecc6299db9ec823/bitcoinconsensus-0.17.1/bitcoin/src/pubkey.cpp:182: undefined reference to secp256k1_ecdsa_signature_normalize' /usr/bin/ld: .cargo/registry/src/github.com-1ecc6299db9ec823/bitcoinconsensus-0.17.1/bitcoin/src/pubkey.cpp:183: undefined reference to secp256k1_ecdsa_verify'
/usr/bin/ld: bdk/target/debug/deps/libbitcoinconsensus-76f1899f601e64c9.rlib(pubkey.o): in function CPubKey::CheckLowS(std::vector<unsigned char, std::allocator<unsigned char> > const&)': .cargo/registry/src/github.com-1ecc6299db9ec823/bitcoinconsensus-0.17.1/bitcoin/src/pubkey.cpp:279: undefined reference to secp256k1_ecdsa_signature_normalize'
/usr/bin/ld: bdk/target/debug/deps/libbitcoinconsensus-76f1899f601e64c9.rlib(pubkey.o): in function ECCVerifyHandle::ECCVerifyHandle()': .cargo/registry/src/github.com-1ecc6299db9ec823/bitcoinconsensus-0.17.1/bitcoin/src/pubkey.cpp:288: undefined reference to secp256k1_context_create'
/usr/bin/ld: bdk/target/debug/deps/libbitcoinconsensus-76f1899f601e64c9.rlib(pubkey.o): in function ECCVerifyHandle::~ECCVerifyHandle()': .cargo/registry/src/github.com-1ecc6299db9ec823/bitcoinconsensus-0.17.1/bitcoin/src/pubkey.cpp:299: undefined reference to secp256k1_context_destroy'
collect2: error: ld returned 1 exit status
If I try to use bitcoinconsensus = "0.19.0-2", I get the following:
error: failed to select a version for cc.
... required by package bitcoinconsensus v0.19.0-2
... which is depended on by bdk v0.5.2-dev (bdk)
versions that meet the requirements >=1.0.36, <=1.0.41 are: 1.0.41, 1.0.40, 1.0.39, 1.0.38, 1.0.37, 1.0.36
all possible versions conflict with previously selected packages.
previously selected package cc v1.0.64
... which is depended on by `bdk v0.5.2-dev
So what is the reason for requiring an older version of cc?
Are you trying to use the external-secp feature?
I didn't explicitly configure anything external-secp related.
If I use the git master instead of a released version from crates.io, these errors are gone.
Maybe time to release a new version?
It would be really great if you could make a release to crates.io. This would allow me to use a released version in bitcoindevkit/bdk#356
Oh, I just realized there was a recent release.
It works for my PR, but crates.io still default to the 0.17 version.
What will be required to default to the newer version?
Can we close this issue @ulrichard?
FTR I don't know what the yellow vs green means for release versions on crates.io but cargo search bitcoinconsensus returns the latest version.
I found out what the yellow means, it means "beta release", which is not what we mean to imply with our version numbering.
Current version is 0.20.2-0.5.0
The stuff before the - is the Bitcoin Core version vendor'ed in depend/bitcoin and the stuff after the - is the version number of this crate. While this is valid semver crates.io treats semver versions with a - as "beta", hence the yellow and cargo defaulting to the first green release (0.17.1) which is really old.
I'm not sure there is anything we can do about this situation, I did add a section to the README a while back. I'm going to close this issue, please re-open if needed. Thanks