Ubuntu下编译windows版本bitcoin

要编译windows版的比特币程序,基本上有两种方法,一种是在linux平台(推荐ubuntu 13.10)通过交叉编译的方法来编译,另外一种就是直接在windows平台编译。

下面就详细介绍一下如何在Ubuntu平台编译比特币程序。

官方参考:https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md

Ubuntu 环境安装

方法1:安装Ubuntu虚拟机
方法2:在Windows10上安装Windows Subsystem for Linux,安装Ubuntu子系统

交叉编译环境依赖安装

sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git

构建64-bit Windows版本

The first step is to install the mingw-w64 cross-compilation tool chain. Due to different Ubuntu packages for each distribution and problems with the Xenial packages the steps for each are different.

Common steps to install mingw32 cross compiler tool chain:

sudo apt install g++-mingw-w64-x86-64

Ubuntu Trusty 14.04:

No further steps required

Ubuntu Xenial 16.04 and Windows Subsystem for Linux 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.

checkout sourece code:

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

build steps:

PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var
cd depends
make HOST=x86_64-w64-mingw32 #参见https://github.com/bitcoin/bitcoin/blob/master/depends/README.md
cd ..
./autogen.sh # not required when building from tarball
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
make

构建32-bit Windows版本

To build executables for Windows 32-bit, install the following dependencies:

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

For Ubuntu Xenial 16.04, Ubuntu Zesty 17.04 and Windows Subsystem for Linux 2:

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

checkout:

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

build steps:

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
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值