Created attachment 254502 [details] Fix build with clang 19 Build with llvm19 fails. It seems the following upstream patch is enough to fix it. https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29993
Created attachment 254511 [details] Fix build with clang 19 and correct TLS model I just realized it builds with the previous patch but it does not work because it causes errors like this: % vulkaninfo ERROR: [Loader Message] Code 0 : /usr/local/lib/libvulkan_intel.so: Unsupported relocation type 36 in non-PLT relocations ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /usr/local/lib/libvulkan_intel.so. Ignoring this JSON ERROR: [Loader Message] Code 0 : /usr/local/lib/libvulkan_radeon.so: Unsupported relocation type 36 in non-PLT relocations ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /usr/local/lib/libvulkan_radeon.so. Ignoring this JSON ERROR: [Loader Message] Code 0 : /usr/local/lib/libvulkan_lvp.so: Unsupported relocation type 36 in non-PLT relocations ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /usr/local/lib/libvulkan_lvp.so. Ignoring this JSON ERROR: [Loader Message] Code 0 : vkCreateInstance: Found no drivers! Cannot create Vulkan instance. This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan. ERROR at /data/usr/obj/usr/ports/graphics/vulkan-tools/work/Vulkan-Tools-1.3.299/vulkaninfo/./vulkaninfo.h:456:vkCreateInstance failed with ERROR_INCOMPATIBLE_DRIVER The reason is because clang 19 now supports "-mtls-dialect=gnu2" but our rtld does not support this model (yet?). Instead, we have been using "-ftls-model=initial-exec" for a while. This patch adds our TLS implementation.
Can you open some MR upstream for this please ?
(In reply to Emmanuel Vadot from comment #2) https://gitlab.freedesktop.org/mesa/mesa/-/issues/12072
(In reply to Jung-uk Kim from comment #3) You should open an MR with the patch, then we can add it as PATCHFILES for both mesa-dri and mesa-devel.
(In reply to Emmanuel Vadot from comment #4) I will. However, it seems GitLab access request will some time. Please stay tuned.
(In reply to Jung-uk Kim from comment #5) > However, it seems GitLab access request will some time. ^ take
(In reply to Emmanuel Vadot from comment #4) https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31897
Created attachment 254627 [details] Fix build with clang 19 and correct TLS model Updated with the upstream merge request.
Thanks, you need to bump portrevision too as I guess even with llvm !19 it will change the resulting binaries ? If not go ahead and commit.
Likely MFH-unsafe but -CURRENT isn't supported on /quarterly, anyway. Mesa with Clang < 19 defaults to -ftls-model=global-dynamic. Even if -ftls-model=initial-exec is correct for FreeBSD it was broken in the past, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/966 I've reported some regressions in the upstream MR. Only affects mesa-devel but this bug is about mesa-dri, so not a real MFH blocker.
Created attachment 254838 [details] Fix build with clang 19 I disabled support for TLS model because I failed to fix regressions reported by jbeich@.
Sorry, it was a wrong PR.
LGTM
v2 (attachment 254838 [details]) looks safe for MFH (matches Clang < 19 behavior) but not very useful without bug 281729 on -RELEASEs. Like comment 9 suggested do bump PORTREVISION to unbreak Vulkan runtime on -CURRENT per comment 1 in the default case (built with clang19 but linked against llvm15). While poudriere often rebuilds all packages on -CURRENT "pkg upgrade" skips those unless shared libs or ABI version change (not sure about OSVERSION bumps).
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=13d55b0eaa133e37a6834fa335d7cf02dc09080d commit 13d55b0eaa133e37a6834fa335d7cf02dc09080d Author: Jung-uk Kim <jkim@FreeBSD.org> AuthorDate: 2024-11-01 18:09:57 +0000 Commit: Jung-uk Kim <jkim@FreeBSD.org> CommitDate: 2024-11-01 18:09:57 +0000 graphics/mesa-dri: fix build with clang 19 Reviewed by: manu Tested by: jbeich PR: 282316 graphics/mesa-dri/Makefile | 1 + graphics/mesa-dri/Makefile.common | 2 ++ graphics/mesa-dri/distinfo | 4 ++++ 3 files changed, 7 insertions(+)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=f093abad37cb6de91f71a72302b6591793ae5f52 commit f093abad37cb6de91f71a72302b6591793ae5f52 Author: Jan Beich <jbeich@FreeBSD.org> AuthorDate: 2024-11-01 23:40:32 +0000 Commit: Jan Beich <jbeich@FreeBSD.org> CommitDate: 2024-11-01 23:52:43 +0000 graphics/mesa-libs: force rebuild on -CURRENT after 13d55b0eaa13 $ glxgears Error: couldn't get an RGB, Double-buffered visual $ glmark2-wayland Error: eglGetDisplay() failed with error: 0x3000 Error: main: Could not initialize canvas $ kmscube MESA-LOADER: failed to open iris: /usr/local/lib/libglapi.so.0: Unsupported relocation type 36 in non-PLT relocations (search paths /usr/local/lib/dri, suffix _dri) MESA-LOADER: failed to open kms_swrast: /usr/local/lib/libglapi.so.0: Unsupported relocation type 36 in non-PLT relocations (search paths /usr/local/lib/dri, suffix _dri) MESA-LOADER: failed to open swrast: /usr/local/lib/libglapi.so.0: Unsupported relocation type 36 in non-PLT relocations (search paths /usr/local/lib/dri, suffix _dri) failed to initialize GBM PR: 282316 graphics/mesa-libs/Makefile | 1 + 1 file changed, 1 insertion(+)