pouidere build fails to build graphics/mesa-libs for my freebsd 11.4 platform build it also fails when trying to build it on command line Message: Configuration summary: prefix: /usr/local libdir: lib includedir: include OpenGL: yes (ES1: yes ES2: yes) OSMesa: no DRI platform: drm DRI drivers: r100 DRI driver dir: /usr/local/lib/dri GLX: DRI-based EGL: yes EGL drivers: builtin:egl_dri2 builtin:egl_dri3 GBM: yes EGL/Vulkan/VL platforms: x11 surfaceless drm Vulkan drivers: no llvm: yes llvm-version: 12.0.1 Gallium: no HUD lmsensors: no Shared-glapi: yes Build targets in project: 91 Option buildtype is: release [default: debugoptimized] Found ninja-1.10.2 at /usr/local/bin/ninja ===> Building for mesa-libs-21.1.5 <.....> [ 2% 23/774] cc -Isrc/util/libmesa_util.a.p -Isrc/util -I../src/util -Iinclude -I../include -Isrc -I../src -Isrc/mapi -I../src/mapi -Isrc/mesa -I../src/mesa -I../src/gallium/include -I../src/gallium/auxiliary -I/usr/local/include -fvisibility=hidden -fno-color-diagnostics -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c99 -O3 -ffunction-sections -fdata-sections -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DPACKAGE_VERSION="21.1.5"' '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues"' -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 -DETIME=ETIMEDOUT -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___BUILTIN_TYPES_COMPATIBLE_P -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 -DHAVE_SYS_SYSCTL_H -DHAVE_XLOCALE_H -DHAVE_DLFCN_H -DHAVE_EXECINFO_H -DHAVE_SYS_SHM_H -DHAVE_PTHREAD_NP_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_FLOCK -DHAVE_STRTOK_R -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_LIBDRM -DLLVM_AVAILABLE '-DMESA_LLVM_VERSION_STRING="12.0.1"' -DLLVM_IS_SHARED=1 -DDRAW_LLVM_AVAILABLE -DUSE_LIBGLVND=1 -DHAVE_LIBUNWIND -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -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 -fno-math-errno -fno-trapping-math -Qunused-arguments -fno-common -Werror=format -Wformat-security -Wno-microsoft-enum-value -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -pthread -Werror=pointer-arith -Werror=gnu-empty-initializer -MD -MQ src/util/libmesa_util.a.p/build_id.c.o -MF src/util/libmesa_util.a.p/build_id.c.o.d -o src/util/libmesa_util.a.p/build_id.c.o -c ../src/util/build_id.c FAILED: src/util/libmesa_util.a.p/build_id.c.o cc -Isrc/util/libmesa_util.a.p -Isrc/util -I../src/util -Iinclude -I../include -Isrc -I../src -Isrc/mapi -I../src/mapi -Isrc/mesa -I../src/mesa -I../src/gallium/include -I../src/gallium/auxiliary -I/usr/local/include -fvisibility=hidden -fno-color-diagnostics -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c99 -O3 -ffunction-sections -fdata-sections -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DPACKAGE_VERSION="21.1.5"' '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues"' -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 -DETIME=ETIMEDOUT -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___BUILTIN_TYPES_COMPATIBLE_P -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 -DHAVE_SYS_SYSCTL_H -DHAVE_XLOCALE_H -DHAVE_DLFCN_H -DHAVE_EXECINFO_H -DHAVE_SYS_SHM_H -DHAVE_PTHREAD_NP_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_FLOCK -DHAVE_STRTOK_R -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_LIBDRM -DLLVM_AVAILABLE '-DMESA_LLVM_VERSION_STRING="12.0.1"' -DLLVM_IS_SHARED=1 -DDRAW_LLVM_AVAILABLE -DUSE_LIBGLVND=1 -DHAVE_LIBUNWIND -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -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 -fno-math-errno -fno-trapping-math -Qunused-arguments -fno-common -Werror=format -Wformat-security -Wno-microsoft-enum-value -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -pthread -Werror=pointer-arith -Werror=gnu-empty-initializer -MD -MQ src/util/libmesa_util.a.p/build_id.c.o -MF src/util/libmesa_util.a.p/build_id.c.o.d -o src/util/libmesa_util.a.p/build_id.c.o -c ../src/util/build_id.c ../src/util/build_id.c:42:4: error: unknown type name 'Elf_Nhdr' ElfW(Nhdr) nhdr; ^ ../src/util/build_id.c:38:20: note: expanded from macro 'ElfW' #define ElfW(type) Elf_##type ^ <scratch space>:108:1: note: expanded from here Elf_Nhdr ^ ../src/util/build_id.c:91:33: error: use of undeclared identifier 'Elf_Nhdr' size_t offset = sizeof(ElfW(Nhdr)) + ^ ../src/util/build_id.c:38:20: note: expanded from macro 'ElfW' #define ElfW(type) Elf_##type ^ <scratch space>:109:1: note: expanded from here Elf_Nhdr ^ 2 errors generated. ninja: build stopped: subcommand failed. ===> Compilation failed unexpectedly. Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to the maintainer. *** Error code 1 Stop. make[1]: stopped in /usr/ports/graphics/mesa-libs *** Error code 1 Stop. make: stopped in /usr/ports/graphics/mesa-libs please advice, thank you
It appears this is a long known incompatibility with FreeBSD11, and there used to be a patch to address it in mesa-dri. That patch was patch-src_util_build__id.c in graphics/mesa-dri/files, but it was removed in commit 22a85734f. The mesa-libs port pulls all its patch files from the mesa-dri/files directory, and so when this patch was removed it broke mesa-libs. restoring this file to graphics/mesa-dri/files returns mesa-libs to a state where it can build on 11.4. I am attaching the patch-src_util_build__id.c file that used to be present in the graphics/mesa-dri/files directory. You can simply pop it back there and get mesa-libs installed again. I do not know if doing so would break the build on 12 or 13, but it's been there for ages and is mentioned in the year-old bug report on the mesa gitlab site (mentioned in commit message for commit 3662ce6c0)
Created attachment 226701 [details] This patch used to be in graphics/mesa-dri/files and was removed recently If this patch is put back into graphics/mesa-dri/files then mesa-libs and mesa-dri build on FreeBSD 11.4 again.
Oh, yeah, of course one also has to comment out the BROKEN line in the Makefile of mesa-libs if one re-applies the patch.
I added sunpoet@FreeBSD.org to the CC because he had marked the port broken on FreeBSD 11 today.
FWIW, here's the github link to the file that got deleted: https://github.com/freebsd/freebsd-ports/blob/1c02555442edf5e255e65af6aa72e579987481d7/graphics/mesa-dri/files/patch-src_util_build__id.c Since the patch is very specific to FreeBSD < 12, it should be safe to restore.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=f74b56360de7b82aa5135be306cdfacb3db3acd0 commit f74b56360de7b82aa5135be306cdfacb3db3acd0 Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2021-07-28 07:12:07 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2021-07-28 07:12:07 +0000 graphics/mesa-*: Unbreak on 11.4 Re-add patches that was removed on the 21.1.5 update. PR: 257305 graphics/mesa-dri/Makefile.common | 4 ++++ .../mesa-dri/files/extra-patch-src_util_build__id.c (new) | 15 +++++++++++++++ graphics/mesa-libs/Makefile | 2 -- 3 files changed, 19 insertions(+), 2 deletions(-)
This has been fixed, closing.