How to run Windows programs on Android with Box86 + Wine in Termux Proot

๐Ÿ‡น๐Ÿ‡ผ ไธญๆ–‡็‰ˆ

We can run Windows programs (.exe) with Box86 and Wine in Termux proot on Android. No root required.

Wine is a translation layer for running x86/x64 Windows programs on Linux. However, most of Android devices run on ARM architecture so Wine will not work in ARM platform.

Fortunately, a new program named Box86 can transalte x86 instructions into ARM instructions. And there is Box64 for transalting x64 instrcutions.

Therefore, you can run x86 appplications on ARM devices! And Box86 is faster than QEMU emualtion.

By combining Box86 and Wine, now we could run Windows programs in Termux proot.

1. Install Termux Proot

Install proot Debian and setup Termux X11.

2. Compile Box86 & Box64

Log into proot Debian as normal user.

  1. Install following packages:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
sudo apt update && sudo apt upgrade -y
sudo apt install git build-essential cmake wget -y
sudo dpkg --add-architecture armhf
sudo apt update && sudo apt upgrade -y
sudo apt install gpg -y
sudo apt install libgl1:armhf libgl1 -y
sudo dpkg --add-architecture armhf && sudo apt-get update
sudo apt install libasound2:armhf libc6:armhf libglib2.0-0:armhf libgphoto2-6:armhf libgphoto2-port12:armhf libgstreamer-plugins-base1.0-0:armhf libgstreamer1.0-0:armhf libpcap0.8:armhf libpulse0:armhf libsane1:armhf libudev1:armhf libusb-1.0-0:armhf libx11-6:armhf libxext6:armhf ocl-icd-libopencl1:armhf libasound2-plugins:armhf libncurses6:armhf libcap2-bin:armhf libcups2:armhf libdbus-1-3:armhf libfontconfig1:armhf libfreetype6:armhf libglu1-mesa:armhf libgnutls30:armhf libgssapi-krb5-2:armhf libkrb5-3:armhf libodbc1:armhf libosmesa6:armhf libsdl2-2.0-0:armhf libv4l-0:armhf libxcomposite1:armhf libxcursor1:armhf libxfixes3:armhf libxi6:armhf libxinerama1:armhf libxrandr2:armhf libxrender1:armhf libxxf86vm1:armhf -y
sudo apt install libasound2 libc6 libglib2.0-0 libgphoto2-6 libgphoto2-port12 libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 libpcap0.8 libpulse0 libsane1 libudev1 libunwind8 libusb-1.0-0 libx11-6 libxext6 ocl-icd-libopencl1 libasound2-plugins libncurses6 libcap2-bin libcups2 libdbus-1-3 libfontconfig1 libfreetype6 libglu1-mesa libgnutls30 libgssapi-krb5-2 libkrb5-3 libodbc1 libosmesa6 libsdl2-2.0-0 libv4l-0 libxcomposite1 libxcursor1 libxfixes3 libxi6 libxinerama1 libxrandr2 libxrender1 libxxf86vm1 -y
sudo apt clean && sudo apt autoremove
  1. Compile Box86. It takes roughly five minutes to finish on my Snapdragon 865 phone.
1
2
3
4
5
6
7
8
9
cd ~/
sudo apt-get install libc6:armhf
sudo apt install gcc-arm-linux-gnueabihf
git clone https://github.com/ptitSeb/box86
cd box86
mkdir build; cd build; cmake .. -DRPI4ARM64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j$(nproc)
sudo make install
cd ~ && rm -r box86
  1. Compile Box64.
1
2
3
4
5
6
7
cd ~/
git clone https://github.com/ptitSeb/box64.git
cd box64 && mkdir build && cd build
cmake .. -DRPI4ARM64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j$(nproc)
sudo make install
cd ~ && rm -r box64

3. Install Wine and Wine64

Wine is for running x86 (32bit) programs;whereas Wine64 is for x64 programs.

Since we are on ARM64 platform, we cannot install pacakges (i386:wine) from different architecture while using APT. Here we will install Wine by downloading binaries and creating sysmlinks for them.

  1. Create a directory for Wine
1
mkdir wine && cd wine
  1. Download Wine binaries from Kron4ek’s Wine-Builds. This archive contains Wine and Wine64
1
wget https://github.com/Kron4ek/Wine-Builds/releases/download/8.12/wine-8.12-amd64.tar.xz
  1. Extract the archive. Create symlinks. Done
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
tar -xvf wine-8.12-amd64.tar.xz
mv ~/wine-8.12-amd64/ ~/wine
rm -rf wine-8.12-amd64.tar.xz
sudo ln -s ~/wine/bin/wine64 /usr/local/bin/wine64
sudo ln -s ~/wine/bin/wine /usr/local/bin/wine
sudo ln -s ~/wine/bin/wineboot /usr/local/bin/wineboot
sudo ln -s ~/wine/bin/winecfg /usr/local/bin/winecfg
sudo ln -s ~/wine/bin/wineserver /usr/local/bin/wineserver
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
sudo mv winetricks /usr/local/bin/
sudo chmod +x /usr/local/bin/wine /usr/local/bin/wineboot /usr/local/bin/winecfg /usr/local/bin/wineserver

4. Run exe with Box86 + Wine

You could check the comapbility of specific programs on Wine Application Database. Note currently you might not be unable to install dependecies through Winetricks, you have to install dependencies (such as Visual C++ Redistributable Runtimes) manually.

Some programs may need GPU Acceleration to work.


Make sure to check your programs is 32bit or 64bit before running them.

For example, to run Notepad++ 32bit, open terminal at the directory where the exe is, and run:

1
box86 wine notepad++.exe

Wait for few seconds, then the window of Notepad++ will pop out.

If the program is 64 bit, run with Box64 instead:

1
box64 wine64 notepad++.exe

You could use WINEPREFIX to create a separate directory (the fake “C drive” created by Wine) for running specific programs:

1
2
3
export WINEPREFIX=~/.wine64
export WINEARCH=win64
box64 wine64 notepad++.exe

References


Thanks for your reading. You are welcome to share articles of Ivon's Blog (ivonblog.com). Please include the original URL when reprinting or citing articles, and abide by CC BY-NC-ND 4.0 license. For commercial use, please write an e-mail to me.

written by human, not by AI

If this article is helpful to you please consider supporting me.

Leave a comment

Choose the commenting system you like. Giscus for codes, Disqus for anonymous comments.

Please login to your Github account to leave a comment. You can post codes here for discussion. For images, please upload to Imgur and copy links. Your comments would be visible to everyone on Github Discussions.

This comment system is provided by Disqus, you may see some Disqus ADs on this page. You can leave a comment anonymously but you won't receive reply notifications.