How to compile Riecoin Core 0.16.3 in Debian 9 (for Linux and Win64)

how to section and useful information
Post Reply
Pttn
Posts: 131
Joined: 24 Aug 2018, 13:37

How to compile Riecoin Core 0.16.3 in Debian 9 (for Linux and Win64)

Post by Pttn » 15 Oct 2018, 18:35

As 2019-01-13.
  • Reference repository: https://github.com/riecointeam/riecoin
  • Latest release with reference binaries
  • This how to will use Bdb 5.3 (for the wallet data), which is incompatible with the version used in the reference build, keep that in mind and do not forget to backup your private keys. You can alternatively find the Gitian documentation to build binaries matching with the reference ones;
  • Report any problem here.
Output: src/qt/riecoin-qt or src/qt/riecoin-qt.exe

Tip: when using make, add "-j numberOfThreads" after make to use more cores if you wish.

In all cases, install the dependencies and needed tools as root:

Code: Select all

# apt install build-essential libboost-all-dev libssl1.0-dev libdb5.3-dev libdb5.3++-dev libevent-dev autotools-dev libtool automake pkg-config bsdmainutils python3 curl git qt5-default qttools5-dev-tools
Currently, it is important to use LibSsl1.0. There are also patches from IGJ, but we should just wait that this gets directly fixed in GitHub.

Compilation on Debian 9 (for Linux)

install these additional dependencies (that must not be installed for cross compiling) as root:

Code: Select all

# apt install libprotobuf-dev protobuf-compiler
Get the source:

Code: Select all

git clone https://github.com/riecointeam/riecoin.git Riecoin
cd Riecoin
Compile:

Code: Select all

./autogen.sh
./configure --disable-tests --with-incompatible-bdb --with-gui
make
Cross compilation on Debian 9 (for Windows)

Remove libprotobuf-dev and protobuf-compiler if you installed them before, else you will get a very annoying error much later:

Code: Select all

# apt remove libprotobuf-dev protobuf-compiler
Install MinGw as root

Code: Select all

# apt install g++-mingw-w64-x86-64
And configure it to avoid "Mutex is not a member of Std" errors

Code: Select all

# update-alternatives --config x86_64-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.
Get the source:

Code: Select all

git clone https://github.com/riecointeam/riecoin.git Riecoin
cd Riecoin
Mod to use Db5.3 instead of Db4.8. Else, you will have header problems. To do this, adapt the depends/packages/bdb.mk file to:

Code: Select all

package=bdb
$(package)_version=5.3.28
$(package)_download_path=http://download.oracle.com/berkeley-db
$(package)_file_name=db-$($(package)_version).NC.tar.gz
$(package)_sha256_hash=76a25560d9e52a198d37a31440fd07632b5f1f8f9f2b6d5438f4bc3e7c9013ef
$(package)_build_subdir=build_unix

define $(package)_set_vars
$(package)_config_opts=--disable-shared --enable-cxx --disable-replication
$(package)_config_opts_mingw32=--enable-mingw
$(package)_config_opts_linux=--with-pic
$(package)_cxxflags=-std=c++11
endef

define $(package)_preprocess_cmds
  sed -i.old 's/__atomic_compare_exchange/__atomic_compare_exchange_db/' src/dbinc/atomic.h && \
  sed -i.old 's/atomic_init/atomic_init_db/' src/dbinc/atomic.h src/mp/mp_region.c src/mp/mp_mvcc.c src/mp/mp_fget.c src/mutex/mut_method.c src/mutex/mut_tas.c && \
  sed -i.old 's/WinIoCtl.h/winioctl.h/' src/dbinc/win_db.h && \
  cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub dist
endef

define $(package)_config_cmds
  ../dist/$($(package)_autoconf)
endef

define $(package)_build_cmds
  $(MAKE) libdb_cxx-5.3.a libdb-5.3.a
endef

define $(package)_stage_cmds
  $(MAKE) DESTDIR=$($(package)_staging_dir) install_lib install_include
endef
Or, you could try to install Db4.8 in your system, but if 5.3 is already in the repository, why mess with it? And we cannot do add-apt-repository in Debian (and should not have to)...

Compile dependencies:

Code: Select all

cd depends
make HOST=x86_64-w64-mingw32
Compile

Code: Select all

cd ..
./autogen.sh
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/ --disable-tests -with-incompatible-bdb --with-gui
make
The compilation is so slow for WSL in my virtual machine that I have given up testing there. But maybe someone might test and give a similar Step by Step in the discussion topic.

Post Reply