0

I'm creating a Bitcoin-ABC based altcoin, everything was fine when I compiled dynamically for my Ubuntu machine, but when I try making a static release build I get:

  CXXLD    libbitcoinconsensus.la
.libs/libbitcoinconsensus_la-arith_uint256.o: In function `base_uint<256u>::GetHex() const':
/root/xeroxcoin/src/arith_uint256.cpp:135: undefined reference to `base_blob<256u>::GetHex() const'
.libs/libbitcoinconsensus_la-arith_uint256.o: In function `uint256S(char const*)':
/root/xeroxcoin/src/uint256.h:123: undefined reference to `base_blob<256u>::SetHex(char const*)'
primitives/.libs/libbitcoinconsensus_la-block.o: In function `CBlock::ToString[abi:cxx11]() const':
/root/xeroxcoin/src/primitives/block.cpp:23: undefined reference to `base_blob<256u>::ToString() const'
/root/xeroxcoin/src/primitives/block.cpp:22: undefined reference to `base_blob<256u>::ToString() const'
/root/xeroxcoin/src/primitives/block.cpp:22: undefined reference to `base_blob<256u>::ToString() const'
primitives/.libs/libbitcoinconsensus_la-transaction.o: In function `COutPoint::ToString[abi:cxx11]() const':
/root/xeroxcoin/src/primitives/transaction.cpp:13: undefined reference to `base_blob<256u>::ToString() const'
primitives/.libs/libbitcoinconsensus_la-transaction.o: In function `CTransaction::ToString[abi:cxx11]() const':
/root/xeroxcoin/src/primitives/transaction.cpp:132: undefined reference to `base_blob<256u>::ToString() const'
script/.libs/libbitcoinconsensus_la-interpreter.o: In function `uint256S(char const*)':
/root/xeroxcoin/src/./uint256.h:123: undefined reference to `base_blob<256u>::SetHex(char const*)'
collect2: error: ld returned 1 exit status
Makefile:3619: recipe for target 'libbitcoinconsensus.la' failed
make[2]: *** [libbitcoinconsensus.la] Error 1
make[2]: Leaving directory '/root/xeroxcoin/src'
Makefile:9581: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/xeroxcoin/src'
Makefile:690: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

This is with nearly vanilla Bitcoin-ABC code, and it looks to me like base_blob DOES exist and DOES have those methods. Help?

0

I had the same problem. It can be solved by using another version of libdb. The current Ubuntu (17.10) comes with libdb 3.5, but 4 is needed. You can download and build it with

wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix/
../dist/configure --enable-cxx --disable-shared --with-pic --prefix=/yourfavoritepath/db4/
make install

to make the compiler use it when building, call the configure script like this

./configure LDFLAGS="-L/yourfavoritepath/db4/lib/" CPPFLAGS="-I/yourfavoritepath/db4/include/"

and then you can build with make. Be sure to change yourfavoritepath to wherever you want to save libdb4.

0

I'm getting the exact same problem having forked Bitcoin to create a new altcoin. I believe the problem is related to a template being defined in a cpp rather than h file, and the different order of compilation due to file name changes. If I'm correct, then this reveals a subtle bug in the Bitcoin and Bitcoin ABC sources which should be fed back up the chain to assist future forkers.

  • I would have made this a comment rather than answer, but lack the required reputation :( – Henry Jan 17 '18 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.