Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile on Ubuntu under Raspberry Pi arm64 architecture #34

Open
Goro2030 opened this issue Mar 16, 2021 · 16 comments
Open

Can't compile on Ubuntu under Raspberry Pi arm64 architecture #34

Goro2030 opened this issue Mar 16, 2021 · 16 comments

Comments

@Goro2030
Copy link
Contributor

@yerkobits

I installed all the dependencies, like this:

apt-get install build-essential git cmake libboost-all-dev

I didn't isntall QT because i just want the CLI compiled, as the RPI runs text-mode only.

But i'm getting the following cmake compilation error:

CMake Error at /usr/lib/aarch64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake:117 (find_package):
  Found package configuration file:

    /usr/lib/aarch64-linux-gnu/cmake/boost_system-1.71.0/boost_system-config.cmake

  but it set boost_system_FOUND to FALSE so package "boost_system" is
  considered to be NOT FOUND.  Reason given by package:

  No suitable build variant has been found.

  The following variants have been tried and rejected:

  * libboost_system.so.1.71.0 (shared, Boost_USE_STATIC_LIBS=ON)

  * libboost_system.a (shared runtime, Boost_USE_STATIC_RUNTIME=ON)

Call Stack (most recent call first):
  /usr/lib/aarch64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake:182 (boost_find_component)
  /usr/share/cmake-3.16/Modules/FindBoost.cmake:443 (find_package)
  CMakeLists.txt:489 (find_package)
@Goro2030
Copy link
Contributor Author

If you have the binaries for the RPI, can you post them to the releases page? I'd rather use those than try to compile them

@yerkobits
Copy link
Member

yerkobits commented Mar 17, 2021

Dependencies (gui+cli)...

apt-get update
apt-get upgrade
apt-get install build-essential git cmake libboost-all-dev
git clone https://github.com/ProsusCorp/prosus.money.git prosus

Build (daemon)...

cd prosus && cd cli
mkdir build && cd build
cmake -D Boost_NO_BOOST_CMAKE=BOOL:ON ..
make

@Goro2030
Copy link
Contributor Author

Ok. I'll give it a try. If this is correct, then you need to update the README.MD, that doesn't have the -D cmake flag.

@Goro2030
Copy link
Contributor Author

ALso, need to replace "cd prosus", by "cd prosus.money".

But still, it is erroring out during the "make":

make[1]: Entering directory '/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/build'
make[2]: Entering directory '/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/build'
make[2]: Leaving directory '/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/build'
make[2]: Entering directory '/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/build'
make[2]: Leaving directory '/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/build'
[  0%] Built target version
make[2]: Entering directory '/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/build'
make[2]: Leaving directory '/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/build'
make[2]: Entering directory '/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/build'
[  1%] Building CXX object src/CMakeFiles/Mnemonics.dir/mnemonics/electrum-words.cpp.o
c++: error: unrecognized command-line option ‘-maes’
make[2]: *** [src/CMakeFiles/Mnemonics.dir/build.make:63: src/CMakeFiles/Mnemonics.dir/mnemonics/electrum-words.cpp.o] Error 1
make[2]: Leaving directory '/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/build'
make[1]: *** [CMakeFiles/Makefile2:153: src/CMakeFiles/Mnemonics.dir/all] Error 2
make[1]: Leaving directory '/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/build'
make: *** [Makefile:84: all] Error 2

@yerkobits
Copy link
Member

Ok. I'll give it a try. If this is correct, then you need to update the README.MD, that doesn't have the -D cmake flag.

May edit de CmakeList.txt to integrate permanently the cmake flag.

@yerkobits
Copy link
Member

ALso, need to replace "cd prosus", by "cd prosus.money".

I update my answer, append a directory parameter to git command
git clone https://github.com/ProsusCorp/prosus.money.git prosus

@yerkobits
Copy link
Member

c++: error: unrecognized command-line option ‘-maes’

The -maes flag is an x86 CPU flag which is not used on ARM architecture.
Try edit the CMakeList.txt and remove the flag.

@Goro2030
Copy link
Contributor Author

I don't want to just KILL the use of AES if we can still use it on a RaspBerry PI 4+, which is ARM64 and do have it... this section of the script needs rewriting:

  if(NOT NO_AES AND NOT ARM AND NOT PPC64LE)
    message(STATUS "AES support enabled")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
  elseif(PPC64LE)
    message(STATUS "AES support not available on ppc64le")
  elseif(ARM6)
    message(STATUS "AES support not available on ARMv6")
  elseif(ARM7)
    message(STATUS "AES support not available on ARMv7")
  elseif(ARM8)
    CHECK_CXX_ACCEPTS_FLAG("-march=${ARCH}+crypto" ARCH_PLUS_CRYPTO)
    if(ARCH_PLUS_CRYPTO)
      message(STATUS "Crypto extensions enabled for ARMv8")
      set(ARCH_FLAG "-march=${ARCH}+crypto")
    else()
      message(STATUS "Crypto extensions unavailable on your ARMv8 device")
    endif()
  else()
    message(STATUS "AES support disabled")
  endif()

Isn't the initial IF wrong? The IF for ARM shouldn't be different?

@Goro2030
Copy link
Contributor Author

I got it to start compiling, by leaving it like this ( but now it's just RaspBerry 4+ compatible ) :)

    CHECK_CXX_ACCEPTS_FLAG("-march=${ARCH}+crypto" ARCH_PLUS_CRYPTO)
    if(ARCH_PLUS_CRYPTO)
      message(STATUS "Crypto extensions enabled for ARMv8")
      set(ARCH_FLAG "-march=${ARCH}+crypto")
    else()
      message(STATUS "Crypto extensions unavailable on your ARMv8 device")
    endif()

Can you rewrite the IF statements to make the right checks?

Also, on the previous topic of changing the instruction set, I still think the README.MD needs changing to reflect the GIT subdirectory called prosus.energy (cd into it to cmake) and not prosus anymore in this new release.

@Goro2030
Copy link
Contributor Author

While i wait through the painfull compilation time on a slooow RPI , and read through the warnings of the compiler, there's definetivelly wrong with the chacha8_key structure ... it looks like it's duplicated everywhere, or at least at a higher level once. Should open an issue to fix this:

In file included from /home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/CryptoNoteCore/CryptoNoteSerialization.h:21,
                 from /home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/CryptoNoteCore/CryptoNoteFormatUtils.h:10,
                 from /home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/WalletLegacy/WalletTransactionSender.cpp:7:
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/crypto/chacha8.h:23:10: note: ‘struct Crypto::chacha8_key’ declared here
   23 |   struct chacha8_key {
      |          ^~~~~~~~~~~

@yerkobits
Copy link
Member

I test and build over ARM emulator (qemu) and all is ok.
Some day, I will buy a physical Raspberry 4 to testing.
(I have only a Raspberry 2)

@Goro2030
Copy link
Contributor Author

It failed, at 78%. Any suggestion on what to change?

[ 78%] Building CXX object src/CMakeFiles/System.dir/Platform/Linux/System/Dispatcher.cpp.o
In file included from /home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:18:
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.h:54:3: error: ‘uint32_t’ does not name a type
   54 |   uint32_t events;
      |   ^~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.h:98:18: error: ‘uint8_t’ does not name a type
   98 |   alignas(void*) uint8_t mutex[SIZEOF_PTHREAD_MUTEX_T];
      |                  ^~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp: In constructor ‘System::{anonymous}::MutextGuard::MutextGuard(pthread_mutex_t&)’:
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:44:18: error: ‘runtime_error’ is not a member of ‘std’
   44 |       throw std::runtime_error("pthread_mutex_lock failed, " + errorMessage(ret));
      |                  ^~~~~~~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp: At global scope:
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:56:50: error: static assertion failed: invalid pthread mutex size
   56 | static_assert(Dispatcher::SIZEOF_PTHREAD_MUTEX_T == sizeof(pthread_mutex_t), "invalid pthread mutex size");
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp: In constructor ‘System::Dispatcher::Dispatcher()’:
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:87:53: error: ‘class System::Dispatcher’ has no member named ‘mutex’
   87 |           *reinterpret_cast<pthread_mutex_t*>(this->mutex) = pthread_mutex_t(PTHREAD_MUTEX_INITIALIZER);
      |                                                     ^~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:104:14: warning: unused variable ‘result’ [-Wunused-variable]
  104 |         auto result = close(remoteSpawnEvent);
      |              ^~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:109:10: warning: unused variable ‘result’ [-Wunused-variable]
  109 |     auto result = close(epoll);
      |          ^~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:113:14: error: ‘runtime_error’ is not a member of ‘std’
  113 |   throw std::runtime_error("Dispatcher::Dispatcher, "+message);
      |              ^~~~~~~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp: In destructor ‘System::Dispatcher::~Dispatcher()’:
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:135:9: warning: unused variable ‘result’ [-Wunused-variable]
  135 |     int result = ::close(timers.top());
      |         ^~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:144:75: error: ‘class System::Dispatcher’ has no member named ‘mutex’
  144 |   result = pthread_mutex_destroy(reinterpret_cast<pthread_mutex_t*>(this->mutex));
      |                                                                           ^~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp: In member function ‘void System::Dispatcher::clear()’:
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:160:18: error: ‘runtime_error’ is not a member of ‘std’
  160 |       throw std::runtime_error("Dispatcher::clear, close failed, "  + lastErrorMessage());
      |                  ^~~~~~~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp: In member function ‘void System::Dispatcher::dispatch()’:
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:184:24: error: ‘runtime_error’ is not a member of ‘std’
  184 |             throw std::runtime_error("Dispatcher::dispatch, read(remoteSpawnEvent) failed, " + lastErrorMessage());
      |                        ^~~~~~~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:187:69: error: ‘class System::Dispatcher’ has no member named ‘mutex’
  187 |         MutextGuard guard(*reinterpret_cast<pthread_mutex_t*>(this->mutex));
      |                                                                     ^~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:198:36: error: ‘struct System::OperationContext’ has no member named ‘events’
  198 |         contextPair->writeContext->events = event.events;
      |                                    ^~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:201:35: error: ‘struct System::OperationContext’ has no member named ‘events’
  201 |         contextPair->readContext->events = event.events;
      |                                   ^~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:211:18: error: ‘runtime_error’ is not a member of ‘std’
  211 |       throw std::runtime_error("Dispatcher::dispatch, epoll_wait failed, "  + lastErrorMessage());
      |                  ^~~~~~~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:219:18: error: ‘runtime_error’ is not a member of ‘std’
  219 |       throw std::runtime_error("Dispatcher::dispatch, swapcontext failed, " + lastErrorMessage());
      |                  ^~~~~~~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp: In member function ‘void System::Dispatcher::remoteSpawn(std::function<void()>&&)’:
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:268:65: error: ‘class System::Dispatcher’ has no member named ‘mutex’
  268 |     MutextGuard guard(*reinterpret_cast<pthread_mutex_t*>(this->mutex));
      |                                                                 ^~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:274:16: error: ‘runtime_error’ is not a member of ‘std’
  274 |     throw std::runtime_error("Dispatcher::remoteSpawn, write failed, " + lastErrorMessage());
      |                ^~~~~~~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp: In member function ‘void System::Dispatcher::yield()’:
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:313:24: error: ‘runtime_error’ is not a member of ‘std’
  313 |             throw std::runtime_error("Dispatcher::dispatch, read(remoteSpawnEvent) failed, " + lastErrorMessage());
      |                        ^~~~~~~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:316:71: error: ‘class System::Dispatcher’ has no member named ‘mutex’
  316 |           MutextGuard guard(*reinterpret_cast<pthread_mutex_t*>(this->mutex));
      |                                                                       ^~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:332:38: error: ‘struct System::OperationContext’ has no member named ‘events’
  332 |           contextPair->writeContext->events = events[i].events;
      |                                      ^~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:340:37: error: ‘struct System::OperationContext’ has no member named ‘events’
  340 |           contextPair->readContext->events = events[i].events;
      |                                     ^~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:347:20: error: ‘runtime_error’ is not a member of ‘std’
  347 |         throw std::runtime_error("Dispatcher::dispatch, epoll_wait failed, " + lastErrorMessage());
      |                    ^~~~~~~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp: In member function ‘System::NativeContext& System::Dispatcher::getReusableContext()’:
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:366:18: error: ‘runtime_error’ is not a member of ‘std’
  366 |       throw std::runtime_error("Dispatcher::getReusableContext, getcontext failed, " + lastErrorMessage());
      |                  ^~~~~~~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:378:18: error: ‘runtime_error’ is not a member of ‘std’
  378 |       throw std::runtime_error("Dispatcher::getReusableContext, swapcontext failed, " + lastErrorMessage());
      |                  ^~~~~~~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp: In member function ‘int System::Dispatcher::getTimer()’:
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:406:18: error: ‘runtime_error’ is not a member of ‘std’
  406 |       throw std::runtime_error("Dispatcher::getTimer, epoll_ctl failed, "  + lastErrorMessage());
      |                  ^~~~~~~~~~~~~
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp: In member function ‘void System::Dispatcher::contextProcedure(void*)’:
/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/src/Platform/Linux/System/Dispatcher.cpp:429:16: error: ‘runtime_error’ is not a member of ‘std’
  429 |     throw std::runtime_error("Dispatcher::contextProcedure, swapcontext failed, " + lastErrorMessage());
      |                ^~~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/System.dir/build.make:63: src/CMakeFiles/System.dir/Platform/Linux/System/Dispatcher.cpp.o] Error 1
make[2]: Leaving directory '/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/build'
make[1]: *** [CMakeFiles/Makefile2:337: src/CMakeFiles/System.dir/all] Error 2
make[1]: Leaving directory '/home/ubuntu/prosus.money-0.8.4/prosus.money/cli/build'
make: *** [Makefile:84: all] Error 2

@Goro2030
Copy link
Contributor Author

Goro2030 commented Mar 17, 2021 via email

@driquelme
Copy link
Contributor

Were you able to solve this @Goro2030 ?

@driquelme
Copy link
Contributor

The error is related to the following code section in cli/src/Platform/Linux/System/Dispatcher.h

#ifdef __x86_64__
# if __WORDSIZE == 64
  static const int SIZEOF_PTHREAD_MUTEX_T = 40;
# else
  static const int SIZEOF_PTHREAD_MUTEX_T = 32;
# endif
#else
  static const int SIZEOF_PTHREAD_MUTEX_T = 24;
#endif

The value for __WORDSIZE is not 64, and in my case the expected value for SIZEOF_PTHREAD_MUTEX_T is 24.

I'm compiling for a Cortex-A53 processor.

@Goro2030
Copy link
Contributor Author

Goro2030 commented Apr 13, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants