I did a Q&D hack to make my build work. I don't actually know anything about Meson; this is pure guesswork. Here be dragons.meson.build.patch
I should add, here is the output of meson:
The Meson build system
Version: 0.59.4
Source dir: /pub/source/mesa-21.3.9
Build dir: /pub/build/mesa-21.3.9
Build type: native build
Program python3 found: YES (/usr/bin/python3)
Project name: mesa
Project version: 21.3.9
C compiler for the host machine: cc (gcc 7.5.0 "cc (SUSE Linux) 7.5.0")
C linker for the host machine: cc ld.bfd 2.39.0.20220810-150100
C++ compiler for the host machine: c++ (gcc 7.5.0 "c++ (SUSE Linux) 7.5.0")
C++ linker for the host machine: c++ ld.bfd 2.39.0.20220810-150100
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Found CMake: /usr/bin/cmake (3.20.4)
Run-time dependency vdpau found: NO (tried pkgconfig and cmake)
Run-time dependency xvmc found: YES 1.0.10
Run-time dependency xv found: YES 1.0.11
Run-time dependency libomxil-bellagio found: NO (tried pkgconfig and cmake)
Run-time dependency libtizonia found: NO (tried pkgconfig and cmake)
Run-time dependency libtizplatform found: NO (tried pkgconfig and cmake)
Run-time dependency tizilheaders found: NO (tried pkgconfig and cmake)
Run-time dependency libva found: NO (tried pkgconfig and cmake)
Program python3 found: YES (/usr/bin/python3)
Fetching value of define "ETIME" : 62
Checking for function "bswap32" : YES
Checking for function "bswap64" : YES
Checking for function "clz" : YES
Checking for function "clzll" : YES
Checking for function "ctz" : YES
Checking for function "expect" : YES
Checking for function "ffs" : YES
Checking for function "ffsll" : YES
Checking for function "popcount" : YES
Checking for function "popcountll" : YES
Checking for function "unreachable" : YES
Checking for function "types_compatible_p" : NO
Compiler for C supports function attribute const: YES
Compiler for C supports function attribute flatten: YES
Compiler for C supports function attribute malloc: YES
Compiler for C supports function attribute pure: YES
Compiler for C supports function attribute unused: YES
Compiler for C supports function attribute warn_unused_result: YES
Compiler for C supports function attribute weak: YES
Compiler for C supports function attribute format: YES
Compiler for C supports function attribute packed: YES
Compiler for C supports function attribute returns_nonnull: YES
Compiler for C supports function attribute alias: YES
Compiler for C supports function attribute noreturn: YES
Compiler for C supports function attribute visibility:hidden: YES
Checking if "__uint128_t" compiles: YES
Compiler for C supports arguments -Werror=implicit-function-declaration: YES
Compiler for C supports arguments -Werror=missing-prototypes: YES
Compiler for C supports arguments -Werror=return-type: YES
Compiler for C supports arguments -Werror=empty-body: YES
Compiler for C supports arguments -Werror=incompatible-pointer-types: YES
Compiler for C supports arguments -Werror=int-conversion: YES
Compiler for C supports arguments -Wimplicit-fallthrough: YES
Compiler for C supports arguments -Wno-missing-field-initializers: YES
Compiler for C supports arguments -Wno-format-truncation: YES
Compiler for C supports arguments -fno-math-errno: YES
Compiler for C supports arguments -fno-trapping-math: YES
Compiler for C supports arguments -Qunused-arguments: NO
Compiler for C supports arguments -fno-common: YES
Compiler for C supports arguments -Werror=format: YES
Compiler for C supports arguments -Wformat-security: YES
Compiler for C supports arguments -Werror=thread-safety: NO
Compiler for C++ supports arguments -Werror=return-type: YES
Compiler for C++ supports arguments -Werror=empty-body: YES
Compiler for C++ supports arguments -Wno-non-virtual-dtor: YES
Compiler for C++ supports arguments -Wno-missing-field-initializers: YES
Compiler for C++ supports arguments -Wno-format-truncation: YES
Compiler for C++ supports arguments -fno-math-errno: YES
Compiler for C++ supports arguments -fno-trapping-math: YES
Compiler for C++ supports arguments -Qunused-arguments: NO
Compiler for C++ supports arguments -flifetime-dse=1: YES
Compiler for C++ supports arguments -Werror=format: YES
Compiler for C++ supports arguments -Wformat-security: YES
Compiler for C supports arguments -Wno-override-init: YES
Compiler for C supports arguments -Wno-initializer-overrides: NO
Compiler for C supports arguments -Werror=pointer-arith: YES
Compiler for C++ supports arguments -Werror=pointer-arith: YES
Compiler for C supports arguments -Werror=gnu-empty-initializer: NO
Compiler for C++ supports arguments -Werror=gnu-empty-initializer: NO
Compiler for C supports arguments -Wmicrosoft-enum-value: NO
Checking if "GCC atomic builtins" compiles: YES
Checking if "GCC atomic builtins required -latomic" links: YES
Checking if "GCC 64bit atomics" with dependency not-found links: YES
Library ws2_32 found: NO
Header <sys/sysmacros.h> has symbol "major" : YES
Header <sys/sysmacros.h> has symbol "minor" : YES
Header <sys/sysmacros.h> has symbol "makedev" : YES
Header <sys/mkdev.h> has symbol "major" : NO
Check usable header "sched.h" : YES
Checking for function "sched_getaffinity" : YES
Check usable header "xlocale.h" : NO
Check usable header "linux/futex.h" : YES
Check usable header "endian.h" : YES
Check usable header "dlfcn.h" : YES
Check usable header "sys/shm.h" : YES
Check usable header "cet.h" : NO
Check usable header "pthread_np.h" : NO
Checking for function "strtof" : YES
Checking for function "mkostemp" : YES
Checking for function "timespec_get" : YES
Checking for function "memfd_create" : YES
Checking for function "random_r" : YES
Checking for function "flock" : YES
Checking for function "strtok_r" : YES
Checking for function "getrandom" : YES
Checking for function "qsort_r" : YES
Checking for function "qsort_s" : NO
Header <errno.h> has symbol "program_invocation_name" : YES
Checking for function "posix_memalign" : YES
Checking whether type "struct dirent" has member "d_type" : YES
Checking if "strtod has locale support" links: YES
Checking if "Bsymbolic" links: YES
Checking if "gc-sections" links: YES
Checking if "version-script" links: YES
Checking if "dynamic-list" links: YES
Compiler for C supports link arguments -Wl,--build-id=sha1: YES
Checking for function "dlopen" : NO
Library dl found: YES
Checking for function "dladdr" with dependency -ldl: YES
Checking for function "dl_iterate_phdr" : YES
Checking for function "clock_gettime" : YES
Run-time dependency zlib found: YES 1.2.11
Run-time dependency libzstd found: YES 1.5.0
Run-time dependency threads found: YES
Checking for function "pthread_setaffinity_np" with dependency threads: YES
Run-time dependency expat found: YES 2.4.4
Library m found: YES
Message: libdrm 2.4.107 needed because amdgpu has the highest requirement
Run-time dependency libdrm_intel found: YES 2.4.107
Run-time dependency libdrm_amdgpu found: YES 2.4.107
Run-time dependency libdrm_radeon found: YES 2.4.107
Run-time dependency libdrm_nouveau found: YES 2.4.107
Run-time dependency libdrm found: YES 2.4.107
llvm-config found: YES (/usr/bin/llvm-config) 13.0.1
Run-time dependency LLVM (modules: amdgpu, asmparser, bitreader, bitwriter, core, engine, executionengine, instcombine, ipo, mcdisassembler, mcjit, native, scalaropts, transformutils, coroutines) found: YES 13.0.1
Run-time dependency libelf found: YES 0.185
Run-time dependency valgrind found: NO (tried pkgconfig)
Program bison found: YES (/usr/bin/bison)
Program bison found: YES 3.0.4 (/usr/bin/bison)
Program flex found: YES (/usr/bin/flex)
Run-time dependency libunwind found: YES 1.5.0
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Build-time dependency wayland-scanner found: YES 1.19.0
Program /usr/bin/wayland-scanner found: YES (/usr/bin/wayland-scanner)
Run-time dependency wayland-protocols found: YES 1.25
Run-time dependency wayland-client found: YES 1.19.0
Run-time dependency wayland-server found: YES 1.19.0
Run-time dependency wayland-egl-backend found: YES 3
Run-time dependency OpenMP found: YES 4.5
Run-time dependency x11 found: YES 1.6.5
Run-time dependency xext found: YES 1.3.3
Run-time dependency xfixes found: YES 6.0.0
Run-time dependency xcb-glx found: YES 1.13
Run-time dependency xcb-shm found: YES 1.13
Run-time dependency xcb found: YES 1.13
Run-time dependency x11-xcb found: YES 1.6.5
Run-time dependency xcb-dri2 found: YES 1.13
Run-time dependency xcb-dri3 found: YES 1.13
Run-time dependency xcb-present found: YES 1.13
Dependency xcb-shm found: YES 1.13 (cached)
Run-time dependency xcb-sync found: YES 1.13
Run-time dependency xshmfence found: YES 1.2
Run-time dependency glproto found: YES 1.4.17
Run-time dependency dri2proto found: YES 2.8
Run-time dependency xxf86vm found: YES 1.1.4
Run-time dependency xcb-xfixes found: YES 1.13
Run-time dependency xcb-randr found: YES 1.13
Run-time dependency xrandr found: YES 1.5.1
Library sensors found: NO
Compiler for C supports link arguments -Wl,--gc-sections: YES
Compiler for C supports arguments -ffunction-sections: YES
Compiler for C supports arguments -fdata-sections: YES
Program nm found: YES (/usr/bin/nm)
Program symbols-check.py found: YES (/usr/bin/python3 /pub/source/mesa-21.3.9/bin/symbols-check.py)
Program install_megadrivers.py found: YES (/usr/bin/python3 /pub/source/mesa-21.3.9/bin/install_megadrivers.py)
WARNING: Library target 'GLESv1_CM' has 'name_prefix' set. Compilers may not find it from its '-lGLESv1_CM' linker flag in the 'glesv1_cm.pc' pkg-config file.
WARNING: Library target 'GLESv1_CM' has 'name_prefix' set. Compilers may not find it from its '-lGLESv1_CM' linker flag in the 'glesv1_cm-uninstalled.pc' pkg-config file.
WARNING: Library target 'GLESv2' has 'name_prefix' set. Compilers may not find it from its '-lGLESv2' linker flag in the 'glesv2.pc' pkg-config file.
WARNING: Library target 'GLESv2' has 'name_prefix' set. Compilers may not find it from its '-lGLESv2' linker flag in the 'glesv2-uninstalled.pc' pkg-config file.
Program decode.py found: YES (/pub/source/mesa-21.3.9/src/compiler/isaspec/decode.py)
Program encode.py found: YES (/pub/source/mesa-21.3.9/src/compiler/isaspec/encode.py)
Compiler for C++ supports arguments -Wno-unused-variable: YES
Compiler for C++ supports arguments -Wno-unused-local-typedefs: YES
Compiler for C++ supports arguments -Wno-unused-but-set-variable: YES
Compiler for C++ supports arguments -Wno-maybe-uninitialized: YES
Compiler for C++ supports arguments -fno-exceptions: YES
Compiler for C++ supports arguments -fno-rtti: YES
Compiler for C++ supports arguments -Wimplicit-fallthrough: YES
Compiler for C++ supports arguments -Wshadow: YES
Compiler for C++ supports arguments -DNOMINMAX: YES
Compiler for C supports arguments -Wimplicit-fallthrough: YES (cached)
Compiler for C supports arguments -Wshadow: YES
Dependency wayland-client found: YES 1.19.0 (cached)
Program /pub/source/mesa-21.3.9/bin/install_megadrivers.py found: YES (/usr/bin/python3 /pub/source/mesa-21.3.9/bin/install_megadrivers.py)
Program /pub/source/mesa-21.3.9/bin/install_megadrivers.py found: YES (/usr/bin/python3 /pub/source/mesa-21.3.9/bin/install_megadrivers.py)
Program /pub/source/mesa-21.3.9/bin/install_megadrivers.py found: YES (/usr/bin/python3 /pub/source/mesa-21.3.9/bin/install_megadrivers.py)
Configuring xa_tracker.h using configuration
Checking for function "mincore" : YES
WARNING: Library target 'EGL' has 'name_prefix' set. Compilers may not find it from its '-lEGL' linker flag in the 'egl.pc' pkg-config file.
WARNING: Library target 'EGL' has 'name_prefix' set. Compilers may not find it from its '-lEGL' linker flag in the 'egl-uninstalled.pc' pkg-config file.
Message: Configuration summary:
prefix: /opt/mesa-21.3.9
libdir: lib64
includedir: include
OpenGL: yes (ES1: yes ES2: yes)
OSMesa: no
DRI platform: drm
DRI drivers: i915 i965 r100 r200 nouveau
DRI driver dir: /opt/mesa-21.3.9/lib64/dri
GLX: DRI-based
EGL: yes
EGL drivers: builtin:egl_dri2 builtin:egl_dri3
EGL/Vulkan/VL platforms: x11 wayland surfaceless drm
GBM: yes
GBM backends path: /opt/mesa-21.3.9/lib64/gbm
Vulkan drivers: amd intel swrast
Vulkan ICD dir: share/vulkan/icd.d
llvm: yes
llvm-version: 13.0.1
Gallium drivers: r300 r600 radeonsi nouveau virgl svga swrast iris crocus
Gallium st: mesa xa xvmc
HUD lmsensors: no
Shared-glapi: yes
Perfetto: no
Perfetto ds: auto
Build targets in project: 245
Found ninja-1.10.0 at /usr/bin/ninja
I'm trying to compile mesa-21.3.9 from source tarball on openSUSE Leap 15.4.
meson setup --prefix=/opt/mesa-21.3.9/ ../../build/mesa-21.3.9/
cd ../../build/mesa-21.3.9/
ninja -C ./
This fails with:
[780/2450] Compiling C object src/intel/vulkan/libanv_per_hw_ver80.a.p/genX_gpu_memcpy.c.o
FAILED: src/intel/vulkan/libanv_per_hw_ver80.a.p/genX_gpu_memcpy.c.o
cc -Isrc/intel/vulkan/libanv_per_hw_ver80.a.p -Isrc/intel/vulkan -I../../source/mesa-21.3.9/src/intel/vulkan -Iinclude -I../../source/mesa-21.3.9/include -Isrc -I../../source/mesa-21.3.9/src -Isrc/mapi -I../../source/mesa-21.3.9/src/mapi -Isrc/mesa -I../../source/mesa-21.3.9/src/mesa -I../../source/mesa-21.3.9/src/gallium/include -Isrc/compiler -I../../source/mesa-21.3.9/src/compiler -Isrc/intel -I../../source/mesa-21.3.9/src/intel -Isrc/compiler/nir -I../../source/mesa-21.3.9/src/compiler/nir -Isrc/vulkan/util -I../../source/mesa-21.3.9/src/vulkan/util -Isrc/vulkan/wsi -I../../source/mesa-21.3.9/src/vulkan/wsi -Isrc/intel/genxml -I/usr/include/libdrm -fvisibility=hidden -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c11 -O2 -g -ffunction-sections -fdata-sections -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DPACKAGE_VERSION="21.3.9"' '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues"' -DUSE_ELF_TLS -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -DHAVE_X11_PLATFORM -DHAVE_XCB_PLATFORM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_DRM -DHAVE_DRM_PLATFORM -DENABLE_SHADER_CACHE -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE -DHAVE_FUNC_ATTRIBUTE_CONST -DHAVE_FUNC_ATTRIBUTE_FLATTEN -DHAVE_FUNC_ATTRIBUTE_MALLOC -DHAVE_FUNC_ATTRIBUTE_PURE -DHAVE_FUNC_ATTRIBUTE_UNUSED -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT -DHAVE_FUNC_ATTRIBUTE_WEAK -DHAVE_FUNC_ATTRIBUTE_FORMAT -DHAVE_FUNC_ATTRIBUTE_PACKED -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL -DHAVE_FUNC_ATTRIBUTE_ALIAS -DHAVE_FUNC_ATTRIBUTE_NORETURN -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -DHAVE_UINT128 -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DUSE_X86_64_ASM -DMAJOR_IN_SYSMACROS -DHAS_SCHED_H -DHAS_SCHED_GETAFFINITY -DHAVE_LINUX_FUTEX_H -DHAVE_ENDIAN_H -DHAVE_DLFCN_H -DHAVE_SYS_SHM_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_RANDOM_R -DHAVE_FLOCK -DHAVE_STRTOK_R -DHAVE_GETRANDOM -DHAVE_QSORT_R -DHAVE_PROGRAM_INVOCATION_NAME -DHAVE_POSIX_MEMALIGN -DHAVE_DIRENT_D_TYPE -DHAVE_STRTOD_L -DHAVE_DLADDR -DHAVE_DL_ITERATE_PHDR -DHAVE_ZLIB -DHAVE_ZSTD -DHAVE_COMPRESSION -DHAVE_PTHREAD -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LIBDRM -DLLVM_AVAILABLE '-DMESA_LLVM_VERSION_STRING="13.0.1"' -DLLVM_IS_SHARED=1 -DDRAW_LLVM_AVAILABLE -DMESA_EXECMEM -DHAVE_LIBUNWIND -DHAVE_WAYLAND_PLATFORM -DWL_HIDE_DEPRECATED -DHAVE_OPENMP -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -DVK_USE_PLATFORM_WAYLAND_KHR -DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_XLIB_KHR -DVK_USE_PLATFORM_XLIB_XRANDR_EXT -DVK_USE_PLATFORM_DISPLAY_KHR -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=empty-body -Werror=incompatible-pointer-types -Werror=int-conversion -Wimplicit-fallthrough -Wno-missing-field-initializers -Wno-format-truncation -fno-math-errno -fno-trapping-math -fno-common -Werror=format -Wformat-security -fPIC -Wno-override-init -msse2 -mstackrealign -DGFX_VERx10=80 -MD -MQ src/intel/vulkan/libanv_per_hw_ver80.a.p/genX_gpu_memcpy.c.o -MF src/intel/vulkan/libanv_per_hw_ver80.a.p/genX_gpu_memcpy.c.o.d -o src/intel/vulkan/libanv_per_hw_ver80.a.p/genX_gpu_memcpy.c.o -c ../../source/mesa-21.3.9/src/intel/vulkan/genX_gpu_memcpy.c
In file included from ../../source/mesa-21.3.9/src/vulkan/util/vk_alloc.h:30:0,
from ../../source/mesa-21.3.9/src/intel/vulkan/anv_private.h:66,
from ../../source/mesa-21.3.9/src/intel/vulkan/genX_gpu_memcpy.c:24:
../../source/mesa-21.3.9/include/vulkan/vulkan.h:41:10: fatal error: wayland-client.h: No such file or directory
#include <wayland-client.h>
^~~~~~~~~~~~~~~~~~
compilation terminated.
The wayland-client.h file is present in /usr/include/wayland/
ls -l /usr/include/wayland/wayland-client.h
-rw-r--r-- 1 root root 1573 May 7 2022 /usr/include/wayland/wayland-client.h
pkg-config for module wayland-client outputs the proper include directory:
pkg-config --cflags wayland-client
-I/usr/include/wayland
Adding -I/usr/include/wayland to the cc command line makes the compilation succeed. Is the build system missing the information that target genX_gpu_memcpy.c.o indirectly includes wayland-client.h and thus needs the proper -I command line parameter?