c++ - 比特币编译(.undefined 对 `BlockAssembler::BlockAssembler(CChainParams const&)' 的引用)
问题描述
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
如何解决这个错误并成功编译比特币源代码?
解决方案
本教程帮助我解决了这个问题。
https://www.youtube.com/watch?v=l0A91Yx9juQ
通过,按照 Unix 构建说明,
https://github.com/bitcoin/bitcoin/blob/master/doc/build-UNIX.md
并下载所需的依赖项可以解决问题。我认为问题是由于 Berkeley DB 安装错误导致的,所以我删除了所有旧文件,然后再次按照 build-UNIX.md 中的步骤操作。
并下载依赖项,
sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3
sudo apt-get install libssl-dev libevent-dev libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev
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
这对我有用。谢谢!
推荐阅读
- docker - 无法访问 kubernetes + rancher 中的 KubeAPI 端口
- react-native - 在 react-native 中减去 2 次
- image - 将图像放入 x11 中的窗口
- python - pandas dtype 输出有额外的行
- javascript - 筛选选项以恢复所有结果
- java - 通过 Groovy 脚本访问 Java 局部变量
- c# - 尝试通过来自数据库触发器的 Web 请求执行“EXECUTE Master.dbo.xp_CmdShell”命令以在本地创建文本文件时发生错误
- react-native - 如何在本机反应中实现时间选择器功能
- python - 使用 Scrapy 在 imdb 中抓取每个单独的电影站点
- javascript - 当没有从我的表中选择记录时,如何在按钮上放置模式。我正在使用引导程序 4