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. Install Box86 & Box64#
- Log into proot Debian as normal user.
proot-distro login debian --user user shared-tmp
- Enable armhf support
dpkg --add-architecture armhf
- Add ryanfortner’s repo and install Box86
sudo apt install gpg
sudo wget https://ryanfortner.github.io/box86-debs/box86.list -O /etc/apt/sources.list.d/box86.list
wget -qO- https://ryanfortner.github.io/box86-debs/KEY.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/box86-debs-archive-keyring.gpg
sudo apt update
sudo apt install box86-android
- Add ryanfortner’s repo and install Box64
sudo wget https://ryanfortner.github.io/box64-debs/box64.list -O /etc/apt/sources.list.d/box64.list
wget -qO- https://ryanfortner.github.io/box64-debs/KEY.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/box64-debs-archive-keyring.gpg
sudo apt update
sudo apt install box64-android
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 foreign architecture while using APT. Here we will install Wine by downloading binaries and moving them to the proper path.
- Install Wine’s dependencies
sudo apt install nano cabextract libfreetype6 libfreetype6:armhf libfontconfig libfontconfig:armhf libxext6 libxext6:armhf libxinerama-dev libxinerama-dev:armhf libxxf86vm1 libxxf86vm1:armhf libxrender1 libxrender1:armhf libxcomposite1 libxcomposite1:armhf libxrandr2 libxrandr2:armhf libxi6 libxi6:armhf libxcursor1 libxcursor1:armhf libvulkan -dev libvulkan-dev:armhf zenity
- Download Wine and Wine64 from Kron4ek’s Wine-Builds. The latest version is Wine 9.7.
cd ~/
wget https://github.com/Kron4ek/Wine-Builds/releases/download/9.7/wine-9.7-amd64.tar.xz
wget https://github.com/Kron4ek/Wine-Builds/releases/download/9.7/wine-9.7-x86.tar.xz
- Unzip the file and delete redundant files
tar xvf wine-9.7-amd64.tar.xz
tar xvf wine-9.7-x86.tar.xz
rm wine-9.7-amd64.tar.xz wine-9.7-x86.tar.xz
mv wine-9.7-amd64 wine64
mv wine-9.7-x86 wine
- Create a symbolic link and point
/usr/local/bin/wine
to$HOME/wine/bin/wine
.
echo '#!/bin/bash
export WINEPREFIX=~/.wine32
box86 '"$HOME/wine/bin/wine "'"$@"' > /usr/local/bin/wine
chmod +x /usr/local/bin/wine
echo '#!/bin/bash
export WINEPREFIX=~/.wine64
box64 '"$HOME/wine64/bin/wine64 "'"$@"' > /usr/local/bin/wine64
chmod +x /usr/local/bin/wine64
- Add the PATH of Box86 and Box64 to
~/.bashrc
echo 'export DISPLAY=:0
export BOX86_PATH=~/wine/bin/
export BOX86_LD_LIBRARY_PATH=~/wine/lib/wine/i386-unix/:/lib/i386-linux-gnu/:/lib/aarch64-linux-gnu/:/lib/arm-linux-gnueabihf/:/usr/lib /aarch64-linux-gnu/:/usr/lib/arm-linux-gnueabihf/:/usr/lib/i386-linux-gnu/
export BOX64_PATH=~/wine64/bin/
export BOX64_LD_LIBRARY_PATH=~/wine64/lib/i386-unix/:~/wine64/lib/wine/x86_64-unix/:/lib/i386-linux-gnu/:/lib/x86_64-linux-gnu:/lib/aarch64 -linux-gnu/:/lib/arm-linux-gnueabihf/:/usr/lib/aarch64-linux-gnu/:/usr/lib/arm-linux-gnueabihf/:/usr/lib/i386-linux-gnu /:/usr/lib/x86_64-linux-gnu' >> ~/.bashrc
source ~/.bashrc
- Install Winetricks
cd ~/
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
chmod +x winetricks
mv winetricks /usr/local/bin/
echo '#!/bin/bash
export BOX86_NOBANNER=1 WINE=wine WINEPREFIX=~/.wine32 WINESERVER=~/wine/bin/wineserver
wine '"/usr/local/bin/winetricks "'"$@"' > /usr/local/bin/winetricks32
chmod +x /usr/local/bin/winetricks32
echo '#!/bin/bash
export BOX64_NOBANNER=1 WINE=wine64 WINEPREFIX=~/.wine64 WINESERVER=~/wine64/bin/wineserver
wine64 '"/usr/local/bin/winetricks "'"$@"' > /usr/local/bin/winetricks64
chmod +x /usr/local/bin/winetricks64
- Create a shortcut to the Wine file manager on the Linux desktop, so that you can directly click the exe to start:
cd ~/Desktop
echo '[Desktop Entry]
Name=Wine32 Explorer
Exec=bash -c "wine explorer"
icon=wine
Type=Application' > ~/Desktop/Wine32_Explorer.desktop
chmod +x ~/Desktop/Wine32_Explorer.desktop
cp ~/Desktop/Wine32_Explorer.desktop /usr/share/applications/
cd ~/Desktop
echo '[Desktop Entry]
Name=Wine64 Explorer
Exec=bash -c "wine64 explorer"
icon=wine
Type=Application' > ~/Desktop/Wine64_Explorer.desktop
chmod +x ~/Desktop/Wine64_Explorer.desktop
cp ~/Desktop/Wine64_Explorer.desktop /usr/share/applications/
4. Install DXVK#
DXVK is a Vulkan-based translation layer for Direct3D 9/10/11. This may improve performance of some Windows games.
- Install dependencies
sudo apt install mesa-vulkan-drivers mesa-vulkan-drivers:armhf libvulkan1 libvulkan1:armhf
- Download the latest version of DXVK from Github. The latest version is 2.3.1
wget https://github.com/doitsujin/dxvk/releases/download/v2.3.1/dxvk-2.3.1.tar.gz
- Unzip and move the dxvk files to the Wine directory
tar xvf dxvk-2.3.1.tar.gz
cddxvk-2.3.1
cp x32/* ~/.wine32/drive_c/windows/system32
cp x32/* ~/.wine64/drive_c/windows/system32
cp x64/* ~/.wine64/drive_c/windows/syswow64
- Open Wine settings, switch to the library tab, and overwrite the DLL files of d3d11, d3d10core, dxgi, and d3d9.
wine winecfg
wine64 winecfg
5. Run exe with Box86 + Wine#
You could check the comapbility of specific programs on Wine Application Database and install the packages through winetricks
.
Some programs may need GPU Acceleration to work.
Make sure to check your programs are 32bit or 64bit before running them.
For example, to run Notepad++ 32bit, open terminal at the directory where the exe is, and run:
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:
box64 wine64 notepad++.exe
You could use WINEPREFIX
to create a separate directory (the fake “C drive” created by Wine) for running specific programs:
export WINEPREFIX=~/.wine64
export WINEARCH=win64
box64 wine64 notepad++.exe