[Script] Compile WINE with 32-Bit App Support

I wanted Wine up and running on my Alma Linux machine, but the version that you get from dnf install wine only has 64-bit app support.

A majority of Windows apps are 32-bit, so this wasn’t going to work for me. So I figured I’d just compile Wine from source with 32-bit support, how hard could it be?

Thankfully, there is some documentation to help you out: Building Wine - WineHQ Wiki, but the suggested package names for Fedora don’t line up perfectly with Alma’s packages. Also, it wasn’t super clear to me how you’re supposed to compile the two separate versions (32-bit and 64-bit) and get them to play nice with each other.

Anyway, took me a few days to get all the pieces together. I’d like to share the result of my efforts in the form of a bash script for my own future reference in case I ever need to do this again and to give anyone else on this journey a shortcut.

I tested this on Alma Linux 9.2 x64.

The script will grab all development dependencies for 32 bit and 64 bit compiling, compile the two separate Wine versions linking them together, and install them both.


# Make sure we don't have Wine already installed from repo
sudo dnf remove wine

# Needed by winetricks
sudo dnf install epel-release
sudo dnf install p7zip p7zip-plugins cabextract

# Needed for compiling
sudo dnf group install "Development Tools"
sudo dnf install ocl-icd-devel libXcomposite-devel libXinerama-devel libv4l-devel krb5-devel libudev-devel libXi-devel mingw32-gcc mingw64-gcc libusbx-devel glibc-devel vulkan-devel pulseaudio-libs-devel libXrender-devel  mesa-libGL-devel gcc libX11-devel freetype-devel zlib-devel libxcb-devel libxslt-devel libgcrypt-devel libxml2-devel gnutls-devel libpng-devel libjpeg-turbo-devel libtiff-devel dbus-devel fontconfig-devel libXcursor-devel libXxf86vm-devel libXrandr-devel SDL2-devel gstreamer1-devel gstreamer1-plugins-base-devel mesa-libOSMesa-devel ocl-icd-devel.i686 libXcomposite-devel.i686 libXinerama-devel.i686 libv4l-devel.i686 krb5-devel.i686 libXi-devel.i686 mingw32-gcc mingw64-gcc libusbx-devel.i686 glibc-devel.i686 pulseaudio-libs-devel.i686 libXrender-devel.i686  mesa-libGL-devel.i686 gcc libX11-devel.i686 freetype-devel.i686 zlib-devel.i686 libxcb-devel.i686 libxslt-devel.i686 libgcrypt-devel.i686 libxml2-devel.i686 gnutls-devel.i686 libpng-devel.i686 libjpeg-turbo-devel.i686 libtiff-devel.i686 dbus-devel.i686 fontconfig-devel.i686 libXcursor-devel.i686 libXxf86vm-devel.i686 libXrandr-devel.i686 SDL2-devel.i686 gstreamer1-devel.i686 gstreamer1-plugins-base-devel.i686 mesa-libOSMesa-devel.i686 libXext-devel.i686 libXfixes-devel.i686 gstreamer1-devel.i686 gstreamer1-plugins-base-devel.i686 wayland-devel.i686 vulkan-loader-devel vulkan-loader-devel.i686 systemd-devel systemd-devel.i686 libcom_err-devel.i686 libpcap-devel.i686 mesa-dri-drivers.i686

cd ~
wget https://dl.winehq.org/wine/source/8.x/wine-8.10.tar.xz
tar xvf wine-8.10.tar.xz
cd wine-8.10
mkdir build
mkdir build/wine32
mkdir build/wine64

# Build 64 bit version
cd build/wine64
../../configure CFLAGS="-march=native -O3 -pipe -fstack-protector-strong" --enable-win64
make -j16

# Build 32 bit version
cd ../wine32
PKG_CONFIG_PATH=/usr/lib/pkgconfig ../../configure CFLAGS="-march=native -O3 -pipe -fstack-protector-strong -I/usr/include/freetype2 -I/usr/lib/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/include/gstreamer-1.0" --with-wine64=../wine64
make -j16

# Install Both
sudo make -j16 install
cd ../wine64
sudo make -j16 install

# Set 32 bit Wine prefix in current shell and boot it up
WINEPREFIX="$HOME/.wine32" WINEARCH=win32 wine wineboot
# Save 32 bit prefix for future shells
echo 'export WINEPREFIX="$HOME/.wine32"' >> ~/.bashrc 
echo "Finished Setting up Wine!"

I was on the way to compile it too, but with a blocking error on freetype2.
I’ll try your recipe soon.

Don’t you think we should maintain a ‘wiki’ page on this subject ?

KR, Olivier