From 37ba8970e7c7e5bd09415a8fc043296333a2a540 Mon Sep 17 00:00:00 2001 From: Morgan Jones Date: Sun, 14 Jul 2024 01:23:39 -0700 Subject: [PATCH] llvmPackages_13.compiler-rt-libc: don't use distutils.spawn This function was removed in Python 3.12 and seems to only be used in LLVM 13, despite the Python file this is used in being present in LLVM 12 and 14. The merge_archives.py file was removed in LLVM 15. --- .../compilers/llvm/common/compiler-rt/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix index 67f9661cf7438..2d8d396789876 100644 --- a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix @@ -149,7 +149,13 @@ stdenv.mkDerivation ({ --replace "#include " "" substituteInPlace lib/builtins/cpu_model${lib.optionalString (lib.versionAtLeast version "18") "/x86"}.c \ --replace "#include " "" - '')); + '')) + lib.optionalString (lib.versionAtLeast release_version "13" && lib.versionOlder release_version "14") '' + # https://github.com/llvm/llvm-project/blob/llvmorg-14.0.6/libcxx/utils/merge_archives.py + # Seems to only be used in v13 though it's present in v12 and v14, and dropped in v15. + substituteInPlace ../libcxx/utils/merge_archives.py \ + --replace-fail "import distutils.spawn" "from shutil import which as find_executable" \ + --replace-fail "distutils.spawn." "" + ''; # Hack around weird upsream RPATH bug postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin) ''