Run WASM in Raspberry Pi 4 Today

WebAssembly (WASM) can run in almost all OS and architect, including Raspberry Pi. However, at the time of my test (Mar 1, 2020), only the wasmer claim and successfully run on my Pi 4. Other runtimes are either in planned mode or WIP.

I would like to share some of my experiences running WASM in Raspberry PI4 and some mistakes I made during the test. I hope it can help you if you want to try the same thing on your Pi.

Disclaimer: WASM is a rapidly growing community and new tools new builds coming up every day. All the experiences I shared with you today may not be valid at the time you read it. So please take it on your own.

Wasmtime is the first runtime I tried. But it doesn’t support ARM yet. Currently, only x86–64 works with Wasmtime. I know some other day it will work on ARM.

WAVM claimed the AArch64 support is in WIP (Work in Progress)mode, so I only tried on my Mac. It works excellent, just not on my Pi.

So Wasmer seems to be the only choice. I also read others blogs about the successful running Wasmer on Pi. So I tried on my own.

The Raspbian OS comes with my Pi is 32 bit, although the Pi’s hardware is 64 bit. I guess it is due to compatibility concerns. Others suggest switch existing Raspbian’s kernel to 64 bit by adding a line

arm_64bit=1

to the config.txt in /boot directory. (Reference: https://medium.com/@kavoshex/raspian-added-support-for-64-bit-kernel-6cf27c2b26db). I think this will work but I did not try because I would like to taste some other 64 bit Pi OS. So I move to Manjaro 64 bit ( https://manjaro.org/download/#ARM).

Installing Manjaro went smoothly. I found it looks more beautiful than Raspbian (well, I know I consider every new thing more impressive).

But when I try to install wasmer using the easiest way doesn’t work.

By default we can install wasmer using curl: curl https://get.wasmer.io -sSfL | sh At least at the time when I tested this works on x86-64. The script did not find the corresponding binary for ARM64.

Well, I have to build from source, I know it will take very long on an ARM CPU even if I have 4G RAM on my Pi.

I followed the instruction from https://docs.wasmer.io/ecosystem/wasmer/building-from-source and built the wasmer from the source. There is one thing I need to note here: Currently (Mar 1…

--

--