Compile Wine in Container (Distrobox)
Zhenbo Li September 06, 2025Preface
A usable Wine build needs shared WoW64, and to compile it, multi-lib dependencies are required
As a Fedora Silverblue user, the conflict between i686
and x86_64
libs happens very frequently, and rpm-ostree install
will be blocked for weeks. As suggested by Wine Wiki, I'm trying to compile wine within Distrobox
Create Distrobox Image
# Fedora 42: distrobox: 1.8.1.2
By default, distrobox shows a lovely emoji 📦
Install Dependency
# Some packages are coved by builddep, but somes are not. There are overlaps, definitely
Build Wine 64
According to Wine Wiki, I need to build the 64-bit version first.
# make install as non-root later
&&
PKG_CONFIG_PATH=/usr/lib64/pkgconfig \
CFLAGS="-Og" CROSSCFLAGS="-Og" CC="sccache gcc" \
i386_CC="sccache i686-w64-mingw32-gcc" x86_64_CC="sccache x86_64-w64-mingw32-gcc" \
# Just taking one second to show off my 16-core CPU and 64 GB of RAM
Outside the container, I can use wine64 directly. However, almost no Windows binaries can be executed by this 64-bit only wine.
Build Wine 32
&&
PKG_CONFIG_PATH=/usr/lib/pkgconfig \
CFLAGS="-Og" CROSSCFLAGS="-Og" CC="sccache gcc -m32" \
# Configuration
It worked well
Install Wine
According to Wine Wiki, I should install 32-bit first.
Quicknote about LSP
Some of Wine's header files are generated by Wine IDL, so I need to compile Wine once under the source code directory.
PKG_CONFIG_PATH=/usr/lib64/pkgconfig \
CFLAGS="-Og" CROSSCFLAGS="-Og" CC="sccache gcc" \
i386_CC="sccache i686-w64-mingw32-gcc" x86_64_CC="sccache x86_64-w64-mingw32-gcc" \
Bartek Kryza has a great article about compile_commands.json