GNU bug report logs - #54239
[PATCH] gnu: Add cross-clang.

Previous Next

Package: guix-patches;

Reported by: Julien Lepiller <julien <at> lepiller.eu>

Date: Thu, 3 Mar 2022 16:04:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Julien Lepiller <julien <at> lepiller.eu>
To: 54239 <at> debbugs.gnu.org
Subject: [bug#54239] [PATCH v3 03/10] gnu: llvm-9: Fix cross-compilation.
Date: Sat, 16 Jul 2022 21:48:00 +0200
`(package-arguments llvm-10)' evaluates `this-package' in the context of
llvm-10.  `llvm-tblgen' in llvm-10 is not compatible with llvm-9, so
copy the configure-flags from llvm-12 to make sure `this-package' is
evaluated here.

* gnu/packages/llvm.scm (llvm-9)[arguments]: Fix cross-compilation.
---
 gnu/packages/llvm.scm | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 6428391650..2aec2925cf 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -973,7 +973,30 @@ (define-public llvm-9
                       "if (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES \"riscv64\")\n"
                       "  target_link_libraries(dsymutil PRIVATE atomic)\n"
                       "endif()"))))))))
-       (package-arguments llvm-10)))))
+       (substitute-keyword-arguments (package-arguments llvm-10)
+         ((#:configure-flags _)
+          #~(#$(if (%current-target-system)
+                   #~quasiquote
+                   #~quote)
+             ;; These options are required for cross-compiling LLVM according to
+             ;; https://llvm.org/docs/HowToCrossCompileLLVM.html.
+             (#$@(if (%current-target-system)
+                     #~(,(string-append "-DLLVM_TABLEGEN="
+                                        #+(file-append this-package
+                                                       "/bin/llvm-tblgen"))
+                        #$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
+                                         (%current-target-system))
+                        #$(string-append "-DLLVM_TARGET_ARCH="
+                                         (system->llvm-target))
+                        #$(string-append "-DLLVM_TARGETS_TO_BUILD="
+                                         (system->llvm-target)))
+                     #~())
+              "-DCMAKE_SKIP_BUILD_RPATH=FALSE"
+              "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
+              "-DBUILD_SHARED_LIBS:BOOL=TRUE"
+              "-DLLVM_ENABLE_FFI:BOOL=TRUE"
+              "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities
+              "-DLLVM_INSTALL_UTILS=ON")))))))) ; Needed for rustc.
 
 (define-public clang-runtime-9
   (clang-runtime-from-llvm
-- 
2.37.0





This bug report was last modified 2 years and 330 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.