From ab348e2dc2527cb2f052d28b248427eb49689d66 Mon Sep 17 00:00:00 2001 From: aaravrav <37036762+aaravrav@users.noreply.github.com> Date: Fri, 16 Oct 2026 23:20:55 +0530 Subject: [PATCH] llvmPackages_23.openmp: fix build for LLVM 23+ --- .../compilers/llvm/common/openmp/default.nix | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/pkgs/development/compilers/llvm/common/openmp/default.nix b/pkgs/development/compilers/llvm/common/openmp/default.nix index 2601e294fccf..d6792fa1a94b 100644 --- a/pkgs/development/compilers/llvm/common/openmp/default.nix +++ b/pkgs/development/compilers/llvm/common/openmp/default.nix @@ -36,15 +36,28 @@ stdenv.mkDerivation (finalAttrs: { strictDeps = true; __structuredAttrs = true; } - '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/openmp "$out" - '' + ( + '' + mkdir -p "$out" + cp -r ${monorepoSrc}/cmake "$out" + cp -r ${monorepoSrc}/openmp "$out" + '' + + lib.optionalString (lib.versionAtLeast release_version "23") '' + mkdir -p "$out/llvm" + cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" + cp -r ${monorepoSrc}/llvm/utils "$out/llvm" + cp -r ${monorepoSrc}/third-party "$out" + cp -r ${monorepoSrc}/runtimes "$out" + '' + ) else src; - sourceRoot = "${finalAttrs.src.name}/openmp"; + # LLVM 23 removed OpenMP's standalone build + # https://openmp.llvm.org/Building.html + sourceRoot = + "${finalAttrs.src.name}/" + + (if lib.versionAtLeast release_version "23" then "runtimes" else "openmp"); outputs = [ "out" @@ -89,6 +102,9 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeFeature "OPT_TOOL" "${llvm}/bin/opt") (lib.cmakeFeature "LINK_TOOL" "${llvm}/bin/llvm-link") ] + ++ lib.optionals (lib.versionAtLeast release_version "23") [ + (lib.cmakeFeature "LLVM_ENABLE_RUNTIMES" "openmp") + ] ++ devExtraCmakeFlags; doCheck = false; @@ -96,7 +112,9 @@ stdenv.mkDerivation (finalAttrs: { checkTarget = "check-openmp"; preCheck = '' - patchShebangs ../tools/archer/tests/deflake.bash + patchShebangs ${ + if lib.versionAtLeast release_version "23" then "../../openmp" else ".." + }/tools/archer/tests/deflake.bash ''; __structuredAttrs = true;