ERROR: Dependency "libdrm" not found (tried pkg-config and cmake) - at setup.sh #70

Closed
opened 2026-12-01 14:13:08 +00:00 by github-bot · 0 comments
Owner

@⁠Finalizator on GitHub · 2026-12-01 14:12 UTC · original

./setup.sh fails: Dependency "libdrm" not found while configuring Mesa

Summary

On a system where the Mesa runtime libraries are installed but their
development packages are not, ./setup.sh stops in the Mesa configure step:

Message: libdrm 2.4.133 needed because amdgpu has the highest requirement
Found pkg-config: YES (/usr/bin/pkg-config) 2.5.1
Found CMake: /usr/bin/cmake (4.3.0)
Run-time dependency libdrm found: NO  (tried pkg-config and cmake)

deps/mesa/meson.build:804:15: ERROR: Dependency "libdrm" not found (tried pkg-config and cmake)

Nothing gets compiled; the build dies at dependency resolution, so the error
looks like a broken checkout rather than a missing system package.

Environment

Distro Nobara 44 (Fedora 44 base)
Compiler gcc 16.2.1
Meson 1.12.1 (the venv setup.sh creates)
Mesa 26.3.1 (mesa-26.3.1)
GPU AMD Radeon RX 7900 XT (RADV NAVI31)

Runtime library present, headers missing:

$ ls /usr/lib64/libdrm*
/usr/lib64/libdrm.so.2 -> libdrm.so.2.134.0
/usr/lib64/libdrm_amdgpu.so.1 -> libdrm_amdgpu.so.1.134.0
...
$ pkg-config --modversion libdrm
Package 'libdrm' was not found in the pkg-config search path
$ ls /usr/include/libdrm
ls: cannot access '/usr/include/libdrm': No such file or directory

Steps to reproduce

  1. Fresh Fedora/Nobara install with the tools setup.sh checks for
    (clang-cl, lld-link, llvm-lib, x86_64-w64-mingw32-gcc, widl,
    flex, bison, glslangValidator, ...) but without libdrm-devel.
  2. ./setup.sh
  3. The SDK and DLL steps finish, then step_mesa aborts as shown above.

Root cause

setup.sh builds RADV with

-Dvulkan-drivers=amd -Dgallium-drivers= -Dplatforms=x11,wayland

That configuration pulls in three families of build-time dependencies that
step_tools never looked at, because it only checks for executables
(command -v ...):

  1. libdrm – RADV talks to the kernel amdgpu driver through
    libdrm_amdgpu, and Mesa requires libdrm >= 2.4.133 for amdgpu
    (meson.build:776-804). Distros ship libdrm.so.2 for the runtime Mesa
    package, but the headers and libdrm.pc live in a separate -devel/-dev
    package. pkg-config therefore reports the module as missing even though the
    library is installed – hence Dependency "libdrm" not found.

  2. X11/XCB – the x11 Vulkan platform needs xcb, xcb-randr,
    xcb-dri3, xcb-present, xcb-shm, xcb-sync, xcb-xfixes, x11-xcb
    and xshmfence (meson.build:2318-2376).

  3. Wayland – the wayland platform needs wayland-client,
    wayland-server and wayland-protocols >= 1.49
    (meson.build:2253-2256). On top of that, xlib-lease defaults to enabled
    on X11 + KMS and needs xrandr, which is the second dependency failure a
    user hits after fixing libdrm:

    deps/mesa/meson.build:2376:22: ERROR: Dependency "xrandr" not found
    

This is not a Mesa bug: meson setup reports the missing module correctly.
Mesa's libdrm.wrap could supply libdrm via
-Dallow-fallback-for=libdrm, but no wrap exists for the X11/Wayland client
libraries, so the development packages are genuinely required. The bug is that
the setup script promises to "name any tool it misses" and then fails deep
inside Mesa instead.

Fix

setup.sh now preflights the pkg-config modules Mesa needs whenever the mesa
step is part of the run, and prints the package names per distro family:

install first: libdrm >= 2.4.133 libdrm_amdgpu >= 2.4.133 xcb ...
  Fedora/Nobara:   libdrm-devel libxcb-devel libX11-devel libXrandr-devel libxshmfence-devel wayland-devel wayland-protocols-devel
  Debian/Ubuntu:   libdrm-dev libxcb1-dev libx11-dev libx11-xcb-dev libxrandr-dev libxshmfence-dev libwayland-dev wayland-protocols
  Arch:            libdrm libxcb libx11 libxrandr libxshmfence wayland wayland-protocols

Details:

  • step_tools gained a pkg-config --exists "<module> >= <version>" loop over
    the modules above, using the same minimum versions Mesa asks for. The check
    only runs when mesa is in the requested steps, so ./setup.sh prefix still
    works on machines without X11/Wayland headers.
  • pkg-config itself was added to the executable checks, so it is reported as
    a missing tool instead of producing empty dependency results.

For anyone hitting this right now, the immediate workaround is:

# Fedora / Nobara
sudo dnf install libdrm-devel libxcb-devel libX11-devel libXrandr-devel \
                 libxshmfence-devel wayland-devel wayland-protocols-devel

after which ./setup.sh mesa completes and installs
deps/mesa-inst/lib64/libvulkan_radeon.so plus
deps/mesa-inst/share/vulkan/icd.d/radeon_icd.x86_64.json.

Verification

$ ./setup.sh mesa
building mesa
$ VK_DRIVER_FILES=$PWD/deps/mesa-inst/share/vulkan/icd.d/radeon_icd.x86_64.json vulkaninfo --summary
Devices:
========
GPU0:
	driverVersion      = 26.3.1
	deviceName         = AMD Radeon RX 7900 XT (RADV NAVI31)
	driverName         = radv
	driverInfo         = Mesa 26.3.1 (git-fec8830e9c)

Another missing-dependency failure on the same path: x86_64-w64-mingw32-g++

With Mesa configured, the next step fails the same way, one layer later:

deps/vkd3d/meson.build:2:0: ERROR: Unknown compiler(s): [['x86_64-w64-mingw32-g++']]

step_tools checked for x86_64-w64-mingw32-gcc but not the C++ companion that
vkd3d-proton's cross file uses, so a machine with only mingw64-gcc installed
(C, no C++) got a Mesa-style meson error instead of "install first:
x86_64-w64-mingw32-g++" (mingw64-gcc-c++ on Fedora/Nobara,
g++-mingw-w64-x86-64 on Debian/Ubuntu, an AUR/mingw-w64-gcc package on Arch).
It is now part of the executable checks.

Unrelated bug hit afterwards: deps/venv breaks when the checkout moves

This one has nothing to do with the libdrm failure above; it only appeared when
setup.sh was re-run after the checkout folder had been renamed. Renaming or
moving the repository after a first setup.sh run makes every later run die
with

./setup.sh: .../deps/venv/bin/meson: .../deps/venv/bin/python3: bad interpreter: No such file or directory

Python venvs are not relocatable: deps/venv/bin/meson has an absolute
#! line pointing at the old path, while deps/venv/bin/python3 is a symlink
and still resolves. The old check only did
"$deps/venv/bin/python3" -c "import mesonbuild, ...", which succeeds, so the
venv was never rebuilt.

step_tools now tests "$deps/venv/bin/meson" --version instead and recreates
the venv with python3 -m venv --clear when it cannot run, which covers both a
missing module and a stale interpreter path.

My setup.sh file here:

`#!/bin/bash
set -euo pipefail
source "$(dirname "$(readlink -f "$0")")/env.sh"
deps=$root/deps
sys=$WINEPREFIX/drive_c/windows/system32

MESA=(https://gitlab.freedesktop.org/mesa/mesa.git mesa-26.3.1)
VKD3D=(https://github.com/HansKristian-Work/vkd3d-proton 71cae091b06571e51446cf2a937f0b04c237c04d)
WINE=(https://gitlab.winehq.org/wine/wine.git)
XWIN=(https://github.com/Jake-Shadle/xwin/releases/download/0.10.0/xwin-0.10.0-x86_64-unknown-linux-musl.tar.gz d870eb4b2f390878af6da1ccd3cf321d22fcb72720984853b4be732ae597fc88)
DXC=(https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.9.2609/dxc_2026_09_29.zip ad31b1fc8443175d204f77a611fdb3ef2ec42759bdc2f1167368de24a4a7e7f1)
DXVK=(https://github.com/doitsujin/dxvk/releases/download/v3.1.1/dxvk-3.1.1.tar.gz 40565b4a724aadc4433fa4e010b4b23916d9b1f1baeee64e17186db94f54e608)
D3DCOMPILER=(https://raw.githubusercontent.com/mozilla/fxc2/9aba9b11079303d5577e0e3eb455f4d00f3b5946/dll/d3dcompiler_47.dll 4432bbd1a390874f3f0a503d45cc48d346abc3a8c0213c289f4b615bf0ee84f3)
FSR4=(https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK/v2.4.0/Kits/FidelityFX/signedbin/amd_fidelityfx_upscaler_dx12.dll aad4fccccb29084a655f9a4f9f613bd22c8c03fb4a0f8840148cc6543b4ccace)
FSR4_DRIVER=(https://loathingKernel.github.io/proton-upscalers/amdxcffx64_v4.1.1_398EA93C15D554EFB7ECE1F4CD057554.xz 4e7dc37aebea3a90e3d3cc43e24cb2b54176b2535315f20dbe63b3b7cfc56b1e)

logged() {
local log=$deps/$1.log
shift
if ! "$@" >>"$log" 2>&1; then
tail -n 30 "$log"
exit 1
fi
}

fetch() {
local url=$1 sum=$2 to=$3
if [ -f "$to" ] && echo "$sum $to" | sha256sum -c --status; then return; fi
mkdir -p "$(dirname "$to")"
echo "fetching $(basename "$to")"
curl -fL --retry 3 -sS -o "$to.part" "$url"
if ! echo "$sum $to.part" | sha256sum -c --status; then echo "$url is not the file expected"; exit 1; fi
mv "$to.part" "$to"
}

source_of() {
local name=$1 url=$2 ref=$3 dir=$deps/$1 patch=$root/patches/$1.patch sub
local subs=()
for sub in "$root/patches/$name".*.patch; do
if [ -f "$sub" ]; then subs+=("$sub"); fi
done
local stamp="$ref $(cat "$patch" ${subs[@]+"${subs[@]}"} | sha256sum)"
if [ ! -d "$dir/.git" ]; then
git init -q "$dir"
fi

if git -C "$dir" remote get-url origin >/dev/null 2>&1; then
git -C "$dir" remote set-url origin "$url"
else
git -C "$dir" remote add origin "$url"
fi
if [ "$(cat "$dir/.git/um-stamp" 2>/dev/null)" = "$stamp" ]; then return; fi
if [ -f "$dir/.git/um-patch" ] && [ "$(patched "$dir" | sha256sum)" != "$(sha256sum < "$dir/.git/um-patch")" ]; then
echo "deps/$name has changes the patch does not: keep them with tools/patch.sh $name"
exit 1
fi
echo "fetching $name $ref"
git -C "$dir" fetch -q --depth 1 origin "$ref"
git -C "$dir" submodule -q foreach --recursive 'git reset -q --hard'
git -C "$dir" reset -q --hard
git -C "$dir" checkout -q --detach FETCH_HEAD
git -C "$dir" submodule update -q --init --recursive --depth 1
git -C "$dir" apply --index "$patch"
for sub in ${subs[@]+"${subs[@]}"}; do
git -C "$dir/$(submodule_of "$dir" "$sub")" apply --index "$sub"
done
patched "$dir" > "$dir/.git/um-patch"
echo "$stamp" > "$dir/.git/um-stamp"
}

step_tools() {
local missing=() pc=() step need_mesa_deps=0
for t in git curl unzip tar xz python3 pkg-config ninja glslangValidator clang-cl lld-link llvm-lib x86_64-w64-mingw32-gcc x86_64-w64-mingw32-g++ x86_64-w64-mingw32-strip widl cargo rustup make flex bison systemd-run unshare; do
command -v "$t" >/dev/null || missing+=("$t")
done
if [ -z "${PROTON_DIR:-}" ]; then
command -v wine >/dev/null || missing+=(wine)
fi
if (( ${#missing[@]} )); then echo "install first: ${missing[]}"; exit 1; fi
for step in "$@"; do
if [ "$step" = mesa ]; then need_mesa_deps=1; fi
done
if (( need_mesa_deps )); then
for p in "libdrm >= 2.4.133" "libdrm_amdgpu >= 2.4.133" xcb xcb-randr x11-xcb
"xcb-dri3 >= 1.13" "xcb-present >= 1.13" xcb-shm xcb-sync "xshmfence >= 1.1" xcb-xfixes
"xrandr >= 1.3" "wayland-client >= 1.18" "wayland-server >= 1.18"
"wayland-protocols >= 1.49"; do
pkg-config --exists "$p" 2>/dev/null || pc+=("$p")
done
if (( ${#pc[@]} )); then
echo "install first: ${pc[
]}"
echo " Fedora/Nobara: libdrm-devel libxcb-devel libX11-devel libXrandr-devel libxshmfence-devel wayland-devel wayland-protocols-devel"
echo " Debian/Ubuntu: libdrm-dev libxcb1-dev libx11-dev libx11-xcb-dev libxrandr-dev libxshmfence-dev libwayland-dev wayland-protocols"
echo " Arch: libdrm libxcb libx11 libxrandr libxshmfence wayland wayland-protocols"
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
fi
}

step_sdk() {
if [ -d "$deps/msvc/VC" ]; then return; fi
fetch "${XWIN[@]}" "$deps/xwin.tar.gz"
tar -xzf "$deps/xwin.tar.gz" -C "$deps" --strip-components 1 --wildcards '*/xwin'
echo "fetching the windows sdk"
"$deps/xwin" --cache-dir "$deps/xwin-cache" splat --use-winsysroot-style --preserve-ms-arch-notation --output "$deps/msvc"
rm -rf "$deps/xwin-cache" "$deps/xwin.tar.gz" "$deps/xwin"
}

step_dlls() {
if [ ! -f "$deps/dxc/dxil.dll" ]; then
fetch "${DXC[@]}" "$deps/dxc.zip"
unzip -q -o -j "$deps/dxc.zip" 'bin?x64?dxcompiler.dll' 'bin?x64?dxil.dll' -d "$deps/dxc" 2>/dev/null || [ -f "$deps/dxc/dxil.dll" ]
rm "$deps/dxc.zip"
fi
if [ ! -f "$deps/dxgi.dll" ]; then
fetch "${DXVK[@]}" "$deps/dxvk.tar.gz"
tar -xzf "$deps/dxvk.tar.gz" -C "$deps" --strip-components 2 --wildcards '*/x64/dxgi.dll'
rm "$deps/dxvk.tar.gz"
fi
fetch "${D3DCOMPILER[@]}" "$deps/d3dcompiler_47.dll"
}

step_mesa() {
source_of mesa "${MESA[@]}"
local b=$deps/mesa/build
if [ ! -f "$b/build.ninja" ]; then
logged mesa meson setup "$b" "$deps/mesa" --prefix "$deps/mesa-inst" --buildtype release -Db_ndebug=true
-Dvulkan-drivers=amd -Dgallium-drivers= -Dplatforms=x11,wayland -Dllvm=disabled
-Dgles1=disabled -Dgles2=disabled -Dopengl=false -Dgbm=disabled -Dglx=disabled -Degl=disabled
-Dvideo-codecs= -Dvulkan-layers= -Dtools=
fi
echo "building mesa"
logged mesa meson install -C "$b"
}

step_vkd3d() {
source_of vkd3d "${VKD3D[@]}"
local b=$deps/vkd3d/build
if [ ! -f "$b/build.ninja" ]; then
logged vkd3d meson setup "$b" "$deps/vkd3d" --cross-file "$deps/vkd3d/build-win64.txt" --buildtype release
-Denable_tests=false -Denable_extras=false
fi
echo "building vkd3d"
logged vkd3d meson compile -C "$b"
}

step_wine() {
if [ -n "${PROTON_DIR:-}" ]; then
echo "using Proton (${PROTON_DIR}); skipping vanilla wineserver patch build"
return
fi
local ver dir=$deps/wine patch=$root/patches/wine.patch b=$deps/wineserver
ver=$("$WINE_BIN" --version)
local ref="${ver%% *}"
if [ ! -d "$dir/.git" ]; then
git init -q "$dir"
git -C "$dir" remote add origin "${WINE[0]}"
fi
local stamp="$ref $(sha256sum < "$patch")"
if [ "$(cat "$dir/.git/um-stamp" 2>/dev/null)" != "$stamp" ]; then
echo "fetching wine $ref"
git -C "$dir" fetch -q --depth 1 origin "$ref" || { echo "note: could not fetch tag $ref; using system wineserver"; return; }
git -C "$dir" reset -q --hard
git -C "$dir" checkout -q --detach FETCH_HEAD
if ! git -C "$dir" apply --index "$patch" 2>/dev/null; then
echo "note: patches/wine.patch does not apply to $ref (newer Wine 11.x already refactored mapped views); using system wineserver"
git -C "$dir" reset -q --hard
rm -rf "$b"
return
fi
git -C "$dir" diff HEAD > "$dir/.git/um-patch"
echo "$stamp" > "$dir/.git/um-stamp"
fi
if [ "$(cat "$b/version" 2>/dev/null)" != "$ver" ]; then rm -rf "$b"; fi
mkdir -p "$b"
if [ ! -f "$b/Makefile" ]; then
(cd "$b" && logged wineserver "$deps/wine/configure" --enable-win64 --without-x --without-wayland --without-freetype --without-vulkan --disable-tests)
fi
echo "building wineserver"
logged wineserver make -C "$b" -j"$(nproc)" server/wineserver
echo "$ver" > "$b/version"
}

step_prefix() {
if [ ! -f "$WINEPREFIX/system.reg" ]; then
echo "creating the prefix (runtime: ${PROTON_DIR:-$WINE_BIN})"
mkdir -p "$state"
WINEDLLOVERRIDES='mscoree,mshtml=d;winemenubuilder.exe=d' WINESERVER="$WINESERVER_BIN" "$WINE_BIN" wineboot -u
"$WINESERVER_BIN" -w
fi
mkdir -p "$sys"
x86_64-w64-mingw32-strip -o "$sys/d3d12.dll" "$deps/vkd3d/build/libs/d3d12/d3d12.dll"
x86_64-w64-mingw32-strip -o "$sys/d3d12core.dll" "$deps/vkd3d/build/libs/d3d12core/d3d12core.dll"
install -m 644 "$deps/dxgi.dll" "$deps/d3dcompiler_47.dll" "$sys/"
if [ -d "$deps/fsr4/system32" ]; then install -m 644 "$deps/fsr4/system32"/*.dll "$sys/"; fi
}

step_victory() {
echo "building victory"
"$root/build.sh"
}

step_fsr4() {
local bridge=${PROTON:+$PROTON/files/lib/wine/x86_64-windows/amdxc64.dll}
local proton
for proton in "$HOME/.local/share/Steam/steamapps/common/Proton - Experimental" "$HOME"/.local/share/Steam/steamapps/common/Proton*; do
if [ -n "$bridge" ]; then break; fi
if [ -f "$proton/files/lib/wine/x86_64-windows/amdxc64.dll" ]; then bridge=$proton/files/lib/wine/x86_64-windows/amdxc64.dll; fi
done
if [ ! -f "$bridge" ]; then echo "amdxc64.dll comes from proton: point at one with PROTON=/path/to/proton"; exit 1; fi
fetch "${FSR4[@]}" "$deps/fsr4/amd_fidelityfx_upscaler_dx12.dll"
if ! echo "${FSR4_DRIVER[1]} $deps/fsr4/system32/amdxcffx64.dll" | sha256sum -c --status 2>/dev/null; then
mkdir -p "$deps/fsr4/system32"
echo "fetching amdxcffx64.dll"
curl -fL --retry 3 -sS "${FSR4_DRIVER[0]}" | xz -d > "$deps/fsr4/system32/amdxcffx64.dll.part"
if ! echo "${FSR4_DRIVER[1]} $deps/fsr4/system32/amdxcffx64.dll.part" | sha256sum -c --status; then echo "${FSR4_DRIVER[0]} is not the file expected"; exit 1; fi
mv "$deps/fsr4/system32/amdxcffx64.dll.part" "$deps/fsr4/system32/amdxcffx64.dll"
fi
install -m 644 "$bridge" "$deps/fsr4/system32/amdxc64.dll"
if [ -d "$sys" ]; then install -m 644 "$deps/fsr4/system32"/*.dll "$sys/"; fi
}

mkdir -p "$deps"
export PATH=$deps/venv/bin:$PATH
if (( $# == 0 )); then set -- sdk dlls mesa vkd3d wine prefix victory; fi
step_tools "$@"
for step in "$@"; do
case "$step" in
sdk|dlls|mesa|vkd3d|wine|prefix|victory|fsr4) "step_$step";;
*) echo "usage: setup.sh [sdk|dlls|mesa|vkd3d|wine|prefix|victory|fsr4]..."; exit 1;;
esac
done
`

**@⁠Finalizator** on GitHub · 2026-12-01 14:12 UTC · [original](https://github.com/lobomfz/VIctory-xmem/issues/70) # `./setup.sh` fails: `Dependency "libdrm" not found` while configuring Mesa ## Summary On a system where the Mesa runtime libraries are installed but their **development** packages are not, `./setup.sh` stops in the Mesa configure step: ``` Message: libdrm 2.4.133 needed because amdgpu has the highest requirement Found pkg-config: YES (/usr/bin/pkg-config) 2.5.1 Found CMake: /usr/bin/cmake (4.3.0) Run-time dependency libdrm found: NO (tried pkg-config and cmake) deps/mesa/meson.build:804:15: ERROR: Dependency "libdrm" not found (tried pkg-config and cmake) ``` Nothing gets compiled; the build dies at dependency resolution, so the error looks like a broken checkout rather than a missing system package. ## Environment | | | |---|---| | Distro | Nobara 44 (Fedora 44 base) | | Compiler | gcc 16.2.1 | | Meson | 1.12.1 (the venv `setup.sh` creates) | | Mesa | 26.3.1 (`mesa-26.3.1`) | | GPU | AMD Radeon RX 7900 XT (RADV NAVI31) | Runtime library present, headers missing: ``` $ ls /usr/lib64/libdrm* /usr/lib64/libdrm.so.2 -> libdrm.so.2.134.0 /usr/lib64/libdrm_amdgpu.so.1 -> libdrm_amdgpu.so.1.134.0 ... $ pkg-config --modversion libdrm Package 'libdrm' was not found in the pkg-config search path $ ls /usr/include/libdrm ls: cannot access '/usr/include/libdrm': No such file or directory ``` ## Steps to reproduce 1. Fresh Fedora/Nobara install with the tools `setup.sh` checks for (`clang-cl`, `lld-link`, `llvm-lib`, `x86_64-w64-mingw32-gcc`, `widl`, `flex`, `bison`, `glslangValidator`, ...) but **without** `libdrm-devel`. 2. `./setup.sh` 3. The SDK and DLL steps finish, then `step_mesa` aborts as shown above. ## Root cause `setup.sh` builds RADV with ``` -Dvulkan-drivers=amd -Dgallium-drivers= -Dplatforms=x11,wayland ``` That configuration pulls in three families of *build-time* dependencies that `step_tools` never looked at, because it only checks for executables (`command -v ...`): 1. **libdrm** – RADV talks to the kernel amdgpu driver through `libdrm_amdgpu`, and Mesa requires `libdrm >= 2.4.133` for amdgpu (`meson.build:776-804`). Distros ship `libdrm.so.2` for the runtime Mesa package, but the headers and `libdrm.pc` live in a separate `-devel`/`-dev` package. `pkg-config` therefore reports the module as missing even though the library is installed – hence `Dependency "libdrm" not found`. 2. **X11/XCB** – the `x11` Vulkan platform needs `xcb`, `xcb-randr`, `xcb-dri3`, `xcb-present`, `xcb-shm`, `xcb-sync`, `xcb-xfixes`, `x11-xcb` and `xshmfence` (`meson.build:2318-2376`). 3. **Wayland** – the `wayland` platform needs `wayland-client`, `wayland-server` and `wayland-protocols >= 1.49` (`meson.build:2253-2256`). On top of that, `xlib-lease` defaults to enabled on X11 + KMS and needs `xrandr`, which is the *second* dependency failure a user hits after fixing libdrm: ``` deps/mesa/meson.build:2376:22: ERROR: Dependency "xrandr" not found ``` This is not a Mesa bug: `meson setup` reports the missing module correctly. Mesa's `libdrm.wrap` could supply libdrm via `-Dallow-fallback-for=libdrm`, but no wrap exists for the X11/Wayland client libraries, so the development packages are genuinely required. The bug is that the setup script promises to "name any tool it misses" and then fails deep inside Mesa instead. ## Fix `setup.sh` now preflights the pkg-config modules Mesa needs whenever the `mesa` step is part of the run, and prints the package names per distro family: ``` install first: libdrm >= 2.4.133 libdrm_amdgpu >= 2.4.133 xcb ... Fedora/Nobara: libdrm-devel libxcb-devel libX11-devel libXrandr-devel libxshmfence-devel wayland-devel wayland-protocols-devel Debian/Ubuntu: libdrm-dev libxcb1-dev libx11-dev libx11-xcb-dev libxrandr-dev libxshmfence-dev libwayland-dev wayland-protocols Arch: libdrm libxcb libx11 libxrandr libxshmfence wayland wayland-protocols ``` Details: * `step_tools` gained a `pkg-config --exists "<module> >= <version>"` loop over the modules above, using the same minimum versions Mesa asks for. The check only runs when `mesa` is in the requested steps, so `./setup.sh prefix` still works on machines without X11/Wayland headers. * `pkg-config` itself was added to the executable checks, so it is reported as a missing tool instead of producing empty dependency results. For anyone hitting this right now, the immediate workaround is: ```sh # Fedora / Nobara sudo dnf install libdrm-devel libxcb-devel libX11-devel libXrandr-devel \ libxshmfence-devel wayland-devel wayland-protocols-devel ``` after which `./setup.sh mesa` completes and installs `deps/mesa-inst/lib64/libvulkan_radeon.so` plus `deps/mesa-inst/share/vulkan/icd.d/radeon_icd.x86_64.json`. ## Verification ``` $ ./setup.sh mesa building mesa $ VK_DRIVER_FILES=$PWD/deps/mesa-inst/share/vulkan/icd.d/radeon_icd.x86_64.json vulkaninfo --summary Devices: ======== GPU0: driverVersion = 26.3.1 deviceName = AMD Radeon RX 7900 XT (RADV NAVI31) driverName = radv driverInfo = Mesa 26.3.1 (git-fec8830e9c) ``` ## Another missing-dependency failure on the same path: `x86_64-w64-mingw32-g++` With Mesa configured, the next step fails the same way, one layer later: ``` deps/vkd3d/meson.build:2:0: ERROR: Unknown compiler(s): [['x86_64-w64-mingw32-g++']] ``` `step_tools` checked for `x86_64-w64-mingw32-gcc` but not the C++ companion that vkd3d-proton's cross file uses, so a machine with only `mingw64-gcc` installed (C, no C++) got a Mesa-style meson error instead of "install first: x86_64-w64-mingw32-g++" (`mingw64-gcc-c++` on Fedora/Nobara, `g++-mingw-w64-x86-64` on Debian/Ubuntu, an AUR/`mingw-w64-gcc` package on Arch). It is now part of the executable checks. ## Unrelated bug hit afterwards: `deps/venv` breaks when the checkout moves This one has nothing to do with the libdrm failure above; it only appeared when `setup.sh` was re-run after the checkout folder had been renamed. Renaming or moving the repository after a first `setup.sh` run makes every later run die with ``` ./setup.sh: .../deps/venv/bin/meson: .../deps/venv/bin/python3: bad interpreter: No such file or directory ``` Python venvs are not relocatable: `deps/venv/bin/meson` has an absolute `#!` line pointing at the old path, while `deps/venv/bin/python3` is a symlink and still resolves. The old check only did `"$deps/venv/bin/python3" -c "import mesonbuild, ..."`, which succeeds, so the venv was never rebuilt. `step_tools` now tests `"$deps/venv/bin/meson" --version` instead and recreates the venv with `python3 -m venv --clear` when it cannot run, which covers both a missing module and a stale interpreter path. My setup.sh file here: `#!/bin/bash set -euo pipefail source "$(dirname "$(readlink -f "$0")")/env.sh" deps=$root/deps sys=$WINEPREFIX/drive_c/windows/system32 MESA=(https://gitlab.freedesktop.org/mesa/mesa.git mesa-26.3.1) VKD3D=(https://github.com/HansKristian-Work/vkd3d-proton 71cae091b06571e51446cf2a937f0b04c237c04d) WINE=(https://gitlab.winehq.org/wine/wine.git) XWIN=(https://github.com/Jake-Shadle/xwin/releases/download/0.10.0/xwin-0.10.0-x86_64-unknown-linux-musl.tar.gz d870eb4b2f390878af6da1ccd3cf321d22fcb72720984853b4be732ae597fc88) DXC=(https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.9.2609/dxc_2026_09_29.zip ad31b1fc8443175d204f77a611fdb3ef2ec42759bdc2f1167368de24a4a7e7f1) DXVK=(https://github.com/doitsujin/dxvk/releases/download/v3.1.1/dxvk-3.1.1.tar.gz 40565b4a724aadc4433fa4e010b4b23916d9b1f1baeee64e17186db94f54e608) D3DCOMPILER=(https://raw.githubusercontent.com/mozilla/fxc2/9aba9b11079303d5577e0e3eb455f4d00f3b5946/dll/d3dcompiler_47.dll 4432bbd1a390874f3f0a503d45cc48d346abc3a8c0213c289f4b615bf0ee84f3) FSR4=(https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK/v2.4.0/Kits/FidelityFX/signedbin/amd_fidelityfx_upscaler_dx12.dll aad4fccccb29084a655f9a4f9f613bd22c8c03fb4a0f8840148cc6543b4ccace) FSR4_DRIVER=(https://loathingKernel.github.io/proton-upscalers/amdxcffx64_v4.1.1_398EA93C15D554EFB7ECE1F4CD057554.xz 4e7dc37aebea3a90e3d3cc43e24cb2b54176b2535315f20dbe63b3b7cfc56b1e) logged() { local log=$deps/$1.log shift if ! "$@" >>"$log" 2>&1; then tail -n 30 "$log" exit 1 fi } fetch() { local url=$1 sum=$2 to=$3 if [ -f "$to" ] && echo "$sum $to" | sha256sum -c --status; then return; fi mkdir -p "$(dirname "$to")" echo "fetching $(basename "$to")" curl -fL --retry 3 -sS -o "$to.part" "$url" if ! echo "$sum $to.part" | sha256sum -c --status; then echo "$url is not the file expected"; exit 1; fi mv "$to.part" "$to" } source_of() { local name=$1 url=$2 ref=$3 dir=$deps/$1 patch=$root/patches/$1.patch sub local subs=() for sub in "$root/patches/$name".*.patch; do if [ -f "$sub" ]; then subs+=("$sub"); fi done local stamp="$ref $(cat "$patch" ${subs[@]+"${subs[@]}"} | sha256sum)" if [ ! -d "$dir/.git" ]; then git init -q "$dir" fi if git -C "$dir" remote get-url origin >/dev/null 2>&1; then git -C "$dir" remote set-url origin "$url" else git -C "$dir" remote add origin "$url" fi if [ "$(cat "$dir/.git/um-stamp" 2>/dev/null)" = "$stamp" ]; then return; fi if [ -f "$dir/.git/um-patch" ] && [ "$(patched "$dir" | sha256sum)" != "$(sha256sum < "$dir/.git/um-patch")" ]; then echo "deps/$name has changes the patch does not: keep them with tools/patch.sh $name" exit 1 fi echo "fetching $name $ref" git -C "$dir" fetch -q --depth 1 origin "$ref" git -C "$dir" submodule -q foreach --recursive 'git reset -q --hard' git -C "$dir" reset -q --hard git -C "$dir" checkout -q --detach FETCH_HEAD git -C "$dir" submodule update -q --init --recursive --depth 1 git -C "$dir" apply --index "$patch" for sub in ${subs[@]+"${subs[@]}"}; do git -C "$dir/$(submodule_of "$dir" "$sub")" apply --index "$sub" done patched "$dir" > "$dir/.git/um-patch" echo "$stamp" > "$dir/.git/um-stamp" } step_tools() { local missing=() pc=() step need_mesa_deps=0 for t in git curl unzip tar xz python3 pkg-config ninja glslangValidator clang-cl lld-link llvm-lib x86_64-w64-mingw32-gcc x86_64-w64-mingw32-g++ x86_64-w64-mingw32-strip widl cargo rustup make flex bison systemd-run unshare; do command -v "$t" >/dev/null || missing+=("$t") done if [ -z "${PROTON_DIR:-}" ]; then command -v wine >/dev/null || missing+=(wine) fi if (( ${#missing[@]} )); then echo "install first: ${missing[*]}"; exit 1; fi for step in "$@"; do if [ "$step" = mesa ]; then need_mesa_deps=1; fi done if (( need_mesa_deps )); then for p in "libdrm >= 2.4.133" "libdrm_amdgpu >= 2.4.133" xcb xcb-randr x11-xcb \ "xcb-dri3 >= 1.13" "xcb-present >= 1.13" xcb-shm xcb-sync "xshmfence >= 1.1" xcb-xfixes \ "xrandr >= 1.3" "wayland-client >= 1.18" "wayland-server >= 1.18" \ "wayland-protocols >= 1.49"; do pkg-config --exists "$p" 2>/dev/null || pc+=("$p") done if (( ${#pc[@]} )); then echo "install first: ${pc[*]}" echo " Fedora/Nobara: libdrm-devel libxcb-devel libX11-devel libXrandr-devel libxshmfence-devel wayland-devel wayland-protocols-devel" echo " Debian/Ubuntu: libdrm-dev libxcb1-dev libx11-dev libx11-xcb-dev libxrandr-dev libxshmfence-dev libwayland-dev wayland-protocols" echo " Arch: libdrm libxcb libx11 libxrandr libxshmfence wayland wayland-protocols" 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 fi } step_sdk() { if [ -d "$deps/msvc/VC" ]; then return; fi fetch "${XWIN[@]}" "$deps/xwin.tar.gz" tar -xzf "$deps/xwin.tar.gz" -C "$deps" --strip-components 1 --wildcards '*/xwin' echo "fetching the windows sdk" "$deps/xwin" --cache-dir "$deps/xwin-cache" splat --use-winsysroot-style --preserve-ms-arch-notation --output "$deps/msvc" rm -rf "$deps/xwin-cache" "$deps/xwin.tar.gz" "$deps/xwin" } step_dlls() { if [ ! -f "$deps/dxc/dxil.dll" ]; then fetch "${DXC[@]}" "$deps/dxc.zip" unzip -q -o -j "$deps/dxc.zip" 'bin?x64?dxcompiler.dll' 'bin?x64?dxil.dll' -d "$deps/dxc" 2>/dev/null || [ -f "$deps/dxc/dxil.dll" ] rm "$deps/dxc.zip" fi if [ ! -f "$deps/dxgi.dll" ]; then fetch "${DXVK[@]}" "$deps/dxvk.tar.gz" tar -xzf "$deps/dxvk.tar.gz" -C "$deps" --strip-components 2 --wildcards '*/x64/dxgi.dll' rm "$deps/dxvk.tar.gz" fi fetch "${D3DCOMPILER[@]}" "$deps/d3dcompiler_47.dll" } step_mesa() { source_of mesa "${MESA[@]}" local b=$deps/mesa/build if [ ! -f "$b/build.ninja" ]; then logged mesa meson setup "$b" "$deps/mesa" --prefix "$deps/mesa-inst" --buildtype release -Db_ndebug=true \ -Dvulkan-drivers=amd -Dgallium-drivers= -Dplatforms=x11,wayland -Dllvm=disabled \ -Dgles1=disabled -Dgles2=disabled -Dopengl=false -Dgbm=disabled -Dglx=disabled -Degl=disabled \ -Dvideo-codecs= -Dvulkan-layers= -Dtools= fi echo "building mesa" logged mesa meson install -C "$b" } step_vkd3d() { source_of vkd3d "${VKD3D[@]}" local b=$deps/vkd3d/build if [ ! -f "$b/build.ninja" ]; then logged vkd3d meson setup "$b" "$deps/vkd3d" --cross-file "$deps/vkd3d/build-win64.txt" --buildtype release \ -Denable_tests=false -Denable_extras=false fi echo "building vkd3d" logged vkd3d meson compile -C "$b" } step_wine() { if [ -n "${PROTON_DIR:-}" ]; then echo "using Proton (${PROTON_DIR}); skipping vanilla wineserver patch build" return fi local ver dir=$deps/wine patch=$root/patches/wine.patch b=$deps/wineserver ver=$("$WINE_BIN" --version) local ref="${ver%% *}" if [ ! -d "$dir/.git" ]; then git init -q "$dir" git -C "$dir" remote add origin "${WINE[0]}" fi local stamp="$ref $(sha256sum < "$patch")" if [ "$(cat "$dir/.git/um-stamp" 2>/dev/null)" != "$stamp" ]; then echo "fetching wine $ref" git -C "$dir" fetch -q --depth 1 origin "$ref" || { echo "note: could not fetch tag $ref; using system wineserver"; return; } git -C "$dir" reset -q --hard git -C "$dir" checkout -q --detach FETCH_HEAD if ! git -C "$dir" apply --index "$patch" 2>/dev/null; then echo "note: patches/wine.patch does not apply to $ref (newer Wine 11.x already refactored mapped views); using system wineserver" git -C "$dir" reset -q --hard rm -rf "$b" return fi git -C "$dir" diff HEAD > "$dir/.git/um-patch" echo "$stamp" > "$dir/.git/um-stamp" fi if [ "$(cat "$b/version" 2>/dev/null)" != "$ver" ]; then rm -rf "$b"; fi mkdir -p "$b" if [ ! -f "$b/Makefile" ]; then (cd "$b" && logged wineserver "$deps/wine/configure" --enable-win64 --without-x --without-wayland --without-freetype --without-vulkan --disable-tests) fi echo "building wineserver" logged wineserver make -C "$b" -j"$(nproc)" server/wineserver echo "$ver" > "$b/version" } step_prefix() { if [ ! -f "$WINEPREFIX/system.reg" ]; then echo "creating the prefix (runtime: ${PROTON_DIR:-$WINE_BIN})" mkdir -p "$state" WINEDLLOVERRIDES='mscoree,mshtml=d;winemenubuilder.exe=d' WINESERVER="$WINESERVER_BIN" "$WINE_BIN" wineboot -u "$WINESERVER_BIN" -w fi mkdir -p "$sys" x86_64-w64-mingw32-strip -o "$sys/d3d12.dll" "$deps/vkd3d/build/libs/d3d12/d3d12.dll" x86_64-w64-mingw32-strip -o "$sys/d3d12core.dll" "$deps/vkd3d/build/libs/d3d12core/d3d12core.dll" install -m 644 "$deps/dxgi.dll" "$deps/d3dcompiler_47.dll" "$sys/" if [ -d "$deps/fsr4/system32" ]; then install -m 644 "$deps/fsr4/system32"/*.dll "$sys/"; fi } step_victory() { echo "building victory" "$root/build.sh" } step_fsr4() { local bridge=${PROTON:+$PROTON/files/lib/wine/x86_64-windows/amdxc64.dll} local proton for proton in "$HOME/.local/share/Steam/steamapps/common/Proton - Experimental" "$HOME"/.local/share/Steam/steamapps/common/Proton*; do if [ -n "$bridge" ]; then break; fi if [ -f "$proton/files/lib/wine/x86_64-windows/amdxc64.dll" ]; then bridge=$proton/files/lib/wine/x86_64-windows/amdxc64.dll; fi done if [ ! -f "$bridge" ]; then echo "amdxc64.dll comes from proton: point at one with PROTON=/path/to/proton"; exit 1; fi fetch "${FSR4[@]}" "$deps/fsr4/amd_fidelityfx_upscaler_dx12.dll" if ! echo "${FSR4_DRIVER[1]} $deps/fsr4/system32/amdxcffx64.dll" | sha256sum -c --status 2>/dev/null; then mkdir -p "$deps/fsr4/system32" echo "fetching amdxcffx64.dll" curl -fL --retry 3 -sS "${FSR4_DRIVER[0]}" | xz -d > "$deps/fsr4/system32/amdxcffx64.dll.part" if ! echo "${FSR4_DRIVER[1]} $deps/fsr4/system32/amdxcffx64.dll.part" | sha256sum -c --status; then echo "${FSR4_DRIVER[0]} is not the file expected"; exit 1; fi mv "$deps/fsr4/system32/amdxcffx64.dll.part" "$deps/fsr4/system32/amdxcffx64.dll" fi install -m 644 "$bridge" "$deps/fsr4/system32/amdxc64.dll" if [ -d "$sys" ]; then install -m 644 "$deps/fsr4/system32"/*.dll "$sys/"; fi } mkdir -p "$deps" export PATH=$deps/venv/bin:$PATH if (( $# == 0 )); then set -- sdk dlls mesa vkd3d wine prefix victory; fi step_tools "$@" for step in "$@"; do case "$step" in sdk|dlls|mesa|vkd3d|wine|prefix|victory|fsr4) "step_$step";; *) echo "usage: setup.sh [sdk|dlls|mesa|vkd3d|wine|prefix|victory|fsr4]..."; exit 1;; esac done `
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 14:13:08 +00:00
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#70
No description provided.