Build lighthouse on RISC-V CPU architecture
Description
To be able to build Lighthouse on a risc-v platform we found the following packages to be a problem. This ticket is meant as a reference to see what needs to be done and also coordinate with the upstream libraries.
cpufeatures
Is used in about a dozen packages in lighthouse and needs to be fixed upstream. It does not have any support for RISC-V and fails building which prevents all these packages to be built.
ring
0.16 versions of the library do not build on riscv, the 0.17 versions do. Unfortunately this library is used a few levels deep in the following packages:
jsonwebtokenwithin lighthousebeacon_node/execution_layer. It can be updated from 8 to 9 which uses the newer ring package without issues and then builds.rcgenused inlibp2p-tlsdepends on the 0.16 version. The newer version ofrcgen(0.12.1 or 0.13) support riscv. ,
libp2p-tls
As mentioned above this library needs to have its ring dependency updated through an update of the rcgen package to at least v0.12.1. Unfortunately v0.13 changes some function signatures and would therefore make a larger rework of libp2p necessary. Luckily version 0.12.1 of rcgen supports riscv with maybe only minimal changes in libp2p. So this might be the best option.
We fixed these packages locally in our own setup in a quick and dirty way and know that lighthouse builds and runs on a risc-v board. It can even sync to testnet/mainnet.
We will try to make the necessary PRs to some of these packages in the coming weeks and will see with the upstream projects what the best solution will be.
If anyone sees a different approach to updating these dependencies we can obviously go a different path.
Version
We based our RISC-V builds on the 5.2.1 release of lighthouse.
Present Behaviour
Builds and runs on RISC-V from our own forked repository.
Expected Behaviour
Hopefully we will get the changes into the necessary packages such that lighthouse can be built on RISC-V architecture directly from the official repository.