从源码编译比特币核心比特币核心(第三章)
2018-02-09 @ 哈希力量严选
仔细阅读 build 文档第一部分中 build 的必备条件。这些是在你编译之前你的系统上必须具备的库文件。如果缺少这些必备条件,构建过程将会出现错误并导致失败。如果因为缺少一个必备条件而发生这种情况,你可以先安装它,然后在你停下的地方重新构建。假设这些必备条件已经具备,你就可以开始构建过程,通过 authgen.sh 脚本,生成一组构建脚本。
从 v0.9 版本开始,比特币核心的构建过程改 autogen/configure/make 体系。旧版本是用一个简单的 Makefile,并且和下面的例子稍微有一点不同。请遵照你想要编译版本的说明文档。v0.9 版本引入autogen/configure/make 构建体系可能用于未来所有版本的代码,是下面的例子中演示的系统
$ ./autogen.sh
configure.ac:12: installing `src/build-aux/config.guess' configure.ac:12: installing `src/build-aux/config.sub' configure.ac:37: installing `src/build-aux/install-sh' configure.ac:37: installing `src/build-aux/missing' src/Makefile.am: installing `src/build-aux/depcomp'
$
autogen.sh 脚本创建了一系列的自动配置脚本,会询问你的系统以发现正确的设置,确保你已安装必要的库来编译源 码。这里面最重要的是 configure 脚本,它会提供许多不同的选项来定制构建过程。输入./configure --help 可以查看各种不同的选项:
$ ./configure --help
`configure' configures Bitcoin Core 0.9.0 to adapt tomany kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE.
Seebelowfordescriptionsofsomeoftheusefulvariables. Defaults for the options are specified inbrackets.
Configuration:
-h,--help display this help andexit
--help=short display options specific to this package
--help=recursive display the short help of all the includedpackages
-V, --version display version information and exit [...manymoreoptionsandvariablesaredisplayedbelow...] OptionalFeatures:
--disable-option-checking ignoreunrecognized
--enable/--with options
--disable-FEATURE do not include FEATURE (sameas
--enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes] [... more options...]
Use these variables to override the choices made by
`configure'ortohelpittofindlibrariesandprogramswith nonstandard names/locations.
Report bugs to
$
