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

Build libp2p on RISC-V CPU architecture #5590

Open
haurog opened this issue Sep 5, 2024 · 0 comments
Open

Build libp2p on RISC-V CPU architecture #5590

haurog opened this issue Sep 5, 2024 · 0 comments

Comments

@haurog
Copy link

haurog commented Sep 5, 2024

Description

To make libp2p build on the RISC-V CPU architecture (sigp/lighthouse#6297) thering library used in the rcgen package needs to be updated. Luckily version 0.12 and above depend on the newer (v0.17) ring package. Unfortunately, some changes are necessary to upgrade to the newer version. I personally see 2 ways to get there. I will add working versions for both these upgrade paths in separate PRs.

Path 1: update to rcgen 0.12.1

libp2p directly depends on the rcgen package, but there is an additional dependency: libp2p-webrtc is using webrtc which depends on rcgen as well. None of the webrtc versions use rcgen v0.12 They directly jump from v0.11 to v0.13

A solution is to update rcgen to 0.12.1 in the main Cargo.toml, but use a lower version (v0.11.3) in the webrtc Cargo.toml.

This works with only minimal changes and achieves the goal of being able to build lighthouse as it only depends on libp2p-tls. But now libp2p uses 2 different versions of rcgen, which I think is a bit ugly. It is a simple and fast change without though.

Path 2: update to rcgen 0.13

rcgen changed their interface substantially in the 0.12->0.13 upgrade (https://github.com/rustls/rcgen/blob/main/rcgen/docs/0.12-to-0.13.md). Therefore, this approach needs a few changes in the tls and webrtc part of libp2p. The imported webrtc package also needs to be update to 0.11 which also changes the interface which leads to additional changes.

The changes in the PR upgrading of rcgen to 0.13 should not be taken as a final version. My goal was to get things running to see how many changes are necessary. I do not know the rcgen and libp2p2 code base well enough to make sure I did not break anything with these changes. I ran all the tests (minus doc tests) and they all passed. I also built the lighthouse client which depends on libp2p-tls and it works and the client runs without any issues. So my changes did not break anything obvious.

I obviously would be very happy if you find a more elegant way to upgrade the rcgen dependency so we can get a step closer to build lighthouse on a RISC-V CPU architecture.

Motivation

The goal is to get lighthouse, which depends on libp2p-tls to build on RISC-V boards: sigp/lighthouse#6297

Locally with my own changes it does and it works perfectly. The goal is to incorporate all these changes to the respective repos.

Current Implementation

Currently building on RISC-V architecture fails due to the ring library which is used by rcgen. Newer versions work and the goal of this enhancement suggestion is to update to a newer version.

Are you planning to do it yourself in a pull request ?

Yes

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

1 participant