nanocurrency / nano-node

Nano is digital currency. Its ticker is: XNO and its currency symbol is: Ӿ
https://nano.org
BSD 3-Clause "New" or "Revised" License
3.47k stars 785 forks source link

Node compile error with Ubuntu 21.10 on a Raspberry Pi 4 #3562

Open Gitdyr opened 2 years ago

Gitdyr commented 2 years ago

Summary

I get a compile error when I try to create the nano_node.

Node version

22.1

Build details

Boost: libboost1.74-all-dev/impish 1.74.0-8ubuntu6 arm64

$ uname -a
Linux nano-desktop 5.13.0-1008-raspi #9-Ubuntu SMP PREEMPT Wed Sep 29 08:27:44 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
$ cmake --version
cmake version 3.18.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/11/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.2.0-7ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Ubuntu 11.2.0-7ubuntu2) 

OS and version

Ubuntu 21.10 on a Raspberry Pi 4 (64 bit)

Steps to reproduce the behavior

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install git cmake g++ curl wget
sudo apt install libboost-all-dev
git clone --branch V22.1 --recursive https://github.com/nanocurrency/nano-node.git nano_build
cd nano_build
cmake -G "Unix Makefiles" .
make nano_node VERBOSE=1

Expected behavior

I expected no error when building the nano_node.

Actual behavior

I get this error:

[ 22%] Building CXX object nano/lib/CMakeFiles/nano_lib.dir/work.cpp.o
cd /home/nano/nano_build/nano/lib && /usr/bin/c++ -DACTIVE_NETWORK=nano_live_network -DBOOST_ALL_NO_LIB -DCI=0 -DCRYPTOPP_DISABLE_ASM -DCRYPTOPP_DISABLE_CLMUL -DCRYPTOPP_DISABLE_SHANI -DED25519_CUSTOMHASH -DED25519_CUSTOMRNG -DMAJOR_VERSION_STRING=22 -DMINOR_VERSION_STRING=1 -DPATCH_VERSION_STRING=0 -DPRE_RELEASE_VERSION_STRING=0 -I/home/nano/nano_build -I/home/nano/nano_build/rocksdb/include -I/home/nano/nano_build/cpptoml/include -I/home/nano/nano_build/flatbuffers/include -O3 -DNDEBUG -fPIC -march=armv8-a -std=gnu++17 -o CMakeFiles/nano_lib.dir/work.cpp.o -c /home/nano/nano_build/nano/lib/work.cpp
/home/nano/nano_build/nano/lib/work.cpp: In member function ‘void nano::work_pool::loop(uint64_t)’:
/home/nano/nano_build/nano/lib/work.cpp:292:67: error: ‘sleep_for’ is not a member of ‘std::this_thread’
  292 |                                                 std::this_thread::sleep_for (pow_sleep);
      |                                                                   ^~~~~~~~~
/home/nano/nano_build/nano/lib/work.cpp:292:67: note: suggested alternatives:
In file included from /usr/include/boost/thread/thread_only.hpp:17,
                 from /usr/include/boost/thread/thread.hpp:12,
                 from /home/nano/nano_build/nano/lib/work.hpp:9,
                 from /home/nano/nano_build/nano/lib/blocks.hpp:10,
                 from /home/nano/nano_build/nano/lib/work.cpp:2:
/usr/include/boost/thread/pthread/thread_data.hpp:295:14: note:   ‘boost::this_thread::sleep_for’
  295 |         void sleep_for(const chrono::duration<Rep, Period>& d)
      |              ^~~~~~~~~
/usr/include/boost/thread/pthread/thread_data.hpp:341:16: note:   ‘boost::this_thread::no_interruption_point::sleep_for’
  341 |           void sleep_for(const chrono::duration<Rep, Period>& d)
      |                ^~~~~~~~~
make[3]: *** [nano/lib/CMakeFiles/nano_lib.dir/build.make:472: nano/lib/CMakeFiles/nano_lib.dir/work.cpp.o] Error 1
make[3]: Leaving directory '/home/nano/nano_build'
make[2]: *** [CMakeFiles/Makefile2:972: nano/lib/CMakeFiles/nano_lib.dir/all] Error 2
make[2]: Leaving directory '/home/nano/nano_build'
make[1]: *** [CMakeFiles/Makefile2:1058: nano/nano_node/CMakeFiles/nano_node.dir/rule] Error 2
make[1]: Leaving directory '/home/nano/nano_build'
make: *** [Makefile:504: nano_node] Error 2

Possible solution

I tried an older version of boost but that did not fix the problem.

Supporting files

No response

renesq commented 2 years ago

I too tried to compile on Ubuntu 21.10 on a x86 machine with two different boost versions and it will always fail around the 16..17% mark:

 /nano/lib/plat/linux/thread_role.cpp:1 :
[01m [K/usr/local/boost/include/boost/thread/pthread/thread_data.hpp:60:5:   
[01;31m [Kerror:  missing binary operator before token "(" 
/nano/lib/work.cpp [K/usr/include/boost/thread/pthread/thread_data.hpp:341:16:  
[01;36m[Knote:    [01m[Kboost::this_thread::no_interruption_point::sleep_for 
 void 
[01;36m[Ksleep_for (const chrono::duration<Rep, Period>& d) 

Compiling on Ubuntu 20.04 and 21.04 works just fine.

Gitdyr commented 2 years ago

@renesq you are absolutely right. I installed Ubuntu 21.04 and it compiled (with a few warnings).

It appears gcc/g++ is version 10.3.0 in Ubuntu 21.04.