Install dependencies of Hyperledger Iroha manually

This page describes how to install the dependencies of Hyperledger iroha manually. Since some time now, iroha has moved to vcpkg as a tool to deal with the dependencies needed to install iroha. VCPKG is a very convenient tool to use in order to keep and maintain the dependencies for Hyperledger IROHA.

Unfortunately, however, vcpkg does not support (as of today) all platforms, especially arm. Specifically, vcpkg does not support arm-linux architectures such as armv7l, i.e. Rapberry.

[See, for instance: https://github.com/microsoft/vcpkg/issues/8216. Note: it does support some other arm architectures, such as arm-windows and arm64-windows (https://github.com/Microsoft/vcpkg/issues/2360)]

Increase the SWAP space of your Raspberry to 2GB

Before starting, increase the SWAP space of your Raspberry to 2GB. To see how this can be done, you can refer to: https://raspberrypi.stackexchange.com/questions/70/how-to-set-up-swap-space.

Installing dependencies with Vcpkg Dependency Manager

https://iroha.readthedocs.io/en/master/build/index.html#installing-dependencies-with-vcpkg-dependency-manager

This part is meant as a way to find out which exact versions to install of each iroha dependency and therefore to survive the current stable release of iroha, which as of today is 1.1.3.

pi@raspberry~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:    10
Codename:   buster
pi@rasbiblack:~/iroha $ git show
commit 561526112dc2666cdfdbd888984a9fef9b8ed66d (HEAD, tag: latest, tag: 1.1.3, origin/support/1.1.x)

The files you should be looking at are:

  • iroha/vcpkg/VCPKG_DEPS_LIST
  • iroha/vcpkg/VCPKG_HEAD_DEPS_LIST

Basically, in order to find out which version you should install for each dependency, you can simply launch the following command:

 vcpkg/vcpkg install name_of_dependency_from_file

where name_of_dependency_from_file comes from the two files above.

And the output will tell you what version vcpkg would install if arm-linux was supported. For some dependencies the latest version will be installed, while for others a specific version will be chosen.

Additionally, in the light of this post: https://www.wirelessblockchain.com/blog/2019/09/hyperledger-iroha-on-raspberry-pi/ you may want to try to install the same version on the desktop used to cross-compile and on the raspberry. Perhaps this is not necessary but it is just an extra point to be careful.

Sometimes you can also run apt-cache search  libz and see if the version from apt matches or is newer than the dependency needed and you may give it a try in order to save time from building from source.

Pay attention to lines like this:

soci[boost,postgresql]

This means soci should be built with boost and postgresql support.

Example: install soci from source with boost and postgresql support.

https://stackoverflow.com/questions/35392767/how-to-build-soci-with-postgresql#35732467

git clone https://github.com/SOCI/soci.git
cd soci/
git checkout 4.0.0
mkdir build
cd build/
cmake -G "Unix Makefiles" -DWITH_BOOST=ON -DWITH_POSTGRESQL=ON ../

Examples: Some versions for iroha 1.1.3 and Raspberry PI 3 B+

The following are the versions of some dependencies that work for me

cmake 3.14 installed with curl and lz support.

The support for curl and lz is paramount, so make sure you don’t forget it!

Before installing cmake remember to sudo apt install zlib1g-dev libssl-dev (will be needed in a second stage to install the elliptic curves package.

cd CMake
./bootstrap --system-curl

ninja-1.8.2

boost 1.71

protobuf 3.12.1

git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git checkout v3.12.1
git submodule update --init --recursive

Install according to:
https://github.com/protocolbuffers/protobuf/blob/master/src/README.md

./autogen.sh && ./configure && make -j4
make –j4 test
sudo make install
sudo ldconfig # refresh shared library cache. 

ed25519

$ git clone https://github.com/hyperledger/iroha-ed25519.git
cd iroha-ed25519/
git checkout 2.0.2
mkdir build
cd build/
cmake ../ -DHASH=sha3_brainhub -DBUILD=SHARED -DEDIMPL=ref10
make && sudo make install

Some References/Links [some are not relevant, to be removed from this list]

  • https://github.com/protocolbuffers/protobuf/blob/master/src/README.md
  • https://stackoverflow.com/questions/10404027/cant-compile-example-from-google-protocol-buffers
  • https://github.com/tensorflow/tensorflow/issues/5684
  • https://stackoverflow.com/questions/24096807/dso-missing-from-command-line
  • https://stackoverflow.com/questions/37613415/c-undefined-reference-to-atomic-load-16
  • https://github.com/gflags/gflags/blob/master/INSTALL.md
  • https://github.com/microsoft/vcpkg/issues/8185
  • https://github.com/Microsoft/CNTK/issues/2198
  • http://www.linuxfromscratch.org/blfs/view/8.3/general/ninja.html
  • https://github.com/google/googletest
  • https://github.com/google/googletest/blob/master/googletest/README.md
  • https://grpc.io/
  • https://github.com/google/benchmark
  • https://github.com/google/benchmark#installation
  • https://github.com/grpc/grpc/issues/22396
  • https://github.com/grpc/grpc-node/issues/1240
  • https://stackoverflow.com/questions/35392767/how-to-build-soci-with-postgresql#35732467
  • https://github.com/grpc/grpc/tree/master/src/cpp
  • https://github.com/grpc/grpc/blob/master/BUILDING.md
  • https://github.com/grpc/grpc/blob/master/test/distrib/cpp/run_distrib_test_cmake_module_install.sh
  • https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html
  • https://github.com/Tencent/rapidjson
  • http://soci.sourceforge.net/doc/index.html
  • http://soci.sourceforge.net/doc/release/4.0/installation/
  • https://github.com/gabime/spdlog
  • https://github.com/ReactiveX/RxCpp
  • https://github.com/catchorg/Catch2
  • https://stackoverflow.com/questions/24096807/dso-missing-from-command-line
  • https://stackoverflow.com/questions/19901934/libpthread-so-0-error-adding-symbols-dso-missing-from-command-line
  • https://github.com/pytorch/pytorch/issues/22898
  • https://github.com/grpc/grpc/issues/15587
  • https://github.com/redis/redis/issues/6275
  • https://github.com/PurpleI2P/i2pd/issues/897
  • https://github.com/grpc/grpc/pull/21341
  • https://github.com/grpc/grpc/pull/20414
  • https://github.com/llvm-mirror/llvm/blob/master/cmake/modules/CheckAtomic.cmake
  • https://github.com/grpc/grpc/pull/21341/commits/2f4cf1d9265c8e10fb834f0794d0e4f3ec5ae10e
  • https://github.com/grpc/grpc/blob/master/BUILDING.md
  • https://github.com/grpc/grpc/pull/21341/files
  • https://github.com/grpc/grpc/issues/11768
  • https://cmake.org/cmake/help/v3.10/envvar/CXXFLAGS.html?highlight=cmake_cxx_flags
  • https://stackoverflow.com/questions/13693842/why-am-i-getting-the-error-cin-does-not-name-a-type
  • https://github.com/dashpay/dash/issues/1751
  • https://stackoverflow.com/questions/18546540/narrowing-conversion-of-unsigned-int-to-short-unsigned-int
  • https://software.intel.com/content/www/us/en/develop/documentation/tbb-tutorial/top.html
  • http://www.metagenomics.wiki/tools/bowtie2/install/libtbb-so-2