Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Update linux-arm64 native lib #6

Closed
wants to merge 1 commit into from

Conversation

jclapis
Copy link

@jclapis jclapis commented May 6, 2022

The current native library built for linux-arm64 was built on a system that supported the pmull instruction, which is optional for ARMv8. Some CPUs, namely the BCM2711 used by the Raspberry Pi 4B, do not support pmull. This means that Nethermind doesn't work on Raspberry Pi's - it fails with an "Illegal Instruction" error as shown here:

NethermindEth/nethermind#3247 (comment)

This PR replaces the native library with one that was built directly on a Raspberry Pi. It was built on Debian 9 with GCC 6 - as far as I can tell, that is what the original library was built against. It is a drop-in replacement; I can confirm that with this one file changed, Nethermind now works on a Raspberry Pi. You can pull and verify with my Docker image hosted here:

https://hub.docker.com/layers/nethermind/rocketpool/nethermind/1.12.8-pi/images/sha256-9c0263423eead15f633791ff0fd657bb81ffd6137433e8084ba5b07e4c3b03c3?context=explore

I don't have access to other arm64 platforms so I can't verify whether or not this works with them, but I know the BCM2711's feature set is quite sparse so I would imagine if a Pi can run it, anything can run it.

@LukaszRozmej
Copy link
Member

@jclapis great work! I think we cannot just accept PR with a native binary for security reasons, but we will build rocks db ourselves with proper flags for Rasbery Pi 4B. Can you suggest changes to https://github.com/NethermindEth/rocksdb-sharp/blob/master/native-build/build-rocksdb.sh ?

@matilote could you change that pmull flag?

@LukaszRozmej LukaszRozmej requested a review from matilote May 6, 2022 10:25
@jclapis
Copy link
Author

jclapis commented May 6, 2022

@jclapis great work! I think we cannot just accept PR with a native binary for security reasons, but we will build rocks db ourselves with proper flags for Rasbery Pi 4B. Can you suggest changes to https://github.com/NethermindEth/rocksdb-sharp/blob/master/native-build/build-rocksdb.sh ?

@matilote could you change that pmull flag?

Possibly, the easiest thing to do is natively build it on a platform that doesn't have pmull support like a Pi, which is what I did here. If you're cross compiling on an x64 system, we'll likely have to mess with some of the flags to see if we can disable it.

That being said, the build script you linked hasn't been updated in 4 years and I'm sure that's not what you're using to build the libraries today because it doesn't have ARM support and some of its flags (e.g. CFLAGS=-static-libstdc++) are different than what the canonical arm64 library was built with. If you can push the version you use and provide some info on your build environment, I can try to work something out.

@LukaszRozmej
Copy link
Member

Closing in favour of #7, but we are grateful for the investigation and contribution

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

Successfully merging this pull request may close these issues.

2 participants