I want to build Iroha hyperledger on Raspberry Pi 3. So I've downloaded code and all dependencies and compiler gcc-8.2 (downloaded precompiled from here), then configured without tests:

cmake -DTESTING=OFF -LA ../ 

but when I run make: it is stopping on file: iroha/irohad/main/impl/on_demand_ordering_init.cpp. I read in another question about creating swap file, so I've even created swap partition 30G and the problem still happen. By the way I've noticed in htop, that compilation does not use more than 1G RAM + 600M swap memory but it shows "virtual memory exhausted: Cannot allocate memory". I've also tried to do like described in article to add extra flags to g++:

--param ggc-min-expand=0 --param ggc-min-heapsize=8192

I've also tried to increade vm.max_map_count value as mentioned here:

sudo sysctl -w vm.max_map_count=262140 # default was 65535

I've also tried to compile the file by hand, thanks to adding a flag to make the compiling command was visible:

make VERBOSE=1

cd /home/pi/Desktop/iroha/zbudowane/irohad/main && /usr/bin/c++ --param ggc-min-expand=0 --param ggc-min-heapsize=8192  -DBOOST_NO_RTTI -I/home/pi/Desktop/iroha/irohad -I/home/pi/Desktop/iroha/libs -I/home/pi/Desktop/iroha/shared_model -I/home/pi/Desktop/iroha/zbudowane/schema -isystem /usr/local/include -isystem /usr/include/soci -isystem /usr/include/postgresql  -std=c++14 -fdiagnostics-color=always -g -O0 -fPIC   -o CMakeFiles/application.dir/impl/on_demand_ordering_init.o -c /home/pi/Desktop/iroha/irohad/main/impl/on_demand_ordering_init.cpp

but the problem is still occuring. The bad thing is that it is last file to fully compile entire project:D.


I found some hack to compile the file, but it is not sure that this won't make any troubles in future. I've run gcc's preprocessor on the file (-E flag) in Raspberry:

/usr/bin/c++ -E -DBOOST_NO_RTTI -I/home/pi/Desktop/iroha/irohad -I/home/pi/Desktop/iroha/libs -I/home/pi/Desktop/iroha/shared_model -I/home/pi/Desktop/iroha/zbudowane/schema -isystem /usr/local/include -isystem /usr/include/soci -isystem /usr/include/postgresql -std=c++14 -Wall -fdiagnostics-color=always -g -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -O0 -fPIC -o CMakeFiles/application.dir/impl/on_demand_ordering_init_prep.o -c /home/pi/Desktop/iroha/irohad/main/impl/on_demand_ordering_init.cpp

then I got 6M file, which I've compiled on my PC with command:

arm-linux-gnueabi-g++-8 -std=c++14 -fdiagnostics-color=always -g -O0 -fPIC -o CMakeFiles/application.dir/impl/on_demand_ordering_init.o -c CMakeFiles/application.dir/impl/on_demand_ordering_init_prep.cpp

then I've copied the file to raspberry and compilation of entire project succeed. It also looks that Iroha server is working, but I'm not sure if it is going to crash or not.

  • It seems that cross compiling for ARM is more common than self hosted. ARM boards don't have the same level of processing speed and it seems people don't want to wait as long as it would take to build on ARM. Because of that self hosted compiling doesn't seem to be as robust as cross compiling. – T. M. Jan 30 at 8:16
  • This command worked for me arm-linux-gnueabi-g++ -std=c++14 -fdiagnostics-color=always -g -O0 -fPIC -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -mthumb -mtls-dialect=gnu -o ./on_demand_ordering_init.o -c ./on_demand_ordering_init_prep.cpp I was getting VFP compatibility issue, have to set that explicitly while building – PankajM Feb 2 at 15:31

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.