<p>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</p>

<pre><code>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
</code></pre>

<p>to make the compiler use it when building, call the configure script like this</p>

<pre><code>./configure LDFLAGS="-L/yourfavoritepath/db4/lib/" CPPFLAGS="-I/yourfavoritepath/db4/include/"
</code></pre>

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

CC BY-SA 3.0
2018-01-27T20:55:15.590Z
2018-01-27T20:55:15.590Z
SarahS
<p>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.</p>

CC BY-SA 3.0
2018-01-17T20:47:36.710Z
I would have made this a comment rather than answer, but lack the required reputation :(
Henry
CC BY-SA 3.0
2018-01-17T20:41:17.623Z
2018-01-17T20:41:17.623Z
Henry
<p>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:</p>

<pre><code>  CXXLD    libbitcoinconsensus.la
.libs/libbitcoinconsensus_la-arith_uint256.o: In function `base_uint&lt;256u&gt;::GetHex() const':
/root/xeroxcoin/src/arith_uint256.cpp:135: undefined reference to `base_blob&lt;256u&gt;::GetHex() const'
.libs/libbitcoinconsensus_la-arith_uint256.o: In function `uint256S(char const*)':
/root/xeroxcoin/src/uint256.h:123: undefined reference to `base_blob&lt;256u&gt;::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&lt;256u&gt;::ToString() const'
/root/xeroxcoin/src/primitives/block.cpp:22: undefined reference to `base_blob&lt;256u&gt;::ToString() const'
/root/xeroxcoin/src/primitives/block.cpp:22: undefined reference to `base_blob&lt;256u&gt;::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&lt;256u&gt;::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&lt;256u&gt;::ToString() const'
script/.libs/libbitcoinconsensus_la-interpreter.o: In function `uint256S(char const*)':
/root/xeroxcoin/src/./uint256.h:123: undefined reference to `base_blob&lt;256u&gt;::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
</code></pre>

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

<altcoin><compiling><c++><ecash>
C++ error building a fork of Bitcoin-ABC
Spencer Dupre
# C++ error building a fork of Bitcoin-ABC

(Asked by: username_0 on 2017-12-30)

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?

**Tags:** altcoin, compiling, c++, ecash


---

## 2 answers

### Answer by username_1 on 2018-01-27. Score: 0 | Accepted answer

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.


---

### Answer by username_2 on 2018-01-17. Score: 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.

> **Comments:**
> **username_2**: I would have made this a comment rather than answer, but lack the required reputation :(  

---

