Ubuntu下编译windows版本bitcoin

前端之家收集整理的这篇文章主要介绍了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
原文链接:https://www.f2er.com/ubuntu/349885.html

猜你在找的Ubuntu相关文章