Build Windows peercoind.exe using MXE on Linux - nohea/peercoin GitHub Wiki

Tested on Ubuntu 14.04 LTS and 16.04 LTS

Install required packages

sudo apt-get install autoconf automake autopoint bash bison bzip2 flex gettext git g++ gperf intltool libffi-dev libgdk-pixbuf2.0-dev libtool libltdl-dev libssl-dev libxml-parser-perl make openssl p7zip-full patch perl pkg-config python ruby scons sed unzip wget xz-utils
sudo apt-get install g++-multilib libc6-dev-i386

May need to install libtool-bin if no libtool package.

Install MXE from Github

MXE mxe.cc is a cross-compilation environment for various platforms. Here we use it to target the Windows environment using MingW. We install the dependent libraries for the target before compiling our exe.

cd /opt
sudo mkdir mxe
sudo chown myusername:myusername mxe
git clone https://github.com/mxe/mxe.git
cd mxe

download and install library packages from source using the MXE makefiles.

make boost
make openssl
make miniupnpc
make pthreads

Manually download separate dependencies and install under the MXE environment

Do not install the latest 'db' package via MXE. Install the db 4.8 version specifically, to maintain compatibility of the wallet.dat files.

cd /opt
sudo mkdir mxe-deps
sudo chown myusername:myusername mxe-deps
cd mxe-deps
wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.zip
unzip db-4.8.30.NC.zip
cd /opt/mxe/
make db SOURCE_TREE=/opt/mxe-deps/db-4.8.30.NC

build peercoind.exe in a user directory

cd ~/code
git clone https://github.com/peercoin/peercoin.git
cd peercoin

0.6 beta branch

git checkout develop
cd src
make DEPSDIR=/opt/mxe/usr/i686-w64-mingw32.static CC=/opt/mxe/usr/bin/i686-w64-mingw32.static-gcc CXX=/opt/mxe/usr/bin/i686-w64-mingw32.static-g++ BOOST_SUFFIX=-mt BOOST_THREAD_SUFFIX=_win32-mt BOOST_INCLUDE_PATH=/opt/mxe/usr/i686-w64-mingw32.static/include BOOST_LIB_PATH=/opt/mxe/usr/i686-w64-mingw32.static/lib -f makefile.mingw
strip peercoind.exe