waku-org / nwaku

Waku node and protocol.
Other
202 stars 53 forks source link

feat: Generate a binary(cross compiled) to run nwaku on a Raspberry Pi #1847

Open chaitanyaprem opened 1 year ago

chaitanyaprem commented 1 year ago

Problem

I have a raspberry pi 3B which is an ARMv8 CPU and 1GB RAM. I wanted to run nwaku node on it. If i try to compile nwaku on it, it gets stuck and gets rebooted after 8-10 hours or so, probably running out of resources.

Suggested solution

We can cross-compile nwaku and then copy relevant binary and dependent files and then run it on the RPI ideally using a docker environment. Once this is successfull, we can record the steps for the same so that other can similarly follow for various other resource-restricted devices.

Nimbus team already has an option to build using docker, and this is the pointer given by them to do something similar for nwaku. We can probably take their base image (which should have all the required toolchain) and then just write instrucitons to compile nwaku within the container. follow the dist target we have for creating a binary distribution of nimbus: https://github.com/status-im/nimbus-eth2/blob/stable/Makefile#L807 - this works on linux at least

Alternatives considered

None

Additional context

Below are my environment details : RPI : Linux pi 5.15.84-v7+ #1613 SMP

Acceptance criteria

SionoiS commented 1 year ago

:+1: for this.

I will be soon the owner of https://computeblade.com/ and running Waku is on my list too!

vpavlin commented 1 year ago

Sounds good! Yeah, we should definitely produce both binaries (and make them available through standard release process) and docker images.

vpavlin commented 1 year ago

We can keep this issue around and close it when we verify it actually works on RPi, but I've recently created more general issue as well as it is not just raspberry and arm64: https://github.com/waku-org/nwaku/issues/1879

Ivansete-status commented 11 months ago

After applying a short try during the weekend (https://earthly.dev/blog/cross-compiling-raspberry-pi/ and/or https://deardevices.com/2019/04/18/how-to-crosscompile-raspi/) , I noticed that there are difficulties around cross-compiling nim-bearssl. Its C code seems not to be fully prepared and I got the following compilation error:

/home/shared/nwaku/vendor/nim-bearssl/bearssl/abi/../csources/src/inner.h:2527:23: fatal error: x86intrin.h: No such file or directory
 #include <x86intrin.h>

On the other hand, in the official https://www.bearssl.org/ portal we have:

image

( cc @arnetheduck )

arnetheduck commented 11 months ago

we compile bearssl successfully for raspberry in nimbus - see arm64 builds here: https://github.com/status-im/nimbus-eth2/blob/unstable/.github/workflows/release.yml#L80C20-L80C20

Ivansete-status commented 6 months ago

We can use the following repo as a good reference on how to achieve that: https://github.com/richard-ramos/gonimffi

( thanks @richard-ramos for that btw! )