From 949b5787eec0c8903897b90cf2b4b2611c6407b8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 8 Nov 2021 13:14:59 +0000 Subject: [PATCH] meson: Try to link all-targets module if Gallium OpenCL is enabled If we don't do this, and we are statically linking LLVM (-Dshared-llvm=disabled) while using a version of LLVM compiled for a general-purpose distribution, then the link fails with undefined references to the functions called by LLVMInitializeAllTargets(). Using a version of LLVM that was built specifically for Mesa will sometimes mask this: if the only backends built into LLVM are backends that we specifically link anyway, then the link will succeed. According to commit 80817b6e "meson: Adjust Clover's required LLVM modules", all-targets is not available when using CMake to locate LLVM, so make it optional rather than mandatory. This partially reverts commit 80817b6e344258ac9b955f824ebf9019a0fc1610. Resolves: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3962 Resolves: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5609 Signed-off-by: Simon McVittie Part-of: --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 07f681ad5d85..94bbfd359407 100644 --- a/meson.build +++ b/meson.build @@ -1634,7 +1634,7 @@ if with_gallium_opencl 'linker', 'coverage', 'instrumentation', 'ipo', 'irreader', 'lto', 'option', 'objcarcopts', 'profiledata' ] - llvm_optional_modules += ['frontendopenmp'] + llvm_optional_modules += ['all-targets', 'frontendopenmp'] endif if with_clc llvm_modules += ['coverage', 'target', 'linker', 'irreader', 'option', 'libdriver', 'lto'] -- GitLab