From 6bf3337ff59ff2e388658729fcd1de83bf3d4e60 Mon Sep 17 00:00:00 2001 From: Colin Date: Sat, 8 Mar 2025 23:47:01 +0000 Subject: [PATCH] mesa: fix cross compilation starting with 25.0.0, mesa no longer builds CLC executables when cross compiling: it finds the `mesa-clc` & others we explicitly provide it, decides there's no reason to build new versions of those components, and so cross-compiled mesa no longer produces any `cross_tools` output. excerpted from upstream src/compiler/clc/meson.build: ```meson if get_option('mesa-clc') != 'system' and (with_gallium_asahi or \ with_asahi_vk or \ with_intel_vk or \ with_gallium_iris or \ get_option('install-mesa-clc')) prog_mesa_clc = executable( 'mesa_clc', ['mesa_clc.c'], include_directories : [inc_include, inc_src], c_args : [pre_args, no_override_init_args], link_args : [ld_args_build_id], dependencies : [idep_mesaclc, dep_llvm, dep_spirv_tools, idep_getopt], # If we can run host binaries directly, just build mesa_clc for the host. # Most commonly this happens when doing a cross compile from an x86_64 build # machine to an x86 host native : not meson.can_run_host_binaries(), install : get_option('install-mesa-clc'), ) endif ``` --- pkgs/development/libraries/mesa/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 3fe641b4476c..476144ae8b8a 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -172,7 +172,13 @@ in stdenv.mkDerivation { # libspirv2dxil itself is pretty chonky, so relocate it to its own output in # case anything wants to use it at some point "spirv2dxil" - # tools for the host platform to be used when cross-compiling + ] ++ lib.optionals (!needNativeCLC) [ + # tools for the host platform to be used when cross-compiling. + # mesa builds these only when not already built. hence: + # - for a non-cross build (needNativeCLC = false), we do not provide mesa + # with any `*-clc` binaries, so it builds them and installs them. + # - for a cross build (needNativeCLC = true), we provide mesa with `*-clc` + # binaries, so it skips building & installing any new CLC files. "cross_tools" ];