setup.sh: check for 32-bit glibc and FreeType before making the prefix (black band, #268) #515

Open
opened 2026-12-04 20:49:31 +00:00 by github-bot · 1 comment
Owner

@⁠El-Biiscuit on GitHub · 2026-12-04 20:46 UTC · original

Problem

setup.sh makes the Wine prefix without checking for the 32-bit libraries that wineboot needs.

  • Without the 32-bit C library, wineboot stops at /lib/ld-linux.so.2: could not open.
  • Without 32-bit FreeType it gets further, which is worse: it writes window metrics such as CaptionHeight=5434094 into the prefix. The game then shows a black horizontal band instead of a picture (#268), with no error anywhere. The bad values stay in the prefix after the package is installed, so installing it afterwards does not fix anything until the prefix is made again.

This happened to me on Fedora (RX 6700 XT) and in #268. The 32-bit packages also came up in #292. step_tools checks about 25 tools and the Mesa libraries, but nothing 32-bit.

Suggested check

In step_tools, only when the prefix step is asked for and the prefix does not exist yet, look for a 32-bit libc.so.6 and libfreetype.so.6 in /usr/lib, /usr/lib32 and /usr/lib/i386-linux-gnu. A file only counts if its ELF class byte says 32-bit, because /usr/lib holds 64-bit libraries on Arch. When something is missing, it prints install first in the same form as the Mesa check, with the package names, and exits:

install first, before the prefix is made: 32-bit glibc 32-bit FreeType
  Fedora/Nobara:   glibc.i686 freetype.i686
  Debian/Ubuntu:   libc6:i386 libfreetype6:i386 (after dpkg --add-architecture i386)
  Arch/CachyOS:    lib32-glibc lib32-freetype2 (multilib)

Hosts that already have a prefix are not affected.

Tested

The check was taken out of setup.sh and run with prefix asked for and no prefix:

host result
Fedora 45 with glibc.i686 and freetype.i686 (the machine I play on) passes
Fedora 43 container, bare stops: 32-bit glibc, 32-bit FreeType
Fedora 43 + glibc.i686 stops: 32-bit FreeType
Fedora 43 + glibc.i686 freetype.i686 passes
Debian trixie + 64-bit libfreetype6 only stops: both
Debian trixie + libc6:i386 libfreetype6:i386 passes
Arch + 64-bit freetype2 only stops: both
Arch + lib32-glibc lib32-freetype2 (multilib) passes

Steps without prefix, and an existing prefix: the check is skipped. Not run: a full setup.sh from scratch with the change, Ubuntu, CachyOS, Nobara.

I can open this as a PR if you want it.

The change, against b581f7e (+25 −1 in setup.sh)
diff --git a/setup.sh b/setup.sh
index b96d6f6..44aba34 100755
--- a/setup.sh
+++ b/setup.sh
@@ -77,8 +77,18 @@ source_of() {
   echo "$stamp" > "$dir/.git/um-stamp"
 }
 
+# A 32-bit library in one of the usual 32-bit library dirs (byte 4 of an ELF
+# header is its class, 01 for 32-bit: /usr/lib holds 64-bit ones on Arch).
+has_lib32() {
+  local f
+  for f in "/usr/lib/$1" "/usr/lib32/$1" "/usr/lib/i386-linux-gnu/$1"; do
+    if [ "$(od -An -tx1 -j4 -N1 "$f" 2>/dev/null)" = " 01" ]; then return 0; fi
+  done
+  return 1
+}
+
 step_tools() {
-  local missing=() pc=() need_mesa_deps=0 step rustup_init=0
+  local missing=() pc=() lib32=() need_mesa_deps=0 step rustup_init=0
   if ! command -v rustup >/dev/null; then
     if command -v rustup-init >/dev/null; then
       rustup_init=1
@@ -116,6 +126,20 @@ step_tools() {
       exit 1
     fi
   fi
+  # wineboot stops at /lib/ld-linux.so.2 without the 32-bit C library, and
+  # without 32-bit FreeType it writes window metrics (CaptionHeight=5434094)
+  # that leave a black band instead of the game; the prefix keeps them.
+  if [[ " $* " == *" prefix "* ]] && [ ! -f "$WINEPREFIX/system.reg" ]; then
+    has_lib32 libc.so.6 || lib32+=("32-bit glibc")
+    has_lib32 libfreetype.so.6 || lib32+=("32-bit FreeType")
+    if (( ${#lib32[@]} )); then
+      echo "install first, before the prefix is made: ${lib32[*]}"
+      echo "  Fedora/Nobara:   glibc.i686 freetype.i686"
+      echo "  Debian/Ubuntu:   libc6:i386 libfreetype6:i386 (after dpkg --add-architecture i386)"
+      echo "  Arch/CachyOS:    lib32-glibc lib32-freetype2 (multilib)"
+      exit 1
+    fi
+  fi
   if ! "$deps/venv/bin/meson" --version >/dev/null 2>&1; then
     python3 -m venv --clear "$deps/venv"
     "$deps/venv/bin/pip" install -q --disable-pip-version-check meson mako pyyaml packaging
**@⁠El-Biiscuit** on GitHub · 2026-12-04 20:46 UTC · [original](https://github.com/lobomfz/VIctory-xmem/issues/515) ## Problem `setup.sh` makes the Wine prefix without checking for the 32-bit libraries that `wineboot` needs. - **Without the 32-bit C library**, `wineboot` stops at `/lib/ld-linux.so.2: could not open`. - **Without 32-bit FreeType** it gets further, which is worse: it writes window metrics such as `CaptionHeight=5434094` into the prefix. The game then shows a black horizontal band instead of a picture (#268), with no error anywhere. The bad values stay in the prefix after the package is installed, so installing it afterwards does not fix anything until the prefix is made again. This happened to me on Fedora (RX 6700 XT) and in #268. The 32-bit packages also came up in #292. `step_tools` checks about 25 tools and the Mesa libraries, but nothing 32-bit. ## Suggested check In `step_tools`, only when the `prefix` step is asked for and the prefix does not exist yet, look for a 32-bit `libc.so.6` and `libfreetype.so.6` in `/usr/lib`, `/usr/lib32` and `/usr/lib/i386-linux-gnu`. A file only counts if its ELF class byte says 32-bit, because `/usr/lib` holds 64-bit libraries on Arch. When something is missing, it prints `install first` in the same form as the Mesa check, with the package names, and exits: ``` install first, before the prefix is made: 32-bit glibc 32-bit FreeType Fedora/Nobara: glibc.i686 freetype.i686 Debian/Ubuntu: libc6:i386 libfreetype6:i386 (after dpkg --add-architecture i386) Arch/CachyOS: lib32-glibc lib32-freetype2 (multilib) ``` Hosts that already have a prefix are not affected. ## Tested The check was taken out of `setup.sh` and run with `prefix` asked for and no prefix: | host | result | |---|---| | Fedora 45 with glibc.i686 and freetype.i686 (the machine I play on) | passes | | Fedora 43 container, bare | stops: 32-bit glibc, 32-bit FreeType | | Fedora 43 + glibc.i686 | stops: 32-bit FreeType | | Fedora 43 + glibc.i686 freetype.i686 | passes | | Debian trixie + 64-bit libfreetype6 only | stops: both | | Debian trixie + libc6:i386 libfreetype6:i386 | passes | | Arch + 64-bit freetype2 only | stops: both | | Arch + lib32-glibc lib32-freetype2 (multilib) | passes | Steps without `prefix`, and an existing prefix: the check is skipped. Not run: a full `setup.sh` from scratch with the change, Ubuntu, CachyOS, Nobara. I can open this as a PR if you want it. <details><summary>The change, against <code>b581f7e</code> (+25 −1 in setup.sh)</summary> ```diff diff --git a/setup.sh b/setup.sh index b96d6f6..44aba34 100755 --- a/setup.sh +++ b/setup.sh @@ -77,8 +77,18 @@ source_of() { echo "$stamp" > "$dir/.git/um-stamp" } +# A 32-bit library in one of the usual 32-bit library dirs (byte 4 of an ELF +# header is its class, 01 for 32-bit: /usr/lib holds 64-bit ones on Arch). +has_lib32() { + local f + for f in "/usr/lib/$1" "/usr/lib32/$1" "/usr/lib/i386-linux-gnu/$1"; do + if [ "$(od -An -tx1 -j4 -N1 "$f" 2>/dev/null)" = " 01" ]; then return 0; fi + done + return 1 +} + step_tools() { - local missing=() pc=() need_mesa_deps=0 step rustup_init=0 + local missing=() pc=() lib32=() need_mesa_deps=0 step rustup_init=0 if ! command -v rustup >/dev/null; then if command -v rustup-init >/dev/null; then rustup_init=1 @@ -116,6 +126,20 @@ step_tools() { exit 1 fi fi + # wineboot stops at /lib/ld-linux.so.2 without the 32-bit C library, and + # without 32-bit FreeType it writes window metrics (CaptionHeight=5434094) + # that leave a black band instead of the game; the prefix keeps them. + if [[ " $* " == *" prefix "* ]] && [ ! -f "$WINEPREFIX/system.reg" ]; then + has_lib32 libc.so.6 || lib32+=("32-bit glibc") + has_lib32 libfreetype.so.6 || lib32+=("32-bit FreeType") + if (( ${#lib32[@]} )); then + echo "install first, before the prefix is made: ${lib32[*]}" + echo " Fedora/Nobara: glibc.i686 freetype.i686" + echo " Debian/Ubuntu: libc6:i386 libfreetype6:i386 (after dpkg --add-architecture i386)" + echo " Arch/CachyOS: lib32-glibc lib32-freetype2 (multilib)" + exit 1 + fi + fi if ! "$deps/venv/bin/meson" --version >/dev/null 2>&1; then python3 -m venv --clear "$deps/venv" "$deps/venv/bin/pip" install -q --disable-pip-version-check meson mako pyyaml packaging ``` </details>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 20:49:31 +00:00
Author
Owner

@⁠tommiehansen on GitHub · 2026-12-05 20:07 UTC · original

This looks useful, especially given the prefix issue in #268. Would be great if you opened the PR with those tests and accounted for newer WoW64 setups that don't require 32-bit host libraries. :)

**@⁠tommiehansen** on GitHub · 2026-12-05 20:07 UTC · [original](https://github.com/lobomfz/VIctory-xmem/issues/515#issuecomment-7444554475) This looks useful, especially given the prefix issue in #268. Would be great if you opened the PR with those tests and accounted for newer WoW64 setups that don't require 32-bit host libraries. :)
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/lobomfz--VIctory-xmem#515
No description provided.