Cross-Compile Cryptonite for Windows on Windows 10 or Ubuntu
Step 1: Setting Up the EnvironmentEnsure that you have Windows Subsystem for Linux (WSL) and Ubuntu installed on your Windows 10 system. If not, follow the official installation guide to set them up. 1.1 Installing DependenciesOpen the Ubuntu terminal (on Windows via WSL or on a standalone Ubuntu system) and execute the following command to install all the required dependencies:
sudo apt install autoconf automake autopoint bash bison \
bzip2 flex g++ g++-multilib gettext git gperf intltool \
libc6-dev-i386 libgdk-pixbuf2.0-dev libltdl-dev libgl-dev \
libpcre3-dev libssl-dev libtool-bin libxml-parser-perl lzip \
make openssl p7zip-full patch perl python3 python3-distutils \
python3-mako python3-pkg-resources python-is-python3 ruby \
sed unzip wget xz-utils
1.2 Clone the Modified MXE Toolchaingit clone https://github.com/e-nexus/mxe
cd mxe
git checkout xcn
Step 2: Building the Toolchain2.1 Build the ToolchainInside the `mxe` directory, execute:
make MXE_TARGETS=x86_64-w64-mingw32.static.posix db gmp \
boost libqrencode miniupnpc protobuf qtbase qttools -j4
Note: Change `-j4` to the number of CPU cores for parallel compilation.
Note: Change db to db48 if you need to build portable wallet data files.
Step 3: Compiling Cryptonite3.1 Clone Cryptonite Source Codegit clone https://github.com/e-nexus/Cryptonite
cd Cryptonite
3.2 Set the Path to the MXE ToolchainReplace `USERNAME` with your local username:
export PATH=/home/USERNAME/mxe/usr/bin:$PATH
3.3 Run Autogen Script./autogen.sh
3.4 Configure the BuildReplace `USERNAME` with your local username:
./configure \
CFLAGS="-w -march=native -mtune=native -O3" \
CXXFLAGS="-w -std=c++17 -march=native -mtune=native -finline-functions -fPIC -O3" \
--host=x86_64-w64-mingw32.static.posix \
--with-qt-incdir=/home/USERNAME/mxe/usr/x86_64-w64-mingw32.static.posix/qt5/include \
--with-qt-libdir=/home/USERNAME/mxe/usr/x86_64-w64-mingw32.static.posix/qt5/lib \
--with-qt-plugindir=/home/USERNAME/mxe/usr/x86_64-w64-mingw32.static.posix/qt5/plugins \
--with-qt-bindir=/home/USERNAME/mxe/usr/x86_64-w64-mingw32.static.posix/qt5/bin \
--with-boost=/home/USERNAME/mxe/usr/x86_64-w64-mingw32.static.posix/lib \
--with-boost-libdir=/home/USERNAME/mxe/usr/x86_64-w64-mingw32.static.posix/lib \
--with-protoc-bindir=/home/USERNAME/mxe/usr/x86_64-pc-linux-gnu/bin \
--with-incompatible-bdb \
--disable-hardening \
--disable-tests
Note: Remove --with-incompatible-bdb if building portable wallet data files.
3.5 Compile Cryptonitemake -j4
Note: Set `-j4` to the number of CPU cores.
Step 4: Finalizing the Build4.1 Strip the Binariesstrip src/*.exe
strip src/qt/*.exe
4.2 Copy to Windows File SystemCopy the compiled binaries (cryptonited.exe and cryptonite-cli.exe in the /src directory, and cryptonite-qt.exe in /src/qt/) to the Windows file system.