From 788161457df73dcd3e43f56460be5d9d734fc92f Mon Sep 17 00:00:00 2001 From: Michael Daniels Date: Fri, 30 May 2025 21:31:00 -0400 Subject: [PATCH] llvm_{12,13,14,15}: fix build with Python 3.13 Python 3.13 removed the "pipes" module, which LLVM used through v16. So we need a patch. It's only used once though! A similar patch was used by Arch: https://gitlab.archlinux.org/archlinux/packaging/packages/llvm15/-/blob/main/nopipes.diff?ref_type=heads --- .../compilers/llvm/12/llvm/no-pipes.patch | 19 ++++++++++++++++++ .../compilers/llvm/common/llvm/default.nix | 20 +++++++++---------- .../compilers/llvm/common/patches.nix | 6 ++++++ 3 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 pkgs/development/compilers/llvm/12/llvm/no-pipes.patch diff --git a/pkgs/development/compilers/llvm/12/llvm/no-pipes.patch b/pkgs/development/compilers/llvm/12/llvm/no-pipes.patch new file mode 100644 index 000000000000..5b3d94e21ff6 --- /dev/null +++ b/pkgs/development/compilers/llvm/12/llvm/no-pipes.patch @@ -0,0 +1,19 @@ +diff --git a/test/Bindings/Go/lit.local.cfg b/test/Bindings/Go/lit.local.cfg +index 91a0ad89..4da83a1a 100644 +--- a/test/Bindings/Go/lit.local.cfg ++++ b/test/Bindings/Go/lit.local.cfg +@@ -1,5 +1,4 @@ + import os +-import pipes + import shlex + import sys + +@@ -56,7 +55,7 @@ def fixup_compiler_path(compiler): + except (AttributeError, OSError): + pass + +- return ' '.join([pipes.quote(arg) for arg in args]) ++ return ' '.join([shlex.quote(arg) for arg in args]) + + config.environment['CC'] = fixup_compiler_path(config.host_cc) + config.environment['CXX'] = fixup_compiler_path(config.host_cxx) diff --git a/pkgs/development/compilers/llvm/common/llvm/default.nix b/pkgs/development/compilers/llvm/common/llvm/default.nix index e7d12650fa47..6051243f6668 100644 --- a/pkgs/development/compilers/llvm/common/llvm/default.nix +++ b/pkgs/development/compilers/llvm/common/llvm/default.nix @@ -208,16 +208,16 @@ stdenv.mkDerivation ( stripLen = 1; } ) - ++ - lib.optional (lib.versionOlder release_version "16") - # Fix musl build. - ( - fetchpatch { - url = "https://github.com/llvm/llvm-project/commit/5cd554303ead0f8891eee3cd6d25cb07f5a7bf67.patch"; - relative = "llvm"; - hash = "sha256-XPbvNJ45SzjMGlNUgt/IgEvM2dHQpDOe6woUJY+nUYA="; - } - ) + ++ lib.optionals (lib.versionOlder release_version "16") [ + # Fix musl build. + (fetchpatch { + url = "https://github.com/llvm/llvm-project/commit/5cd554303ead0f8891eee3cd6d25cb07f5a7bf67.patch"; + relative = "llvm"; + hash = "sha256-XPbvNJ45SzjMGlNUgt/IgEvM2dHQpDOe6woUJY+nUYA="; + }) + # Fix for Python 3.13 + (getVersionFile "llvm/no-pipes.patch") + ] ++ lib.optionals (lib.versionOlder release_version "14") [ # Backport gcc-13 fixes with missing includes. (fetchpatch { diff --git a/pkgs/development/compilers/llvm/common/patches.nix b/pkgs/development/compilers/llvm/common/patches.nix index cc5872951c3b..cd4939dcd119 100644 --- a/pkgs/development/compilers/llvm/common/patches.nix +++ b/pkgs/development/compilers/llvm/common/patches.nix @@ -204,6 +204,12 @@ path = ../12; } ]; + "llvm/no-pipes.patch" = [ + { + before = "16"; + path = ../12; + } + ]; "openmp/fix-find-tool.patch" = [ { after = "17";