GNU bug report logs - #78102
[PATCH] gnu: Add redumper.

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Mon, 28 Apr 2025 02:50:04 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

To reply to this bug, email your comments to 78102 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to gabriel <at> erlikon.ch, guix-patches <at> gnu.org:
bug#78102; Package guix-patches. (Mon, 28 Apr 2025 02:50:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
New bug report received and forwarded. Copy sent to gabriel <at> erlikon.ch, guix-patches <at> gnu.org. (Mon, 28 Apr 2025 02:50:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH] gnu: Add redumper.
Date: Mon, 28 Apr 2025 11:49:01 +0900
* gnu/packages/audio.scm (redumper): New variable.

Change-Id: I3740c6941d1ab11ac38993775a8004618636513c
---
 gnu/packages/audio.scm | 71 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 03867b2da36..178818d1f68 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -126,6 +126,7 @@ (define-module (gnu packages audio)
   #:use-module (gnu packages music)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages networking)
+  #:use-module (gnu packages ninja)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
@@ -4082,6 +4083,76 @@ (define-public libshout-idjc
     ;; GNU Library (not Lesser) General Public License.
     (license license:lgpl2.0+)))
 
+(define-public redumper
+  (package
+    (name "redumper")
+    (version "561")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/superg/redumper")
+                    (commit (string-append "build_" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1r0wfi0fn3rq7s28p89rkgpgf567akd8z25l8r9sj7p4p3xp9m91"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:cmake cmake-next
+      #:build-type "Release"
+      ;; The build system uses CMake modules features that are only available
+      ;; when using Ninja.
+      #:configure-flags #~(list "-GNinja"
+                                "-DREDUMPER_CLANG_USE_LIBCPP=ON"
+                                (string-append "-DREDUMPER_VERSION_BUILD="
+                                               #$version)
+                                "-DCMAKE_BUILD_TYPE=Release")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
+            ;; The libcxx include/c++/v1 directory is not exposed via
+            ;; CPLUS_INCLUDE_PATH by default, causing errors like
+            ;; "fatal error: 'format' file not found".
+            (lambda* (#:key native-inputs inputs #:allow-other-keys)
+              (let ((gcc (assoc-ref (or native-inputs inputs) "gcc")))
+                (setenv "CPLUS_INCLUDE_PATH"
+                        (string-append
+                         (search-input-directory inputs
+                                                 "/include/c++/v1") ":"
+                         (getenv "CPLUS_INCLUDE_PATH"))))))
+          (replace 'build
+            (lambda* (#:key parallel-build? #:allow-other-keys)
+              (invoke "cmake" "--build" "."
+                      "-j" (number->string
+                            (if parallel-build?
+                                (parallel-job-count)
+                                1)))))
+          (replace 'check
+            (lambda* (#:key build-type parallel-tests? tests?
+                      #:allow-other-keys)
+              (when tests?
+                (invoke "ctest" "-C" build-type
+                        "-j" (number->string
+                              (if parallel-tests?
+                                  (parallel-job-count)
+                                  1))))))
+          (replace 'install
+            (lambda _
+              ;; There is no CMake install target; manually install the
+              ;; binary.
+              (install-file "redumper"
+                            (string-append #$output "/bin")))))))
+    (native-inputs (list ninja clang-toolchain-19))
+    (inputs (list libcxx))
+    (home-page "https://github.com/superg/redumper")
+    (synopsis "Low-level CD/DVD dumper")
+    (description "@command{redumper} is a low-level byte perfect CD disc
+dumper.  It supports incremental dumps, advanced SCSI/C2 repair, intelligent
+audio CD offset detection, among other features.  @command{redumper} is also a
+general purpose DVD/HD-DVD/Blu-ray disc dumper.")
+    (license license:gpl3+)))
+
 (define-public resample
   (package
     (name "resample")

base-commit: 56999614a45449c4b93c8614540210b609c2b356
-- 
2.49.0





Information forwarded to guix-patches <at> gnu.org:
bug#78102; Package guix-patches. (Tue, 29 Apr 2025 07:59:04 GMT) Full text and rfc822 format available.

Message #8 received at 78102 <at> debbugs.gnu.org (full text, mbox):

From: Gabriel Wicki <gabriel <at> erlikon.ch>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 78102 <at> debbugs.gnu.org
Subject: Re: [bug#78102] [PATCH] gnu: Add redumper.
Date: Tue, 29 Apr 2025 09:57:59 +0200
LGTM

but unfortunately the 'adjust-CPLUS_INCLUDE_PATH phase does not work in
cross-compilation context.  do you think it is possible to get this to
work?  that would be really awesome.

the error i'm getting says:
> error: in phase 'adjust-CPLUS_INCLUDE_PATH': uncaught exception:
> wrong-type-arg "string-append" "Wrong type (expecting ~A): ~S" ("string" #f) (#f) 

thanks for your time and effort!
g




Information forwarded to maxim.cournoyer <at> gmail.com, gabriel <at> erlikon.ch, guix-patches <at> gnu.org:
bug#78102; Package guix-patches. (Tue, 29 Apr 2025 15:33:06 GMT) Full text and rfc822 format available.

Message #11 received at 78102 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 78102 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v2 1/3] build/cmake: Add #:implicit-inputs? and
 #:implicit-cross-inputs? arguments.
Date: Wed, 30 Apr 2025 00:31:37 +0900
* guix/build-system/cmake.scm (lower) <#:implicit-inputs?>
<#:implicit-cross-inputs?>: New arguments.

Change-Id: I1f077f78f5836ce325827e7ef8d58ba554a8ed4f
---
 guix/build-system/cmake.scm | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm
index 9d757c0d061..8b1889e36bc 100644
--- a/guix/build-system/cmake.scm
+++ b/guix/build-system/cmake.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2013 Cyril Roelandt <tipecaml <at> gmail.com>
 ;;; Copyright © 2017 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2020 Efraim Flashner <efraim <at> flashner.co.il>
+;;; Copyright © 2025 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -65,12 +66,14 @@ (define (default-cmake target)
 
 (define* (lower name
                 #:key source inputs native-inputs outputs system target
+                (implicit-inputs? #t) (implicit-cross-inputs? #t)
                 (cmake (default-cmake target))
                 #:allow-other-keys
                 #:rest arguments)
   "Return a bag for NAME."
   (define private-keywords
     `(#:cmake #:inputs #:native-inputs
+      #:implicit-inputs? #:implicit-cross-inputs?
       ,@(if target '() '(#:target))))
 
   (bag
@@ -83,13 +86,15 @@ (define* (lower name
                     ,@`(("cmake" ,cmake))
                     ,@native-inputs
                     ,@(if target '() inputs)
-                    ,@(if target
+                    ,@(if (and target implicit-cross-inputs?)
                           ;; Use the standard cross inputs of
                           ;; 'gnu-build-system'.
                           (standard-cross-packages target 'host)
                           '())
                     ;; Keep the standard inputs of 'gnu-build-system'.
-                    ,@(standard-packages)))
+                    ,@(if implicit-inputs?
+                          (standard-packages system)
+                          '())))
     (host-inputs (if target inputs '()))
 
     ;; The cross-libc is really a target package, but for bootstrapping
@@ -97,7 +102,7 @@ (define* (lower name
     ;; native package, so it would end up using a "native" variant of
     ;; 'cross-libc' (built with 'gnu-build'), whereas all the other packages
     ;; would use a target variant (built with 'gnu-cross-build'.)
-    (target-inputs (if target
+    (target-inputs (if (and target implicit-cross-inputs?)
                        (standard-cross-packages target 'target)
                        '()))
     (outputs outputs)

base-commit: 2b4680c6c17bd6470f78a1f39d2f7af8b05e279f
-- 
2.49.0





Information forwarded to maxim.cournoyer <at> gmail.com, gabriel <at> erlikon.ch, guix-patches <at> gnu.org:
bug#78102; Package guix-patches. (Tue, 29 Apr 2025 15:33:07 GMT) Full text and rfc822 format available.

Message #14 received at 78102 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 78102 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v2 2/3] gnu: libcxx: Fix cross-compilation build.
Date: Wed, 30 Apr 2025 00:31:38 +0900
* gnu/packages/llvm.scm (libcxx) [arguments] <#:implicit-inputs?>: Set to #f.
<#:phases>: Remove adjust-CPLUS_INCLUDE_PATH.
[native-inputs]: Explicitly provide standard inputs, filtering out gcc.

Change-Id: I8cbc73ef90dce0a57bf2f8198c3176932bf24185
---
 gnu/packages/llvm.scm | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index a0f47447bee..49b6e27bff9 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -17,7 +17,7 @@
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul <at> autistici.org>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;; Copyright © 2021, 2022 Maxime Devos <maximedevos <at> telenet.be>
-;;; Copyright © 2020, 2021, 2022, 2024 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2020-2022, 2024-2025 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2021 Julien Lepiller <julien <at> lepiller.eu>
 ;;; Copyright © 2021 Lars-Dominik Braun <lars <at> 6xq.net>
 ;;; Copyright © 2021, 2022 Guillaume Le Vaillant <glv <at> posteo.net>
@@ -52,6 +52,7 @@ (define-module (gnu packages llvm)
   #:use-module (guix memoization)
   #:use-module (guix search-paths)
   #:use-module (guix utils)
+  #:use-module (guix build-system gnu)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system emacs)
   #:use-module (guix build-system python)
@@ -1905,6 +1906,7 @@ (define-public libcxx
     (build-system cmake-build-system)
     (arguments
      (list
+      #:implicit-inputs? #f             ;to avoid conflicting GCC headers
       #:tests? #f
       #:configure-flags
       #~(list "-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi;libunwind"
@@ -1920,23 +1922,14 @@ (define-public libcxx
       #~(modify-phases %standard-phases
           (add-after 'unpack 'enter-subdirectory
             (lambda _
-              (chdir "runtimes")))
-          (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
-            (lambda* (#:key inputs #:allow-other-keys)
-              (let ((gcc (assoc-ref inputs  "gcc")))
-                ;; Hide GCC's C++ headers so that they do not interfere with
-                ;; the ones we are attempting to build.
-                (setenv "CPLUS_INCLUDE_PATH"
-                        (string-join (delete (string-append gcc "/include/c++")
-                                             (string-split (getenv "CPLUS_INCLUDE_PATH")
-                                                           #\:))
-                                     ":"))
-                (format #t
-                        "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
-                        (getenv "CPLUS_INCLUDE_PATH"))
-                #t))))))
+              (chdir "runtimes"))))))
     (native-inputs
-     (list clang-19 libunwind-headers llvm python))
+     (append (list clang-19 libunwind-headers llvm python)
+             ;; Remove GCC from the build environment, to avoid its C++
+             ;; headers (include/c++), which would interfere and cause build
+             ;; failures.
+             (map second
+                  (alist-delete  "gcc" (standard-packages)))))
     (home-page "https://libcxx.llvm.org")
     (synopsis "C++ standard library")
     (description
-- 
2.49.0





Information forwarded to maxim.cournoyer <at> gmail.com, gabriel <at> erlikon.ch, guix-patches <at> gnu.org:
bug#78102; Package guix-patches. (Tue, 29 Apr 2025 15:35:03 GMT) Full text and rfc822 format available.

Message #17 received at 78102 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 78102 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v2 3/3] gnu: Add redumper.
Date: Wed, 30 Apr 2025 00:31:40 +0900
* gnu/packages/audio.scm (redumper): New variable.

Change-Id: I3740c6941d1ab11ac38993775a8004618636513c
---

I was not able to fix cross-compilation when using clang, as it fails
to detect the glibc library objects needed.  Here's an attempt:

       ;; The build system uses CMake modules features that are only available
       ;; when using Ninja.
-      #:configure-flags #~(list "-GNinja"
-                                "-DREDUMPER_CLANG_USE_LIBCPP=ON"
-                                (string-append "-DREDUMPER_VERSION_BUILD="
-                                               #$version)
-                                "-DCMAKE_BUILD_TYPE=Release")
+      #:configure-flags
+      #~(list "-GNinja"
+              "-DCMAKE_CXX_COMPILER=clang++"
+              #$@(if (%current-target-system)
+                     (list (string-append "-DCMAKE_CXX_COMPILER_TARGET="
+                                          (%current-target-system)))
+                     '())
+              "-DREDUMPER_CLANG_USE_LIBCPP=ON"
+              (string-append "-DREDUMPER_VERSION_BUILD="
+                             #$version)
+              "-DCMAKE_BUILD_TYPE=Release")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'patch-build-system

Which errors like:

Run Build Command(s): /gnu/store/w02489mcgfg5mj9z4c6nmnh3185v5xlv-ninja-1.11.1/bin/ninja -v cmTC_aa843
    [1/2] /gnu/store/dfi5zbk288grsj5xnxpcihyy235sb2zv-clang-toolchain-19.1.7/bin/clang++ --target=i686-linux-gnu    -MD -MT CMakeFiles/cmTC_aa843.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_aa843.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_aa843.dir/testCXXCompiler.cxx.o -c /tmp/guix-build-redumper-561.drv-0/build/CMakeFiles/CMakeScratch/TryCompile-he4ad3/testCXXCompiler.cxx
    [2/2] : && /gnu/store/dfi5zbk288grsj5xnxpcihyy235sb2zv-clang-toolchain-19.1.7/bin/clang++ --target=i686-linux-gnu   CMakeFiles/cmTC_aa843.dir/testCXXCompiler.cxx.o -o cmTC_aa843   && :
    FAILED: cmTC_aa843 
    : && /gnu/store/dfi5zbk288grsj5xnxpcihyy235sb2zv-clang-toolchain-19.1.7/bin/clang++ --target=i686-linux-gnu   CMakeFiles/cmTC_aa843.dir/testCXXCompiler.cxx.o -o cmTC_aa843   && :
    /gnu/store/m8nars4f5d5x0sfhdlz69nc5blfyym1q-binutils-cross-i686-linux-gnu-2.41/bin/i686-linux-gnu-ld: cannot find crtbeginS.o: No such file or directory
    /gnu/store/m8nars4f5d5x0sfhdlz69nc5blfyym1q-binutils-cross-i686-linux-gnu-2.41/bin/i686-linux-gnu-ld: cannot find -lstdc++: No such file or directory

 gnu/packages/audio.scm | 76 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 03867b2da36..3850b916ca5 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -126,6 +126,7 @@ (define-module (gnu packages audio)
   #:use-module (gnu packages music)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages networking)
+  #:use-module (gnu packages ninja)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
@@ -4082,6 +4083,81 @@ (define-public libshout-idjc
     ;; GNU Library (not Lesser) General Public License.
     (license license:lgpl2.0+)))
 
+(define-public redumper
+  (package
+    (name "redumper")
+    (version "561")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/superg/redumper")
+                    (commit (string-append "build_" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1r0wfi0fn3rq7s28p89rkgpgf567akd8z25l8r9sj7p4p3xp9m91"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:cmake cmake-next
+      #:build-type "Release"
+      ;; The build system uses CMake modules features that are only available
+      ;; when using Ninja.
+      #:configure-flags #~(list "-GNinja"
+                                "-DREDUMPER_CLANG_USE_LIBCPP=ON"
+                                (string-append "-DREDUMPER_VERSION_BUILD="
+                                               #$version)
+                                "-DCMAKE_BUILD_TYPE=Release")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-build-system
+            (lambda _
+              ;; The CMAKE_SYSTEM_VERSION is undefined when cross-compiling.
+              (substitute* "CMakeLists.txt"
+                (("\\$\\{CMAKE_SYSTEM_VERSION}")
+                 "\"${CMAKE_SYSTEM_VERSION}\""))))
+          (add-after 'unpack 'adjust-CPLUS_INCLUDE_PATH
+            ;; The libcxx include/c++/v1 directory is not exposed via
+            ;; CPLUS_INCLUDE_PATH by default, causing errors like
+            ;; "fatal error: 'format' file not found".
+            (lambda* (#:key native-inputs inputs #:allow-other-keys)
+              (setenv "CPLUS_INCLUDE_PATH"
+                      (string-append
+                       (search-input-directory inputs
+                                               "/include/c++/v1")
+                       ":" (getenv "CPLUS_INCLUDE_PATH")))))
+          (replace 'build
+            (lambda* (#:key parallel-build? #:allow-other-keys)
+              (invoke "cmake" "--build" "."
+                      "-j" (number->string
+                            (if parallel-build?
+                                (parallel-job-count)
+                                1)))))
+          (replace 'check
+            (lambda* (#:key build-type parallel-tests? tests?
+                      #:allow-other-keys)
+              (when tests?
+                (invoke "ctest" "-C" build-type
+                        "-j" (number->string
+                              (if parallel-tests?
+                                  (parallel-job-count)
+                                  1))))))
+          (replace 'install
+            (lambda _
+              ;; There is no CMake install target; manually install the
+              ;; binary.
+              (install-file "redumper"
+                            (string-append #$output "/bin")))))))
+    (native-inputs (list ninja clang-toolchain-19))
+    (inputs (list libcxx))
+    (home-page "https://github.com/superg/redumper")
+    (synopsis "Low-level CD/DVD dumper")
+    (description "@command{redumper} is a low-level byte perfect CD disc
+dumper.  It supports incremental dumps, advanced SCSI/C2 repair, intelligent
+audio CD offset detection, among other features.  @command{redumper} is also a
+general purpose DVD/HD-DVD/Blu-ray disc dumper.")
+    (license license:gpl3+)))
+
 (define-public resample
   (package
     (name "resample")
-- 
2.49.0





Information forwarded to guix-patches <at> gnu.org:
bug#78102; Package guix-patches. (Tue, 29 Apr 2025 15:38:02 GMT) Full text and rfc822 format available.

Message #20 received at 78102 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Gabriel Wicki <gabriel <at> erlikon.ch>
Cc: 78102 <at> debbugs.gnu.org
Subject: Re: [bug#78102] [PATCH] gnu: Add redumper.
Date: Wed, 30 Apr 2025 00:37:22 +0900
Hi,

Gabriel Wicki <gabriel <at> erlikon.ch> writes:

> LGTM

Thanks for the review.

> but unfortunately the 'adjust-CPLUS_INCLUDE_PATH phase does not work in
> cross-compilation context.  do you think it is possible to get this to
> work?  that would be really awesome.

The problem was cross-compiling libcxx, which I've now resolved (see the
v2 I just sent).

> the error i'm getting says:
>> error: in phase 'adjust-CPLUS_INCLUDE_PATH': uncaught exception:
>> wrong-type-arg "string-append" "Wrong type (expecting ~A): ~S" ("string" #f) (#f) 

Now we actually get to the cross-compilation of redumper, and it fails.
clang seems unable to locate what it needs from the glibc, as in this
bug report: <https://github.com/llvm/llvm-project/issues/72256>.

I'll punt on the cross-compilation part.  Let me know what you think of
the other changes in v2!

-- 
Thanks,
Maxim




Information forwarded to guix-patches <at> gnu.org:
bug#78102; Package guix-patches. (Tue, 29 Apr 2025 18:04:07 GMT) Full text and rfc822 format available.

Message #23 received at 78102 <at> debbugs.gnu.org (full text, mbox):

From: Gabriel Wicki <gabriel <at> erlikon.ch>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, code <at> greghogan.com
Cc: 78102 <at> debbugs.gnu.org
Subject: Re: [bug#78102] [PATCH] gnu: Add redumper.
Date: Tue, 29 Apr 2025 20:02:53 +0200
Hey Maxim and Greg

On Wed, Apr 30, 2025 at 12:37:22AM +0900, Maxim Cournoyer wrote:
> > but unfortunately the 'adjust-CPLUS_INCLUDE_PATH phase does not work in
> > cross-compilation context.  do you think it is possible to get this to
> > work?  that would be really awesome.
> 
> The problem was cross-compiling libcxx, which I've now resolved (see the
> v2 I just sent).
Looks good, though I must admit that reviewing changes in our cmake
build system is somewhat out of my realm - maybe some other devs want to
chime in on the issue (C++ team, maybe - I CC you, Greg, for that)?

> > the error i'm getting says:
> >> error: in phase 'adjust-CPLUS_INCLUDE_PATH': uncaught exception:
> >> wrong-type-arg "string-append" "Wrong type (expecting ~A): ~S" ("string" #f) (#f) 
> 
> Now we actually get to the cross-compilation of redumper, and it fails.
> clang seems unable to locate what it needs from the glibc, as in this
> bug report: <https://github.com/llvm/llvm-project/issues/72256>.
>
> I'll punt on the cross-compilation part.
So, IIUC, the bug may (hopefully) eventually be fixed by an upstream
clang version bump, since it seems to affect various cross-compilation
contexts and is not tied to our project?

Thanks for your time and effort!
g




Information forwarded to guix-patches <at> gnu.org:
bug#78102; Package guix-patches. (Tue, 29 Apr 2025 23:39:02 GMT) Full text and rfc822 format available.

Message #26 received at 78102 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Gabriel Wicki <gabriel <at> erlikon.ch>
Cc: 78102 <at> debbugs.gnu.org, code <at> greghogan.com
Subject: Re: [bug#78102] [PATCH] gnu: Add redumper.
Date: Wed, 30 Apr 2025 08:38:43 +0900
Hi Gabriel,

Gabriel Wicki <gabriel <at> erlikon.ch> writes:

[...]

>> The problem was cross-compiling libcxx, which I've now resolved (see the
>> v2 I just sent).
> Looks good, though I must admit that reviewing changes in our cmake
> build system is somewhat out of my realm - maybe some other devs want to
> chime in on the issue (C++ team, maybe - I CC you, Greg, for that)?

Note that, interestingly, this doesn't cause a world rebuild because the
change lives on the 'host' side and the default values means the same
usual inputs are used, which means the existing derivations don't
change.

>> > the error i'm getting says:
>> >> error: in phase 'adjust-CPLUS_INCLUDE_PATH': uncaught exception:
>> >> wrong-type-arg "string-append" "Wrong type (expecting ~A): ~S" ("string" #f) (#f) 
>> 
>> Now we actually get to the cross-compilation of redumper, and it fails.
>> clang seems unable to locate what it needs from the glibc, as in this
>> bug report: <https://github.com/llvm/llvm-project/issues/72256>.
>>
>> I'll punt on the cross-compilation part.
> So, IIUC, the bug may (hopefully) eventually be fixed by an upstream
> clang version bump, since it seems to affect various cross-compilation
> contexts and is not tied to our project?

That's my expectation, yes.

> Thanks for your time and effort!

No worries!  I'll wait a couple days for Greg to chime in, and otherwise
push.

-- 
Thanks,
Maxim




Information forwarded to guix-patches <at> gnu.org:
bug#78102; Package guix-patches. (Thu, 01 May 2025 16:10:02 GMT) Full text and rfc822 format available.

Message #29 received at 78102 <at> debbugs.gnu.org (full text, mbox):

From: Greg Hogan <code <at> greghogan.com>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: Gabriel Wicki <gabriel <at> erlikon.ch>, 78102 <at> debbugs.gnu.org
Subject: Re: [bug#78102] [PATCH v2 2/3] gnu: libcxx: Fix cross-compilation
 build.
Date: Thu, 1 May 2025 12:08:55 -0400
On Tue, Apr 29, 2025 at 11:33 AM Maxim Cournoyer
<maxim.cournoyer <at> gmail.com> wrote:
>
> * gnu/packages/llvm.scm (libcxx) [arguments] <#:implicit-inputs?>: Set to #f.
> <#:phases>: Remove adjust-CPLUS_INCLUDE_PATH.
> [native-inputs]: Explicitly provide standard inputs, filtering out gcc.
>
> Change-Id: I8cbc73ef90dce0a57bf2f8198c3176932bf24185
> ---
>  gnu/packages/llvm.scm | 27 ++++++++++-----------------
>  1 file changed, 10 insertions(+), 17 deletions(-)
>
> diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
> index a0f47447bee..49b6e27bff9 100644
> --- a/gnu/packages/llvm.scm
> +++ b/gnu/packages/llvm.scm
> @@ -17,7 +17,7 @@
>  ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul <at> autistici.org>
>  ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
>  ;;; Copyright © 2021, 2022 Maxime Devos <maximedevos <at> telenet.be>
> -;;; Copyright © 2020, 2021, 2022, 2024 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
> +;;; Copyright © 2020-2022, 2024-2025 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
>  ;;; Copyright © 2021 Julien Lepiller <julien <at> lepiller.eu>
>  ;;; Copyright © 2021 Lars-Dominik Braun <lars <at> 6xq.net>
>  ;;; Copyright © 2021, 2022 Guillaume Le Vaillant <glv <at> posteo.net>
> @@ -52,6 +52,7 @@ (define-module (gnu packages llvm)
>    #:use-module (guix memoization)
>    #:use-module (guix search-paths)
>    #:use-module (guix utils)
> +  #:use-module (guix build-system gnu)

Should we keep this build-system section sorted?

>    #:use-module (guix build-system cmake)
>    #:use-module (guix build-system emacs)
>    #:use-module (guix build-system python)
> @@ -1905,6 +1906,7 @@ (define-public libcxx
>      (build-system cmake-build-system)
>      (arguments
>       (list
> +      #:implicit-inputs? #f             ;to avoid conflicting GCC headers
>        #:tests? #f
>        #:configure-flags
>        #~(list "-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi;libunwind"
> @@ -1920,23 +1922,14 @@ (define-public libcxx
>        #~(modify-phases %standard-phases
>            (add-after 'unpack 'enter-subdirectory
>              (lambda _
> -              (chdir "runtimes")))
> -          (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
> -            (lambda* (#:key inputs #:allow-other-keys)
> -              (let ((gcc (assoc-ref inputs  "gcc")))
> -                ;; Hide GCC's C++ headers so that they do not interfere with
> -                ;; the ones we are attempting to build.
> -                (setenv "CPLUS_INCLUDE_PATH"
> -                        (string-join (delete (string-append gcc "/include/c++")
> -                                             (string-split (getenv "CPLUS_INCLUDE_PATH")
> -                                                           #\:))
> -                                     ":"))
> -                (format #t
> -                        "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
> -                        (getenv "CPLUS_INCLUDE_PATH"))
> -                #t))))))
> +              (chdir "runtimes"))))))
>      (native-inputs
> -     (list clang-19 libunwind-headers llvm python))
> +     (append (list clang-19 libunwind-headers llvm python)

Does this work to combine clang-19 with llvm-13?

> +             ;; Remove GCC from the build environment, to avoid its C++
> +             ;; headers (include/c++), which would interfere and cause build
> +             ;; failures.
> +             (map second

With the map are we not also dropping the package output as the third
field? So we wind up with a second "libc" but no "libc:static". It
might not matter here but this kind of trick is often copied into
additional packages. Can we use modify-inputs on standard-packages,
delete "gcc", and append the list of additional packages? Or revert to
the old-style inputs.

> +                  (alist-delete  "gcc" (standard-packages)))))

There is an extra space after alist-delete.

>      (home-page "https://libcxx.llvm.org")
>      (synopsis "C++ standard library")
>      (description
> --
> 2.49.0




Information forwarded to guix-patches <at> gnu.org:
bug#78102; Package guix-patches. (Thu, 01 May 2025 16:10:02 GMT) Full text and rfc822 format available.

Message #32 received at 78102 <at> debbugs.gnu.org (full text, mbox):

From: Greg Hogan <code <at> greghogan.com>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 78102 <at> debbugs.gnu.org, Gabriel Wicki <gabriel <at> erlikon.ch>
Subject: Re: [bug#78102] [PATCH] gnu: Add redumper.
Date: Thu, 1 May 2025 12:09:05 -0400
On Tue, Apr 29, 2025 at 7:38 PM Maxim Cournoyer
<maxim.cournoyer <at> gmail.com> wrote:
>
> Hi Gabriel,
>
> Gabriel Wicki <gabriel <at> erlikon.ch> writes:
>
> [...]
>
> >> The problem was cross-compiling libcxx, which I've now resolved (see the
> >> v2 I just sent).
> > Looks good, though I must admit that reviewing changes in our cmake
> > build system is somewhat out of my realm - maybe some other devs want to
> > chime in on the issue (C++ team, maybe - I CC you, Greg, for that)?
>
> Note that, interestingly, this doesn't cause a world rebuild because the
> change lives on the 'host' side and the default values means the same
> usual inputs are used, which means the existing derivations don't
> change.
>
> >> > the error i'm getting says:
> >> >> error: in phase 'adjust-CPLUS_INCLUDE_PATH': uncaught exception:
> >> >> wrong-type-arg "string-append" "Wrong type (expecting ~A): ~S" ("string" #f) (#f)
> >>
> >> Now we actually get to the cross-compilation of redumper, and it fails.
> >> clang seems unable to locate what it needs from the glibc, as in this
> >> bug report: <https://github.com/llvm/llvm-project/issues/72256>.
> >>
> >> I'll punt on the cross-compilation part.
> > So, IIUC, the bug may (hopefully) eventually be fixed by an upstream
> > clang version bump, since it seems to affect various cross-compilation
> > contexts and is not tied to our project?
>
> That's my expectation, yes.
>
> > Thanks for your time and effort!
>
> No worries!  I'll wait a couple days for Greg to chime in, and otherwise
> push.
>
> --
> Thanks,
> Maxim

This is fantastic. I had not come across implicit-inputs but I am now
using this to build clang-toolchain with an updated gcc.

I can't speak to the cross-compilation but have added some comments
(questions) on the libcxx patch.

Greg




Information forwarded to guix-patches <at> gnu.org:
bug#78102; Package guix-patches. (Fri, 02 May 2025 00:34:01 GMT) Full text and rfc822 format available.

Message #35 received at 78102 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Greg Hogan <code <at> greghogan.com>
Cc: Gabriel Wicki <gabriel <at> erlikon.ch>, 78102 <at> debbugs.gnu.org
Subject: Re: [bug#78102] [PATCH v2 2/3] gnu: libcxx: Fix cross-compilation
 build.
Date: Fri, 02 May 2025 09:33:22 +0900
Hi Greg,

Thanks for the review.

Greg Hogan <code <at> greghogan.com> writes:

[...]

>> @@ -52,6 +52,7 @@ (define-module (gnu packages llvm)
>>    #:use-module (guix memoization)
>>    #:use-module (guix search-paths)
>>    #:use-module (guix utils)
>> +  #:use-module (guix build-system gnu)
>
> Should we keep this build-system section sorted?

Definitely!  Done.

>>    #:use-module (guix build-system cmake)
>>    #:use-module (guix build-system emacs)
>>    #:use-module (guix build-system python)
>> @@ -1905,6 +1906,7 @@ (define-public libcxx
>>      (build-system cmake-build-system)
>>      (arguments
>>       (list
>> +      #:implicit-inputs? #f             ;to avoid conflicting GCC headers
>>        #:tests? #f
>>        #:configure-flags
>>        #~(list "-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi;libunwind"
>> @@ -1920,23 +1922,14 @@ (define-public libcxx
>>        #~(modify-phases %standard-phases
>>            (add-after 'unpack 'enter-subdirectory
>>              (lambda _
>> -              (chdir "runtimes")))
>> -          (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
>> -            (lambda* (#:key inputs #:allow-other-keys)
>> -              (let ((gcc (assoc-ref inputs  "gcc")))
>> -                ;; Hide GCC's C++ headers so that they do not interfere with
>> -                ;; the ones we are attempting to build.
>> -                (setenv "CPLUS_INCLUDE_PATH"
>> -                        (string-join (delete (string-append gcc "/include/c++")
>> -                                             (string-split (getenv "CPLUS_INCLUDE_PATH")
>> -                                                           #\:))
>> -                                     ":"))
>> -                (format #t
>> -                        "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
>> -                        (getenv "CPLUS_INCLUDE_PATH"))
>> -                #t))))))
>> +              (chdir "runtimes"))))))
>>      (native-inputs
>> -     (list clang-19 libunwind-headers llvm python))
>> +     (append (list clang-19 libunwind-headers llvm python)
>
> Does this work to combine clang-19 with llvm-13?

Good catch.  It worked, because both llvm and libunwind-headers appeared
to be extraneous inputs, which I've now removed.

>
>> +             ;; Remove GCC from the build environment, to avoid its C++
>> +             ;; headers (include/c++), which would interfere and cause build
>> +             ;; failures.
>> +             (map second
>
> With the map are we not also dropping the package output as the third
> field? So we wind up with a second "libc" but no "libc:static". It
> might not matter here but this kind of trick is often copied into
> additional packages. Can we use modify-inputs on standard-packages,
> delete "gcc", and append the list of additional packages? Or revert to
> the old-style inputs.

Good point, I've rewritten it to use modify-inputs.  I don't think we
should use old-style inputs in any case now.

>> +                  (alist-delete  "gcc" (standard-packages)))))
>
> There is an extra space after alist-delete.

Fixed!

Thanks again for the review!  I'll push shortly.

-- 
Thanks,
Maxim




Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Fri, 02 May 2025 01:24:02 GMT) Full text and rfc822 format available.

Notification sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
bug acknowledged by developer. (Fri, 02 May 2025 01:24:02 GMT) Full text and rfc822 format available.

Message #40 received at 78102-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Greg Hogan <code <at> greghogan.com>
Cc: Gabriel Wicki <gabriel <at> erlikon.ch>, 78102-done <at> debbugs.gnu.org
Subject: Re: [bug#78102] [PATCH] gnu: Add redumper.
Date: Fri, 02 May 2025 10:23:22 +0900
Hi Greg,

Greg Hogan <code <at> greghogan.com> writes:

[...]

> This is fantastic. I had not come across implicit-inputs but I am now
> using this to build clang-toolchain with an updated gcc.
>
> I can't speak to the cross-compilation but have added some comments
> (questions) on the libcxx patch.

Glad it will be useful outside of libcxx.  I wasn't sure of the added
value.  Thanks for your input!

I've now push this series, taking into account your comments about
libcxx; see commit 94593917394.

Thanks to both of you for the reviews!

-- 
Thanks,
Maxim




This bug report was last modified 22 days ago.

Previous Next


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