In this guide, you will learn how to run x86 applications on a Raspberry Pi using the box86 software.
box86 is a userspace emulation software that allows you to run Linux x86 applications on an ARM device such as the Raspberry Pi.
Using this software, we can run a variety of x86 software on our Raspberry Pi. This supported software includes applications like Zoom or games like World of Goo.
There are some caveats to using box86 on your Raspberry Pi. The first is that it can only run x86 applications. Software built for 64-bit will not run at all.
The second is that you need to be running a 32-bit system. The way box86 is designed is that it converts the typical x86 calls into 32-bit ARM calls.
One of the best features of Box86 is that it features a dynamic recompiler (DynaRec). As the name suggests, a dynamic recompiler takes the instructions and actively recompiles them into optimized ARM instructions.
An interpreter, by contrast, would map the x86 instructions to an ARM equivalent without consideration to how well optimized the result would be.
In the case of box86, the DynaRec feature allows the emulator to run software 5 to 10 times faster than what its interpreter is capable of.
Please note that box86 is purely an x86 to ARM emulator. You can’t run Windows applications using box86 on your Raspberry Pi. Instead, you will need to use Wine alongside box86 for that.
Below you can see a list of equipment we used for running x86 apps on our Raspberry Pi using box86.
Micro SD Card (8GB+)
Preparing your Raspberry Pi for Box86
Before we can compile the x86 emulator to our Raspberry Pi, we will need to do a bit of preparation.
Compiling box86 on the Raspberry Pi requires a few packages that may not be currently installed on your system.
1. To ensure we have an up-to-date package list and are working off the latest packages, lets first update the operating system.
If you are running Raspberry Pi OS, you can run the following two commands to update it.
sudo apt update sudo apt full-upgrade
2. Once the OS finishes updating, we can install all of the packages we need to compile box86.
We can install all the packages we want by running the command below.
sudo apt install git build-essential cmake
In this case, we need to install the
git package so that we can clone the repository from GitHub.
build-essential package contains the compiler itself, among other things that we need to compile box86 itself on our Raspberry Pi.
Lastly, we need to install the
cmake package. This tool is to generate build files so that we can compile the x86 emulator on the Raspberry Pi.
3. Now that we have the needed packages installed, let us clone the box86 code.
Cloning code from GitHub is super simple. thanks to the
Run the following command on your device to clone the x86 emulator’s code to your Raspberry Pi.
git clone https://github.com/ptitSeb/box86
Compiling the x86 Emulator on the Raspberry Pi
Now that we have prepared the Raspberry Pi to compile box86, we can now move on.
Compiling the x86 emulator on our device is relatively straightforward now that we have the packages we need.
1. Start by changing into the directory where we cloned the box86 code to.
You can do this by running the following command.
2. We need to create an additional directory where the compiler will store the box86 builds.
Run the following two commands to create the “
build” directory and then change to it.
mkdir build cd build
3. Within this directory, we can prepare the box86 emulator to compile on our Raspberry Pi.
We achieve this by making use of the
cmake package we installed earlier.
This command differs slightly on whether you are compiling the x86 emulator for the Raspberry Pi 2, 3, or 4.
Generating the Makefile on the Raspberry Pi 4
cmake .. -DRPI4=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
Using the CMake Command on the Raspberry Pi 3
cmake .. -DRPI3=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
CMake Command for Raspberry Pi 2
cmake .. -DRPI2=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
While box86 does support the Raspberry Pi 1 and Zero, it is not worth using it for these devices due to the lack of support for the dynamic recompiler.
4. CMake will now generate the makefile to compile the box86 software on our Raspberry Pi.
We can use this file to compile the x86 emulator on our Raspberry Pi by using the following command.
We use the “
-j” argument to tell the compiler to use multiple processors to compile the software.
$(nproc)” we automatically insert the number of cores our processor has into the command.
5. Once the compiler finishes running, we can install the box86 emulator onto our Raspberry Pi.
Run the following command to install the software on our device.
sudo make install
6. Finally, we need to restart the
Restarting the service after installing box86 allows it to be aware of additional binary formats that it can now support.
sudo systemctl restart systemd-binfmt
If you experience an error when running this command, try restarting your Raspberry Pi.
Running an Application using box86 on your Raspberry Pi
Now that we have the x86 emulator installed on the Raspberry Pi let us quickly run through a test to show it working.
To showcase how box86 runs on the Raspberry Pi, we are going to install the TeamSpeak server.
We chose the TeamSpeak server as it is only available for the x86 version of Linux and is freely available, and does not have any builds for the ARM architecture.
1. Start by making sure that you are back in the home directory of your Raspberry Pi.
You can use the
cd command followed by the tilde symbol (
~) to move back to the home.
2. Once you are back in the home directory, let us use “
wget” to download TeamSpeak.
Please note that the version of TeamSpeak we are downloading may not be the latest available.
As the TeamSpeak server is built for x86 versions of Linux, it wouldn’t typically work on the Raspberry Pi.
However, thanks to box86, we will now be able to run the software thanks to its x86 emulation.
3. Once the archive has finished downloading to your Raspberry Pi, we need to extract it.
We can extract the x86 version of TeamSpeak from its archive to our Raspberry Pi by using the
tar -xvpf teamspeak3-server_linux_x86-3.13.3.tar.bz2
4. Now that we have extracted the TeamSpeak server, let us change to the directory.
Again making use of the
cd command, switch to the directory.
5. Before we can use Box86 to run this x86 application on our Raspberry Pi, we need to do one last thing.
Before TeamSpeak’s server runs, it requires us to accept their terms and conditions.
We can do this by creating a file called “
.ts3server_license_accepted” within the same directory as the server.
6. Finally, we can see Box86, at work by running the TeamSpeak server.
The magic of Box86 is that you don’t have to use any additional commands to run x86 software on your Raspberry Pi.
box86 is automatically configured to detect when an x86 application is being run and take over from there.
7. When you run x86 software on your Raspberry Pi’s command line, you should see the following text appear.
By seeing this text, you will know that box86 is now in charge of emulating the software. In our case, it is using the dynamic recompiler.
Box86 with Dynarec v0.2.1 ddd4d37a built on Feb 26 2021 05:11:18
Hopefully, you now understand how you can use box86 to run x86 applications on your Raspberry Pi.
The box86 emulator is a powerful piece of software but has some caveats that you have to deal with.
While the emulator isn’t perfect, it can run a large amount of software at decent speeds with little to no issues.
In this guide, we have shown you how box86 can run software such as the TeamSpeak server. You can also use box86 to run numerous video games.
If it is a relatively old video game or one that uses 2D graphics, then there is the chance that you can run it using box86 on your Raspberry Pi. We have seen games like Undertale, World of Goo, and FTL played on a Raspberry Pi 4 by using box86.
If you have run into issues with getting box86 to run on your Raspberry Pi, please leave a comment below.
Be sure to check out some of our other Raspberry Pi projects.