bitcoin源码编译
bitcoin编译
编译环境:Ubuntu 16.04.2 LTS
官方源代码位置:https://github.com/bitcoin/bitcoin
梦游兔源码阅读进度:bitcoin源码分析
编译说明文档位置:./bitcoin-master/doc/build-unix.md
准备工作-依赖项
从源代码目录下这个位置获取编译说明:./bitcoin-master/doc/build-unix.md
我的系统是Ubuntu,所以只把Ubuntu相关的信息摘出来。
CentOS编译的过程在这里bitcoin编译centos
必要的依赖项:
Library | Purpose | Description |
---|---|---|
libssl | Crypto | Random Number Generation, Elliptic Curve Cryptography |
libboost | Utility | Library for threading, data structures, etc |
libevent | Networking | OS independent asynchronous networking |
可选的依赖项:
Library | Purpose | Description |
---|---|---|
miniupnpc | UPnP Support | Firewall-jumping support |
libdb4.8 | 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) |
依赖项安装命令:
sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3 sudo apt-get install libboost-all-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 sudo apt-get install libminiupnpc-dev sudo apt-get install libzmq3-dev sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler sudo apt-get install libqrencode-dev
编译源代码
从官方地址下载源代码:
git clone https://github.com/bitcoin/bitcoin.git
进入源代码目录,检查依赖,开始编译:
cd bitcoin ./autogen.sh ./configure make install
编译过程中遇到的错误
内存不足:
virtual memory exhausted: Cannot allocate memory Makefile:5514: recipe for target 'libbitcoin_server_a-init.o' failed make[2]: *** [libbitcoin_server_a-init.o] Error 1 make[2]: Leaving directory '/home/ubuntu/bitcoin-master/bitcoin/src' Makefile:9278: recipe for target 'install-recursive' failed make[1]: *** [install-recursive] Error 1 make[1]: Leaving directory '/home/ubuntu/bitcoin-master/bitcoin/src' Makefile:740: recipe for target 'install-recursive' failed make: *** [install-recursive] Error 1
解决方法:
./configure CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
bitcoin源码编译.txt · 最后更改: 2017/09/20 05:17 由 螃蟹