ERROR: Dependency "libdrm" not found (tried pkg-config and cmake) - at setup.sh #70
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem#70
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Finalizator on GitHub · 2026-12-01 14:12 UTC · original
./setup.shfails:Dependency "libdrm" not foundwhile configuring MesaSummary
On a system where the Mesa runtime libraries are installed but their
development packages are not,
./setup.shstops in the Mesa configure step:Nothing gets compiled; the build dies at dependency resolution, so the error
looks like a broken checkout rather than a missing system package.
Environment
setup.shcreates)mesa-26.3.1)Runtime library present, headers missing:
Steps to reproduce
setup.shchecks for(
clang-cl,lld-link,llvm-lib,x86_64-w64-mingw32-gcc,widl,flex,bison,glslangValidator, ...) but withoutlibdrm-devel../setup.shstep_mesaaborts as shown above.Root cause
setup.shbuilds RADV withThat configuration pulls in three families of build-time dependencies that
step_toolsnever looked at, because it only checks for executables(
command -v ...):libdrm – RADV talks to the kernel amdgpu driver through
libdrm_amdgpu, and Mesa requireslibdrm >= 2.4.133for amdgpu(
meson.build:776-804). Distros shiplibdrm.so.2for the runtime Mesapackage, but the headers and
libdrm.pclive in a separate-devel/-devpackage.
pkg-configtherefore reports the module as missing even though thelibrary is installed – hence
Dependency "libdrm" not found.X11/XCB – the
x11Vulkan platform needsxcb,xcb-randr,xcb-dri3,xcb-present,xcb-shm,xcb-sync,xcb-xfixes,x11-xcband
xshmfence(meson.build:2318-2376).Wayland – the
waylandplatform needswayland-client,wayland-serverandwayland-protocols >= 1.49(
meson.build:2253-2256). On top of that,xlib-leasedefaults to enabledon X11 + KMS and needs
xrandr, which is the second dependency failure auser hits after fixing libdrm:
This is not a Mesa bug:
meson setupreports the missing module correctly.Mesa's
libdrm.wrapcould supply libdrm via-Dallow-fallback-for=libdrm, but no wrap exists for the X11/Wayland clientlibraries, 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.shnow preflights the pkg-config modules Mesa needs whenever themesastep is part of the run, and prints the package names per distro family:
Details:
step_toolsgained apkg-config --exists "<module> >= <version>"loop overthe modules above, using the same minimum versions Mesa asks for. The check
only runs when
mesais in the requested steps, so./setup.sh prefixstillworks on machines without X11/Wayland headers.
pkg-configitself was added to the executable checks, so it is reported asa missing tool instead of producing empty dependency results.
For anyone hitting this right now, the immediate workaround is:
after which
./setup.sh mesacompletes and installsdeps/mesa-inst/lib64/libvulkan_radeon.soplusdeps/mesa-inst/share/vulkan/icd.d/radeon_icd.x86_64.json.Verification
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:
step_toolschecked forx86_64-w64-mingw32-gccbut not the C++ companion thatvkd3d-proton's cross file uses, so a machine with only
mingw64-gccinstalled(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-64on Debian/Ubuntu, an AUR/mingw-w64-gccpackage on Arch).It is now part of the executable checks.
Unrelated bug hit afterwards:
deps/venvbreaks when the checkout movesThis one has nothing to do with the libdrm failure above; it only appeared when
setup.shwas re-run after the checkout folder had been renamed. Renaming ormoving the repository after a first
setup.shrun makes every later run diewith
Python venvs are not relocatable:
deps/venv/bin/mesonhas an absolute#!line pointing at the old path, whiledeps/venv/bin/python3is a symlinkand still resolves. The old check only did
"$deps/venv/bin/python3" -c "import mesonbuild, ...", which succeeds, so thevenv was never rebuilt.
step_toolsnow tests"$deps/venv/bin/meson" --versioninstead and recreatesthe venv with
python3 -m venv --clearwhen it cannot run, which covers both amissing 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 referenced this issue2026-12-01 16:50:35 +00:00