guix_mirror_bot pushed a commit to branch c++-team
in repository guix.
commit 794e47110b0dfd86479b289b8be414e9dae9b5c8
Author: Greg Hogan <[email protected]>
AuthorDate: Sun Apr 6 12:09:05 2025 +0000
gnu: llvm: Fix tests.
* gnu/packages/llvm.scm (clang-from-llvm)[arguments]: Set #:tests? to
disabled.
(make-llvm, llvm-14)[arguments]<#:phases>: Replace 'check phase to run
tests.
(llvm-14)[native-inputs]: Add which.
(llvm-12)[arguments]<#:tests>: Disable tests.
<#:phases>: Add 'remove-failing-tests phase.
(llvm-6)[arguments]<#:phases>: ... and remove it.
* gnu/packages/patches/llvm-13-gcc-14.patch: Patch test file.
Change-Id: Ibf0e4a4b535838ff4ffd60d66bc0bee4314abde6
llvm fix tests
Change-Id: I0d4af07674e8724222f228aa3fc10f492015cd09
---
gnu/packages/llvm.scm | 37 ++++++++++++++++++++++++++-----
gnu/packages/patches/llvm-13-gcc-14.patch | 10 +++++++++
2 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 0accbd4503..1ce6bba57e 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -277,7 +277,10 @@ until LLVM/Clang 14."
(propagated-inputs
(list llvm clang-runtime))
(arguments
- `(#:configure-flags
+ `(;; TODO: enable tests.
+ #:tests? #f
+
+ #:configure-flags
(list "-DCLANG_INCLUDE_TESTS=True"
;; TODO: Use --gcc-install-dir when GCC_INSTALL_PREFIX is
@@ -659,11 +662,19 @@ output), and Binutils.")
"-DLLVM_PARALLEL_LINK_JOBS=1") ;cater to smaller build machines
;; Don't use '-g' during the build, to save space.
#:build-type "Release"
+ #:modules '((guix build cmake-build-system)
+ ((guix build gnu-build-system) #:prefix gnu:)
+ (guix build utils))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'change-directory
(lambda _
(chdir "llvm")))
+ (replace 'check
+ (lambda* (#:rest args)
+ (setenv "HOME" "/tmp")
+ (apply (assoc-ref gnu:%standard-phases 'check)
+ #:test-target "check-llvm" args)))
(add-after 'install 'install-opt-viewer
(lambda* (#:key outputs #:allow-other-keys)
(let* ((opt-viewer-share (string-append #$output:opt-viewer
@@ -701,6 +712,9 @@ of programming tools as well as libraries with equivalent
functionality.")
(source (llvm-monorepo version))
(arguments
(list
+ #:modules '((guix build cmake-build-system)
+ ((guix build gnu-build-system) #:prefix gnu:)
+ (guix build utils))
#:configure-flags
#~(list
;; These options are required for cross-compiling LLVM according
@@ -739,6 +753,11 @@ of programming tools as well as libraries with equivalent
functionality.")
(add-after 'unpack 'change-directory
(lambda _
(chdir "llvm")))
+ (replace 'check
+ (lambda* (#:rest args)
+ (setenv "HOME" "/tmp")
+ (apply (assoc-ref gnu:%standard-phases 'check)
+ #:test-target "check-llvm" args)))
(add-after 'install 'install-opt-viewer
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
@@ -749,9 +768,7 @@ of programming tools as well as libraries with equivalent
functionality.")
(rename-file (string-append out "/share/opt-viewer")
opt-viewer-dir)))))))
- (native-inputs
- `(("python" ,python-wrapper)
- ("perl" ,perl)))))
+ (native-inputs (list perl python-wrapper which))))
(define-public clang-runtime-15
(clang-runtime-from-llvm llvm-15))
@@ -932,6 +949,8 @@ Library.")
(patches (search-patches "llvm-13-gcc-14.patch"))))
(arguments
(substitute-keyword-arguments (package-arguments llvm-13)
+ ;; Disable tests for old releases now compiled with newer GCC.
+ ((#:tests? _ #false) #false)
((#:phases phases)
#~(modify-phases #$phases
#$@(if (assoc "config" (package-native-inputs this-package))
@@ -942,6 +961,9 @@ Library.")
"/bin/config.guess")))
(copy-file config.guess "cmake/config.guess")))))
#~())
+ (add-after 'unpack 'delete-failing-tests
+ (lambda _
+ (delete-file "test/DebugInfo/X86/vla-multi.ll")))
(add-before 'build 'shared-lib-workaround
;; Even with CMAKE_SKIP_BUILD_RPATH=FALSE, llvm-tblgen
;; doesn't seem to get the correct rpath to be able to run
@@ -1271,7 +1293,12 @@ Library.")
(uri (llvm-uri "llvm" version))
(sha256
(base32
- "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn"))))))
+ "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn"))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments llvm-7)
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (delete 'delete-failing-tests)))))))
(define-public clang-runtime-6
(clang-runtime-from-llvm
diff --git a/gnu/packages/patches/llvm-13-gcc-14.patch
b/gnu/packages/patches/llvm-13-gcc-14.patch
index a7697b01d0..2625ad497c 100644
--- a/gnu/packages/patches/llvm-13-gcc-14.patch
+++ b/gnu/packages/patches/llvm-13-gcc-14.patch
@@ -10,3 +10,13 @@ See: https://github.com/smlnj/smlnj/issues/279
#include <string>
namespace llvm {
+--- llvm-13.0.1.src/include/llvm/Support/Base64.h 1970-01-01
00:00:01.000000000 +0000
++++ llvm-13.0.1.src/include/llvm/Support/Base64.h 2025-07-18
23:45:19.568475987 +0000
+@@ -14,6 +14,7 @@
+ #define LLVM_SUPPORT_BASE64_H
+
+ #include <string>
++#include <cstdint>
+
+ namespace llvm {
+