v1-0001-Use-the-found-LLVM-version-when-finding-clang.patch

text/x-patch

Filename: v1-0001-Use-the-found-LLVM-version-when-finding-clang.patch
Type: text/x-patch
Part: 0
Message: Re: Building with meson on NixOS/nixpkgs

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v1-0001
Subject: Use the found LLVM version when finding clang
File+
meson.build 1 1
From 3dacd3b73c316bafd60c7aef9e6192591c6bf5f1 Mon Sep 17 00:00:00 2001
From: Tristan Partin <tristan@neon.tech>
Date: Fri, 9 Aug 2024 11:41:09 -0500
Subject: [PATCH v1] Use the found LLVM version when finding clang

find_program(version:) can be used to restrict the version of the
program to be found. In this case, we need a clang that is compatible
with LLVM.

Prior to 4d8de281b5834c8f5e0be6ae21e884e69dffd4ce, this worked as
intended, but since that change it was possible to pick an incompatible
clang and LLVM combination.

Reported-by: Andres Freund <andres@anarazel.de>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index cc176f11b5d..73101e84036 100644
--- a/meson.build
+++ b/meson.build
@@ -802,7 +802,7 @@ if add_languages('cpp', required: llvmopt, native: false)
 
     # Some distros put LLVM and clang in different paths, so fallback to
     # find via PATH, too.
-    clang = find_program(llvm_binpath / 'clang', 'clang', required: true)
+    clang = find_program(llvm_binpath / 'clang', 'clang', version: llvm.version(), required: true)
   endif
 elif llvmopt.auto()
   message('llvm requires a C++ compiler')
-- 
Tristan Partin
Neon (https://neon.tech)