These build instructions have been tested on Debian Bullseye WSL (Windows Subsystem for Linux) and deployed on all listed host platforms.
BDB 5.3 is optional and is NOT backwards compatible with the default BDB version
Once you have updated, your wallet will no longer run on clients using the old version of BDB
BDB 5.3 is currently not supported on Microsoft Windows.
To run the client the following dependencies are not statically linked and are required (Debian Bullseye)
sudo apt install libbsd0 libfontconfig1 libx11-xcb1 libx11-6
The following are the Host platforms triplets supported by these instructions.
- Arm64 (v8) 64bit Linux : aarch64-linux-gnu
- ArmHF (v7) 32bit Linux : arm-linux-gnueabihf
- ArmEL (v6) 32bit Linux : arm-linux-gnueabi
- x86-64 Linux : x86_64-linux-gnu
- x86-64 Windows : x86_64-w64-mingw32
- x86 Windows : i686-w64-mingw32
Apple builds have not been tested and are not supported by these instructions, however they are possible.
The following dependencies will allow cross-compilation for all supported host types.
sudo apt install automake binutils-mingw-w64 curl crossbuild-essential-arm64 crossbuild-essential-armhf crossbuild-essential-armel crossbuild-essential-i386 crossbuild-essential-amd64 git gnulib libtool libxkbcommon-dev mingw-w64 nsis pkg-config python3 zlib1g-dev
The mingw32 g++ & gcc compilers needs to be set to "posix" to compile the client. To do this run these commands and select "posix" for each.
sudo update-alternatives --config x86_64-w64-mingw32-g++
sudo update-alternatives --config i686-w64-mingw32-g++
sudo update-alternatives --config x86_64-w64-mingw32-gcc
sudo update-alternatives --config i686-w64-mingw32-gcc
Create a folder for our builds to be completed within. These intructions use a folder in the users home directory.
mkdir ~/GRC-Build && cd ~/GRC-Build
Use Git to clone into the Gridcoin repository and select the required branch. The branch name in [ ] should be adjusted as follows:
- master : This branch should be used for all normal builds
- testnet : This branch should be used for testnet builds only
- Please join the Slack #testnet channel for up to date information on testnet builds
git clone https://github.com/gridcoin-community/Gridcoin-Research
cd Gridcoin-Research
git fetch --all
git reset --hard origin/[master]
Prepare the build directory using the provided script.
./autogen.sh
Most dependencies for the Gridcoin client can be built and statically linked into the client binary using the provided "Depends" system. This method is recommended to ensure maximum compatibility and portability of the resulting binary.
If building for Windows on WSL, WSL support for launching Win32 applications results in Autoconf configure scripts being able to execute Windows Portable Executable files. This can cause unexpected behaviour during the build, such as Win32 error dialogs for missing libraries. The recommended approach is to temporarily disable WSL support for Win32 applications using the following command.
sudo bash -c "echo 0 > /proc/sys/fs/binfmt_misc/status"
The following commands will build the Dependencies, The options in [ ] should be adjusted as required:
- HOST=host-platform-triplet : The architecture to build for.
- BDB_53=1 : Build Berkeley Database version 5.3, Recommended (Not supported on Windows)
- See BDB Warning.
cd ~/GRC-Build/Gridcoin-Research/depends
make HOST=[host-platform-triplet] [BDB_53=1]
Once built the dependencies for each host are saved in "Gridcoin-Research/depends/host-platform-triplet".
The main client build takes place in the main build directory
cd ~/GRC-Build/Gridcoin-Research
First we configure the build. The options in [ ] should be adjusted as required:
- host-platform-triplet : The architecture to build for.
- --enable-qt59 : Recommended, Required for GUI
- --with-incompatible-bdb : Recommended, Required if BDB=53 was used to build the depends.
- See BDB Warning.
./configure --prefix=`pwd`/depends/[host-platform-triplet] LDFLAGS=-static-libstdc++ --enable-glibc-back-compat --enable-reduce-exports [--enable-qt59] [--with-incompatible-bdb]
Then we build the binaries.
make
Finally the debug symbols can be stripped from the resulting binaries unless you require them for debugging. Again replace the options in [ ] as required.
[host-platform-triplet]-strip ./src/qt/gridcoinresearch
[host-platform-triplet]-strip ./src/gridcoinresearchd
In this example I am copying the binaries to a Networked Drive "N:".
If using Windows Subsystem for Linux (WSL), this command is required to mount a network drive that is already mounted in Windows within the WSL environment.
If you are using Linux nativly then you may mount your drive as normal.
sudo mount -t drvfs N: /mnt/n
This copies both GUI and Daemon(Commandline) Binaries to the mounted drive.
sudo cp ./src/qt/gridcoinresearch /mnt/n/Gridcoin/ && sudo cp ./src/gridcoinresearchd /mnt/n/Gridcoin/
This ensures the build environment is ready to start another build. It does not affect depends which will remain saved.
make clean
If Gridcoin has been installed previously the existing binaries should be removed.
sudo rm /usr/local/bin/gridcoinresearch && sudo rm /usr/local/bin/gridcoinresearchd
Gridcoin binaries should be placed in /usr/local/bin and should be made executable. (Your drive mountpoint will vary depending on where you saved your binaries in the build step)
sudo cp /mnt/NAS/Gridcoin/gridcoin* /usr/local/bin/
sudo chmod +x /usr/local/bin/gridcoin*
The main client build takes place in the main build directory
cd ~/GRC-Build/Gridcoin-Research
First we configure the build. The options in [ ] should be adjusted as required:
- host-platform-triplet : The architecture to build for.
- --enable-qt59 : Recommended, Required for GUI
CONFIG_SITE=$PWD/depends/[host-platform-triplet]/share/config.site ./configure --prefix=/ [--enable-qt59]
Then we build the binaries and create the installation executables
make
make deploy
In this example I am copying the binaries to a Networked Drive "M:".
If using Windows Subsystem for Linux (WSL), this command is required to mount a network drive that is already mounted in Windows within the WSL environment.
If you are using Linux nativly then you may mount your drive as normal.
sudo mount -t drvfs N: /mnt/n
This copies both GUI and Daemon(Commandline) executables to the mounted drive.
sudo cp *setup.exe /mnt/n/Gridcoin
This ensures the build environment is ready to start another build. It does not affect depends which will remain saved.
make clean
The following build optimisations may be used to improve performance on Raspberry Pi systems.
Notes:
- Requires a 64bit Kernel and Userland
- Incompatible with Raspbian which is 32bit
Depends Build
make HOST=aarch64-linux-gnu GCCFLAGS="-march=armv8-a+crc -mtune=cortex-a72" BDB_53=1
Main Build Configuration
./configure --prefix=`pwd`/depends/aarch64-linux-gnu LDFLAGS=-static-libstdc++ --enable-glibc-back-compat --enable-reduce-exports --enable-qt59 --with-incompatible-bdb CXXFLAGS="-march=armv8-a+crc -mtune=cortex-a72" CFLAGS="-march=armv8-a+crc -mtune=cortex-a72"
Notes:
- Requires a 64bit Kernel and Userland
- Incompatible with Raspbian which is 32bit
Depends Build
make HOST=aarch64-linux-gnu GCCFLAGS="-march=armv8-a+crypto+crc -mtune=cortex-a53" BDB_53=1
Main Build Configuration
./configure --prefix=`pwd`/depends/aarch64-linux-gnu LDFLAGS=-static-libstdc++ --enable-glibc-back-compat --enable-reduce-exports --enable-qt59 --with-incompatible-bdb CXXFLAGS="-march=armv8-a+crypto+crc -mtune=cortex-a53" CFLAGS="-march=armv8-a+crypto+crc -mtune=cortex-a53"
Notes:
- Compatible with Raspbian
Depends Build
make HOST=arm-linux-gnueabihf GCCFLAGS="-march=armv8-a+crypto+crc -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8" BDB_53=1
Main Build Configuration
./configure --prefix=`pwd`/depends/arm-linux-gnueabihf LDFLAGS=-static-libstdc++ --enable-glibc-back-compat --enable-reduce-exports --enable-qt59 --with-incompatible-bdb CXXFLAGS="-march=armv8-a+crypto+crc -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8" CFLAGS="-march=armv8-a+crypto+crc -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8"
Notes:
- Not recommended, these boards do not have enough RAM to run the client
- Compatible with Raspbian when multi-arched with Debian ArmEL.
Depends Build
make HOST=arm-linux-gnueabi GCCFLAGS="-march=armv6zk+fp -mcpu=arm1176jzf-s -mtune=arm1176jzf-s" BDB_53=1
Main Build Configuration
./configure --prefix=`pwd`/depends/arm-linux-gnueabi LDFLAGS=-static-libstdc++ --enable-glibc-back-compat --enable-reduce-exports --enable-qt59 --with-incompatible-bdb CXXFLAGS="-march=armv6zk+fp -mcpu=arm1176jzf-s -mtune=arm1176jzf-s" CFLAGS="-march=armv6zk+fp -mcpu=arm1176jzf-s -mtune=arm1176jzf-s"
Nice. We need to get this in the main wiki...