Bitcoin-Core
比特幣編譯(.undefined reference to **’)
make 命令後出現錯誤,例如,
未定義對“BlockAssembler::BlockAssembler(CChainParams const&)”的引用
最後
Makefile:774: 目標“全遞歸”的配方失敗
**make: [all-recursive] 錯誤 1
我已按照此處給出的所有步驟進行操作:-
<https://www.toshblocks.com/bitcoin/compile-bitcoin-source-code-ubuntu-16-04-lts/>
輸出 :-
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<CReserveScript>, 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
如何解決這個錯誤並成功編譯比特幣原始碼?
您似乎遇到了連結器錯誤,這可能是由於您安裝和配置 BerkeleyDB 的方式所致。這將有助於發布
./configure
命令的輸出。Bitcoin-core 建議使用比特幣 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
然後您不必
./configure
使用LDFLAGS
andCPPFLAGS
for BerkeleyDB 執行。我建議遵循儲存庫中的UNIX 建構說明。首先從儲存庫中下載所需版本的原始碼。
$ tar xvzf v0.17.0.tar.gz && cd v0.17.0
然後按照上面連結中的說明進行操作。