如何在VMware虚拟机的ubuntu系统下编译bitccoin core钱包

最近在学习区块链的原理之后,偿试对bitcoin的代码进行编译 ,首先在windows 下进行编译,但依赖库太多,最终没有安装成功,后来偿试在linux下,没有用过,百度下,决定用ubunto的系统,由于没有单机,只好采用VMware虚拟机下安装系统,最终成功,下边分享:

要求环境:

1.主机:win10/win2008,内存8G以上
2.软件:VMware® Workstation 12 Pro虚拟机
Ubuntu17.10 64位
3.比特币源码资料下载 :
代码取至https://github.com/bitcoin/bitcoin

实现步骤

1,先安装编译所需依赖库
sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev libevent-dev
复制代码
sudo apt-get install libboost-all-dev
复制代码
sudo apt-get install libdb5.1-dev libdb5.1++-dev
复制代码
sudo apt-get install libminiupnpc-dev
复制代码
sudo apt-get install libqt4-dev libprotobuf-dev protobuf-compiler
复制代码
sudo apt-get install libqrencode-dev
复制代码
这几个工具没装的也要装一下(已经装的会自动略过):
sudo apt-get install make gcc g++ git
复制代码

2,下载源码
git clone https://github.com/bitcoin/bitcoin.git
复制代码
用git拉可能很慢,可以直接去 https://github.com/bitcoin/bitcoin 右下角下载zip压缩包就行了

3,git clone的直接进入目录
cd bitcoin
复制代码
下载的解压后进入文件夹后打开终端

4,
./autogen.sh
复制代码
执行这一步,如果这一步有问题可能上面的依赖没装完整,看提示没问题的话继续下一步

5,
./configure
复制代码
如果你遇到这样的提示:configure: error: Found Berkeley DB other than 4.8, required for portable wallets 那就可以这样:
./configure –with-incompatible-bdb
复制代码
看提示没问题的话继续下一步

6,
make
复制代码
开始编译,我的电脑大约10分钟,然后安装编译好的二进制文件

7,
sudo make install
复制代码
8,接下来就可以运行了
bitcoin-qt
复制代码
这是我的截图

这里写图片描述

依赖库的说明

(1)Bitcoin Core第三方依赖库说明:
基本的第三方依赖:必需安装
libssl: Crypto, Random Number Generation, Elliptic Curve Cryptography
libboost: Utility, Library for threading, data structures, etc
libevent: Networking, OS independent asynchronous networking

根据编译条件可选的第三方依赖
miniupnpc: UPnP Support, Firewall-jumping support
libdb5.1: Berkeley DB, Wallet storage (only needed when wallet enabled)
qt: GUI, GUI toolkit (only needed when GUI enabled)
protobuf: Payments in GUI, Data interchange format used for payment protocol (only needed when GUI enabled)
libqrencode(二维码库): QR codes in GUI, Optional for generating QR codes (only needed when GUI enabled)
univalue: Utility, JSON parsing and encoding (bundled version will be used unless –with-system-univalue passed to configure)
libzmq3: ZMQ notification, Optional, allows generating ZMQ notifications (requires ZMQ version >= 4.x)

安装过程中出现的问题

1.我在这一步时,用的是libdb4.8版本,参考网上提供的资料,后来安装不上,偿试用5.1版安装成功
sudo apt-get install libdb5.1-dev libdb5.1++-dev
2.sudo 命令不能少,否则提示权限不够
供大家学习参考

猜你喜欢

转载自blog.csdn.net/gsl222/article/details/79868966