比特币官方原文地址
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 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
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.
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
cd ..
./autogen.sh # not required when building from tarball
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
编译比特币工程
过程类似,直接贴命令
sudo update-alternatives --config i686-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.
下载源码
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
生成的可执行文件:
使用Ubuntu Trusty 14.04虚拟机 一次编译通过,无报错。
欢迎加入比特币交流群:438135799 注明来源。