32 bit wine for CentOS 8

Since 32 bit wine is not available for CentOS 8, here’s a guide on how to do it yourself! I would host this as a copr repo but it doesn’t allow building 32 bit packages for EL8.

This guide has some hard-coded package versions, this guide should work for updated packages so long as you substitute in the correct package version.

This technique will also work on RHEL 8 and Oracle Linux 8, you just have to substitute in the appropriate repositories/package versions.
This guide will assume you’re running as root.

1: Setup

1.1: Install some development tools

dnf config-manager --set-enabled powertools
dnf install epel-release glibc-devel.i686 libstdc++.i686
dnf groupinstall "Development Tools" "RPM Development Tools"

1.2: Set up the build environment

rpmdev-setuptree
cd ~/rpmbuild/SRPMS

1.4: Download some source packages (The source for wine and other packages that don’t have 32 bit development libraries available)

dnf download --source wine vkd3d nss-mdns audiofile FAudio

NOTE: As of CentOS/RHEL 8.2, 32 bit spirv-tools packages are available in the official repositories.

2: Build 32 bit dependencies

2.1: vkd3d

Modification of this package is no longer required as of CentOS 8.5

This package needs a patch in order to build for 32 bit.
Extract the source package with:

rpm2cpio vkd3d-*.src.rpm | cpio -D ../SOURCES/ -idm
mv ../SOURCES/vkd3d.spec ../SPECS/vkd3d.spec

create the patch with:

cat >> ../SOURCES/vulkan-header-removed-constant.patch << EOF
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index df44447..53a081a 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -47,6 +47,8 @@
 
 #define VKD3D_MAX_SHADER_STAGES     5u
 
+#define VKD3D_PIPELINE_BIND_POINT_COUNT 2u
+
 struct d3d12_command_list;
 struct d3d12_device;
 
@@ -625,7 +627,7 @@ struct d3d12_command_list
     VkFramebuffer current_framebuffer;
     VkPipeline current_pipeline;
     VkRenderPass current_render_pass;
-    struct vkd3d_pipeline_bindings pipeline_bindings[VK_PIPELINE_BIND_POINT_RANGE_SIZE];
+    struct vkd3d_pipeline_bindings pipeline_bindings[VKD3D_PIPELINE_BIND_POINT_COUNT];
 
     struct d3d12_pipeline_state *state;
 
EOF

Add the patch to the package with:

cd ../SPECS
nano vkd3d.spec

Now, after the Source1: line (line 9), add:

Patch0:		vulkan-header-removed-constant.patch

After the %setup -q line (line 73), add:

%patch0 -p1

Then, press ctrl-x, y then enter to save the edit.

The new source package can be created with:

rpmbuild -bs vkd3d.spec
cd ../SRPMS

Now the package can be built with:

dnf install xcb-util-devel.i686 xcb-util-keysyms-devel.i686 xcb-util-wm-devel.i686 vulkan-loader-devel.i686 spirv-tools-devel.i686 spirv-tools-libs.i686 spirv-headers-devel
rpmbuild --rebuild --target i686 vkd3d-*.src.rpm

2.2: nss-mdns

dnf install check-devel.i686
rpmbuild --rebuild --target i686 nss-mdns-*.src.rpm

2.3: audiofile

dnf install flac-devel.i686 alsa-lib-devel.i686
rpmbuild --rebuild --target i686 audiofile-*.src.rpm

2.4: FAudio

dnf install cmake SDL2-devel.i686 gstreamer1-devel.i686 gstreamer1-plugins-base-devel.i686
rpmbuild --rebuild --target i686 FAudio-*.src.rpm
3: Modify the wine source RPM

3.1: Extract the source

rpm2cpio wine-*.src.rpm | cpio -D ../SOURCES/ -idm
mv ../SOURCES/wine.spec ../SPECS/wine.spec
cd ../SPECS

3.2: Patch the spec file

cat >> wine32.patch << EOF
--- a/wine.spec
+++ b/wine.spec
@@ -201,13 +201,13 @@
 
 # x86-32 parts
 %ifarch %{ix86} x86_64
-%if 0%{?fedora} || 0%{?rhel} <= 6
+%if 0%{?fedora} || 0%{?rhel} <= 8
 Requires:       wine-core(x86-32) = %{version}-%{release}
 Requires:       wine-cms(x86-32) = %{version}-%{release}
 Requires:       wine-ldap(x86-32) = %{version}-%{release}
 Requires:       wine-twain(x86-32) = %{version}-%{release}
 Requires:       wine-pulseaudio(x86-32) = %{version}-%{release}
-%if 0%{?fedora} >= 10 || 0%{?rhel} == 6
+%if 0%{?fedora} >= 10 || 0%{?rhel} >= 6
 Requires:       wine-openal(x86-32) = %{version}-%{release}
 %endif
 %if 0%{?fedora}
@@ -748,6 +748,7 @@
  --x-includes=%{_includedir} --x-libraries=%{_libdir} \\
  --without-hal --with-dbus \\
  --with-x \\
+ --without-opencl \\
 %ifarch %{arm}
  --with-float-abi=hard \\
 %endif
@@ -1979,7 +1980,7 @@
 %{_libdir}/wine/winehid.%{winesys}
 %{_libdir}/wine/winejoystick.drv.so
 %{_libdir}/wine/winemapi.%{winedll}
-%{_libdir}/wine/wineusb.sys.so
+#%{_libdir}/wine/wineusb.sys.so
 %{_libdir}/wine/winevulkan.dll.so
 %{_libdir}/wine/winex11.drv.so
 %{_libdir}/wine/wing32.%{winedll}
EOF

patch -Np1 -i wine32.patch

This patch removes restrictions on building 32 bit wine packages, enables building the wine-openal package for i686 and explicitly disables opencl which is not normally needed but may otherwise cause build failures if you have the Nvidia drivers installed which provide opencl development libraries.

3.3: Rebuild the wine source package

rpmbuild -bs wine.spec
cd ../SRPMS/
4: Build and install 32 bit wine

4.1: Deal with some troublesome packages

dnf remove cyrus-sasl-devel.x86_64 libxslt-devel.x86_64
dnf install cyrus-sasl-devel.i686 openldap-devel.i686

These packages have conflicts when installing both the 32 and 64 bit versions. These can safely be reinstalled later.

rm ../RPMS/i686/*debug* ../RPMS/i686/libvkd3d-utils*

We don’t need these packages.

4.2: Install build dependencies

dnf install openal-soft-devel.i686 libva-devel.i686 libattr-devel.i686 gtk3-devel.i686 vulkan-loader-devel.i686 libvkd3d-devel.i686 SDL2-devel.i686 mpg123-devel.i686 gstreamer1-plugins-base-devel.i686 gstreamer1-devel.i686 gettext-devel.i686 libtiff-devel.i686 libv4l-devel.i686 gsm-devel.i686 pulseaudio-libs-devel.i686 gnutls-devel.i686 dbus-devel.i686 libXcursor-devel.i686 libXi-devel.i686 libXmu-devel.i686 cups-devel.i686 giflib-devel.i686 fontconfig-devel.i686 libXcomposite-devel.i686 libXinerama-devel.i686 libXext-devel.i686 libXrandr-devel.i686 libXrender-devel.i686 libXxf86dga-devel.i686 libXxf86vm-devel.i686 mesa-libGL-devel.i686 mesa-libGLU-devel.i686 mesa-libOSMesa-devel.i686 libX11-devel.i686 libpcap-devel.i686 libgphoto2-devel.i686 fontforge.i686 freetype-devel.i686 zlib-devel.i686 systemd-devel.i686 sane-backends-devel.i686 unixODBC-devel.i686 openldap-devel.i686 ncurses-devel.i686 libxslt-devel.i686 libxml2-devel.i686 libusb-devel.i686 libstdc++-devel.i686 librsvg2-devel.i686 libpng-devel.i686 libjpeg-turbo-devel.i686 libieee1284-devel.i686 lcms2-devel.i686 freeglut-devel.i686 alsa-lib-devel.i686 chrpath fontpackages-devel icoutils mingw32-gcc mingw64-gcc ../RPMS/i686/libvkd3d-*.el8.i686.rpm ../RPMS/i686/*FAudio-*.el8.i686.rpm ../RPMS/i686/audiofile-*.el8.i686.rpm

4.3: Build wine

rpmbuild --rebuild --target i686 wine-*.el8.src.rpm

4.4: Install wine
Set a variable to the version of wine you are installing (6.0.2-1 as of Dec 2021). THIS WILL LIKELY BE DIFFERENT WHEN YOU DO IT!

ver=6.0.2-1
dnf install wine.x86_64 ../RPMS/i686/wine-${ver}.el8.i686.rpm ../RPMS/i686/wine-core-${ver}.el8.i686.rpm ../RPMS/i686/wine-ldap-${ver}.el8.i686.rpm ../RPMS/i686/wine-cms-${ver}.el8.i686.rpm ../RPMS/i686/wine-twain-${ver}.el8.i686.rpm ../RPMS/i686/wine-pulseaudio-${ver}.el8.i686.rpm ../RPMS/i686/wine-alsa-${ver}.el8.i686.rpm ../RPMS/i686/wine-openal-${ver}.el8.i686.rpm ../RPMS/i686/nss-mdns-*.el8.i686.rpm

If you wish to install these packages on another system, you will need to copy and install:

wine-6.0.2-1.el8.i686.rpm
wine-core-6.0.2-1.el8.i686.rpm
wine-ldap-6.0.2-1.el8.i686.rpm
wine-cms-6.0.2-1.el8.i686.rpm
wine-twain-6.0.2-1.el8.i686.rpm
wine-pulseaudio-6.0.2-1.el8.i686.rpm
wine-alsa-6.0.2-1.el8.i686.rpm
wine-openal-6.0.2-1.el8.i686.rpm
audiofile-0.3.6-23.el8.i686.rpm
libFAudio-21.11-1.el8.i686.rpm
nss-mdns-0.14.1-9.el8.i686.rpm
libvkd3d-1.2-3.el8.i686.rpm

Have fun running your 32 bit Windows software!

3 Likes

This is awesome. I just finished the build with these instructions and 32-bit applications are now working fine with Wine!
I signed up to say thanks :slight_smile:

2 Likes

Same here, I am a big fan of your work actually ! Between Mate and Budgie, thanks man !

Tanguy

1 Like

Wow! Nice to know I have a fan :slight_smile:

Update! I am now hosting an rpm repository with these packages. Check out the original post for details.

The FTP server is down for now. Apparently got a bad batch of hard drives.

Just wanted to say how grateful I am for this post. I’ve been struggling for a while with wine on AlmaLinux8, even patched the source code before building from sources to fix some issues but each time I solved an issue a new issue popped it was a nightmare.

I can say as of february 2023 on AlmaLinux 8.7 the operations described above still perfectly works. It’s actually intelligent and cautious to rebuild rpms after having installed the 32-bit dependencies instead of going forward to unsupported versions and I learnt a great deal about rpm building by understanding what the commands actually do. You saved the day for a lot of us I guess. Thanks!

1 Like

@stenstorp I am newbie, so I might be here with a simple error or question that I cannot resolve without help. Whenever I run step 4.2 on RHEL 8 I am getting the following error:-

I have tried manually installing it but I cannot find this specific RPM. This is from a third party right ?. Also to sum up the whole question, what am i doing wrong ?.

@stenstorp I don’t know if there is a rpm named:- bvkd3d-*.el8.i686.rpm but I did install again using instructions as I had to stop in between (guess I missed a step and it works perfectly now). Thank you so much mate you are a life saver.