Windows版bitcoin客户端编译

 

比特币官方原文地址

https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md

 

编译方法:使用Mingw-w64交叉编译工具,生成win版客户端

 

准备工作:安装UbuntuTrusty 14.04虚拟机  或者使用Windows Subsystem for Linux (WSL)安装Ubuntu (只支持win10系统

windows子系统安装:https://docs.microsoft.com/zh-cn/windows/wsl/about

 

下载编译工具及依赖包:

sudo apt update 更新

sudo apt upgrade升级

 

安装工具

sudo apt install build-essential

sudo apt libtool

sudo apt autotools-dev

sudo apt automake

sudo apt pkg-config

sudo apt bsdmainutils

sudo apt curl

sudo apt git

 

编译

1、 64位客户端

sudo apt install g++-mingw-w64-x86-64   //交叉编译器

 

额外工作:

Ubuntu Trusty 14.04: 不需要

Ubuntu Xenial 16.04 and Windows Subsystem forLinux 1,2:

sudo apt install software-properties-common

sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu zesty universe"

sudo apt update

sudo apt upgrade

sudo update-alternatives --config x86_64-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.

Ubuntu Zesty 17.04 2:

sudo update-alternatives --config x86_64-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.

 

GIT下载源码

git clone https://github.com/bitcoin/bitcoin.git
配置环境变量、执行编译
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var

cd depends

make HOST=x86_64-w64-mingw32   #

 

 

下载编译依赖库

cd ..

./autogen.sh # not required when building from tarball

CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/

make  #

编译比特币工程

 

整个过程大概需要1小时30分钟

2、 32位客户端 

过程类似,直接贴命令

sudo apt install g++-mingw-w64-i686 mingw-w64-i686-dev #

 

 

下载编译器

 

Ubuntu Xenial 16.04, Ubuntu Zesty 17.04 and Windows Subsystemfor Linux 2:

sudo update-alternatives --config i686-w64-mingw32-g++  # Set the default mingw32 g++ compiler option to posix.

 

git clone https://github.com/bitcoin/bitcoin.git #

下载源码

PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var

cd depends

make HOST=i686-w64-mingw32

cd ..

./autogen.sh # not required when building from tarball

CONFIG_SITE=$PWD/depends/i686-w64-mingw32/share/config.site ./configure --prefix=/

make

安装程序:

make install DESTDIR=/mnt/c/workspace/bitcoin 设置指定输出目录

生成的可执行文件:

最后

使用Ubuntu Trusty 14.04虚拟机  一次编译通过,无报错。

 欢迎加入比特币交流群:438135799 注明来源。

 

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值