<p>It looks like you're having linker errors, possibly due to the way you're installing and configuring the BerkeleyDB. It would help to post the output of the <code>./configure</code> command. Bitcoin-core recommends installing it using the Bitcoin PPA:</p>

<pre><code>sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev
</code></pre>

<p>Then you don't have to run <code>./configure</code> with the <code>LDFLAGS</code> and<code>CPPFLAGS</code> for BerkeleyDB.</p>

<p>I would recommend following the <a href="https://github.com/bitcoin/bitcoin/blob/v0.17.0/doc/build-unix.md" rel="nofollow noreferrer">UNIX build instructions</a> in the repository. First download the source code for the release you want from the <a href="https://github.com/bitcoin/bitcoin/releases" rel="nofollow noreferrer">repository releases</a>.</p>

<pre><code>$ tar xvzf v0.17.0.tar.gz &amp;&amp; cd v0.17.0
</code></pre>

<p>Then follow the instructions in the link above.</p>

CC BY-SA 4.0
2018-10-18T13:39:19.403Z
2018-10-18T13:39:19.403Z
JBaczuk
<p>I'm getting error after make command like,</p>

<p><strong>undefined reference to `BlockAssembler::BlockAssembler(CChainParams const&amp;)'</strong></p>

<p>and in last </p>

<p><strong>Makefile:774: recipe for target 'all-recursive' failed</strong></p>

<p><strong>make: **[all-recursive] Error 1</strong></p>

<p>I have followed all steps given here:-</p>

<p><a href="https://www.toshblocks.com/bitcoin/compile-bitcoin-source-code-ubuntu-16-04-lts/" rel="nofollow noreferrer">https://www.toshblocks.com/bitcoin/compile-bitcoin-source-code-ubuntu-16-04-lts/</a></p>

<p>Output :-</p>

<pre><code> Making all in src
    make[1]: Entering directory '/home/khushbu/bitcoin/src'
    make[2]: Entering directory '/home/khushbu/bitcoin/src'
    make[3]: Entering directory '/home/khushbu/bitcoin'
    make[3]: Leaving directory '/home/khushbu/bitcoin'
      CXXLD    bitcoind
    libbitcoin_server.a(libbitcoin_server_a-mining.o): In function `generateBlocks(std::shared_ptr&lt;CReserveScript&gt;, int, unsigned long, bool)':
    /home/khushbu/bitcoin/src/rpc/mining.cpp:122: undefined reference to `BlockAssembler::BlockAssembler(CChainParams const&amp;)'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:122: undefined reference to `BlockAssembler::CreateNewBlock(CScript const&amp;, bool)'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:128: undefined reference to `IncrementExtraNonce(CBlock*, CBlockIndex const*, unsigned int&amp;)'
    libbitcoin_server.a(libbitcoin_server_a-mining.o): In function `getmininginfo(JSONRPCRequest const&amp;)':
    /home/khushbu/bitcoin/src/rpc/mining.cpp:216: undefined reference to `nLastBlockWeight'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:217: undefined reference to `nLastBlockTx'
    libbitcoin_server.a(libbitcoin_server_a-mining.o): In function `getblocktemplate(JSONRPCRequest const&amp;)':
    /home/khushbu/bitcoin/src/rpc/mining.cpp:521: undefined reference to `BlockAssembler::BlockAssembler(CChainParams const&amp;)'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:521: undefined reference to `BlockAssembler::CreateNewBlock(CScript const&amp;, bool)'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:533: undefined reference to `UpdateTime(CBlockHeader*, Consensus::Params const&amp;, CBlockIndex const*)'
    collect2: error: ld returned 1 exit status
    Makefile:3888: recipe for target 'bitcoind' failed
    make[2]: *** [bitcoind] Error 1
    make[2]: Leaving directory '/home/khushbu/bitcoin/src'
    Makefile:10190: recipe for target 'all-recursive' failed
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory '/home/khushbu/bitcoin/src'
    Makefile:774: recipe for target 'all-recursive' failed
    make: *** [all-recursive] Error 1
</code></pre>

<p>How to solve this error and compile bitcoin source code successfully?</p>

<bitcoin-core><bitcoind><c++><make>
bitcoin compile (.undefined reference to **')
levi
# bitcoin compile (.undefined reference to **')

(Asked by: username_0 on 2018-10-18)

I'm getting error after make command like,
undefined reference to `BlockAssembler::BlockAssembler(CChainParams const&)'
and in last 
Makefile:774: recipe for target 'all-recursive' failed
make: **[all-recursive] Error 1
I have followed all steps given here:-
https://www.toshblocks.com/bitcoin/compile-bitcoin-source-code-ubuntu-16-04-lts/
Output :-
 Making all in src
    make[1]: Entering directory '/home/khushbu/bitcoin/src'
    make[2]: Entering directory '/home/khushbu/bitcoin/src'
    make[3]: Entering directory '/home/khushbu/bitcoin'
    make[3]: Leaving directory '/home/khushbu/bitcoin'
      CXXLD    bitcoind
    libbitcoin_server.a(libbitcoin_server_a-mining.o): In function `generateBlocks(std::shared_ptr, int, unsigned long, bool)':
    /home/khushbu/bitcoin/src/rpc/mining.cpp:122: undefined reference to `BlockAssembler::BlockAssembler(CChainParams const&)'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:122: undefined reference to `BlockAssembler::CreateNewBlock(CScript const&, bool)'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:128: undefined reference to `IncrementExtraNonce(CBlock*, CBlockIndex const*, unsigned int&)'
    libbitcoin_server.a(libbitcoin_server_a-mining.o): In function `getmininginfo(JSONRPCRequest const&)':
    /home/khushbu/bitcoin/src/rpc/mining.cpp:216: undefined reference to `nLastBlockWeight'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:217: undefined reference to `nLastBlockTx'
    libbitcoin_server.a(libbitcoin_server_a-mining.o): In function `getblocktemplate(JSONRPCRequest const&)':
    /home/khushbu/bitcoin/src/rpc/mining.cpp:521: undefined reference to `BlockAssembler::BlockAssembler(CChainParams const&)'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:521: undefined reference to `BlockAssembler::CreateNewBlock(CScript const&, bool)'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:533: undefined reference to `UpdateTime(CBlockHeader*, Consensus::Params const&, CBlockIndex const*)'
    collect2: error: ld returned 1 exit status
    Makefile:3888: recipe for target 'bitcoind' failed
    make[2]: *** [bitcoind] Error 1
    make[2]: Leaving directory '/home/khushbu/bitcoin/src'
    Makefile:10190: recipe for target 'all-recursive' failed
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory '/home/khushbu/bitcoin/src'
    Makefile:774: recipe for target 'all-recursive' failed
    make: *** [all-recursive] Error 1

How to solve this error and compile bitcoin source code successfully?

**Tags:** bitcoin-core, bitcoind, c++, make


---

## 1 answers

### Answer by username_1 on 2018-10-18. Score: 0 | Accepted answer

It looks like you're having linker errors, possibly due to the way you're installing and configuring the BerkeleyDB. It would help to post the output of the ./configure command. Bitcoin-core recommends installing it using the Bitcoin PPA:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev

Then you don't have to run ./configure with the LDFLAGS andCPPFLAGS for BerkeleyDB.
I would recommend following the UNIX build instructions in the repository. First download the source code for the release you want from the repository releases.
$ tar xvzf v0.17.0.tar.gz && cd v0.17.0

Then follow the instructions in the link above.


---

