On Ubuntu 22.04, in the master branch @ 0857f2935f90df9c3d303582e5b62a9c8dedd9d7:
0$ ./autogen.sh
1$ ./configure --without-daemon --without-gui --without-utils --disable-tests --disable-bench --disable-fuzz-binary --disable-shared --prefix=/
2$ make
3$ make DESTDIR=~/CONSENSUS install
4$ g++ testconsensus.cpp -o testconsensus -I ~/CONSENSUS/include -L ~/CONSENSUS/lib -l:libbitcoinconsensus.a
5/usr/bin/ld: /home/hebasto/CONSENSUS/lib/libbitcoinconsensus.a(libbitcoinconsensus_la-pubkey.o): in function `ecdsa_signature_parse_der_lax(secp256k1_ecdsa_signature*, unsigned char const*, unsigned long)':
6./src/pubkey.cpp:50: undefined reference to `secp256k1_context_static'
7/usr/bin/ld: ./src/pubkey.cpp:50: undefined reference to `secp256k1_ecdsa_signature_parse_compact'
8/usr/bin/ld: ./src/pubkey.cpp:179: undefined reference to `secp256k1_ecdsa_signature_parse_compact'
9/usr/bin/ld: ./src/pubkey.cpp:173: undefined reference to `secp256k1_ecdsa_signature_parse_compact'
10...
11$ cat testconsensus.cpp
12#include <iostream>
13
14#include <bitcoinconsensus.h>
15
16int main()
17{
18 std::cout << "bitcoinconsensus version: " << bitcoinconsensus_version() << std::endl;
19 return 0;
20}
It is worth mentioning that the static libbitcoinconsensus.a
library is not shipped as a part of a release package.
However, in the light of upcoming migration to CMake, 100% feature compatibility is expected, and a few options might be considered:
- Fix the current build system.
- Disable building static libraries in the current build system.
- Something else.