Skip to content

Use under box64 on WSL on arm64: works #26

@ajorg

Description

@ajorg

I wanted to give MicroPythonOS a go, but the machine I'm using is a Snapdragon arm64 Windows 11 machine. It worked, with some workarounds. There's mention in the documentation that it should work under WSL, and that "It would be great if someone could give this a try and report back with the results in the chat or in a GitHub issue." This isn't precisely that, since I'm testing on arm64, but it's close so I thought I'd report.

I tried to build it first, wanting to try it in native arm64. This failed with some errors between SDL and Pipewire:

[ 72%] Building C object CMakeFiles/SDL2-static.dir/src/audio/sndio/SDL_sndioaudio.c.o
/home/user/MicroPythonOS/lvgl_micropython/lib/SDL/src/audio/pipewire/SDL_pipewire.c: In function ‘node_event_info’:
/home/user/MicroPythonOS/lvgl_micropython/lib/SDL/src/audio/pipewire/SDL_pipewire.c:593:37: error: passing argument 1 of ‘pw_node_enum_params’ from incompatible pointer type [-Wincompatible-pointer-types]
593 |             pw_node_enum_params(node->proxy, 0, info->params[i].id, 0, 0, NULL);
|                                 ~~~~^~~~~~~
|                                     |
|                                     struct pw_proxy *
In file included from /usr/include/pipewire-0.3/pipewire/pipewire.h:30,
from /home/user/MicroPythonOS/lvgl_micropython/lib/SDL/src/audio/pipewire/SDL_pipewire.h:28,
from /home/user/MicroPythonOS/lvgl_micropython/lib/SDL/src/audio/pipewire/SDL_pipewire.c:29:
/usr/include/pipewire-0.3/pipewire/node.h:208:58: note: expected ‘struct pw_node *’ but argument is of type ‘struct pw_proxy *’
208 | PW_API_NODE_IMPL int pw_node_enum_params(struct pw_node *object,
|                                          ~~~~~~~~~~~~~~~~^~~~~~
gmake[2]: *** [CMakeFiles/SDL2-static.dir/build.make:2165: CMakeFiles/SDL2-static.dir/src/audio/pipewire/SDL_pipewire.c.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/Makefile2:159: CMakeFiles/SDL2-static.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

It's late, so I didn't try to figure out why. This was on Debian 13, if it matters.

So the next thing to try was to download the release build for Linux amd64 and see if I could run it under emulation. Box64 got me nearly there, with only this error:

[BOX64] Error loading needed lib libffi.so.8

I gather it means Box64 doesn't know how to wrap that one, so it needs the native library. This can be accomplished on Debian arm64 in the following way:

First, you need to download the Debian build of libffi8, for amd64:

  1. Add the amd64 architecture (danger: don't try to install stuff, we don't want the OS to get confused.)
    • sudo dpkg --add-architecture amd64
  2. Get the repo metadata
    • sudo apt update
  3. Download the package
    • apt download libffi8:amd64
  4. Disable the architecture again, so you don't mess up your system with a lot of incompatible libraries
    • sudo dpkg --remove-architecture amd64
    • sudo apt update
  5. Extract the package
    • mkdir extracted_libs
    • dpkg-deb -x libffi8_*.deb ./extracted_libs
  6. Tell Box64 where to find the library
    • export BOX64_LD_LIBRARY_PATH=$PWD/extracted_libs/usr/lib/x86_64-linux-gnu/

At this point you can simply prefix the command to start the amd64 binary from releases with box64

cd internal_filesystem/
box64 ../MicroPythonOS_amd64_linux_0.7.1.elf -X heapsize=32M -v -i -c "$(cat boot_unix.py main.py)"

I figure if I can make it work under WSL on Snapdragon, it should be easy to run under WSL on an amd64 machine. I hope this helps!

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions