GNU bug report logs - #54052
[PATCH] gnu: cgdb: Add gdb to propagated-inputs

Previous Next

Package: guix-patches;

Reported by: Chadwain Holness <chadwainholness <at> gmail.com>

Date: Fri, 18 Feb 2022 05:20:01 UTC

Severity: normal

Tags: moreinfo, patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54052 in the body.
You can then email your comments to 54052 AT debbugs.gnu.org in the normal way.

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

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


Report forwarded to guix-patches <at> gnu.org:
bug#54052; Package guix-patches. (Fri, 18 Feb 2022 05:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chadwain Holness <chadwainholness <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 18 Feb 2022 05:20:02 GMT) Full text and rfc822 format available.

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

From: Chadwain Holness <chadwainholness <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Chadwain Holness <chadwainholness <at> gmail.com>
Subject: [PATCH] gnu: cgdb: Add gdb to propagated-inputs
Date: Fri, 18 Feb 2022 00:20:05 -0500
* gnu/packages/debug.scm (cgdb)[propagated-inputs]: Add gdb
---
 gnu/packages/debug.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index 24d17d95b0..89629e4aca 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -763,6 +763,8 @@ (define-public cgdb
      (list ncurses readline))
     (native-inputs
      (list flex texinfo))
+    (propagated-inputs
+     (list gdb))
     (home-page "https://cgdb.github.io")
     (synopsis "Console front-end to the GNU debugger")
     (description
-- 
2.35.1





Information forwarded to guix-patches <at> gnu.org:
bug#54052; Package guix-patches. (Fri, 18 Feb 2022 07:57:01 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: Chadwain Holness <chadwainholness <at> gmail.com>, 54052 <at> debbugs.gnu.org
Subject: Re: [bug#54052] [PATCH] gnu: cgdb: Add gdb to propagated-inputs
Date: Fri, 18 Feb 2022 08:56:46 +0100
[Message part 1 (text/plain, inline)]
Chadwain Holness schreef op vr 18-02-2022 om 00:20 [-0500]:
> +    (propagated-inputs
> +     (list gdb))

Propagation can lead to slower profile build times and propagation
conflicts.  Can it be depropagated by substituting 'gdb' with the
/gnu/store/... name?  (Look for "gdb" in fork_util.cpp and
'substitute*' from (guix build utils).)

Also, looking at the source code, I see "/bin/sh", can it also be
replaced?

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54052; Package guix-patches. (Sun, 20 Feb 2022 08:21:02 GMT) Full text and rfc822 format available.

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

From: Chadwain Holness <chadwainholness <at> gmail.com>
To: 54052 <at> debbugs.gnu.org,
	maximedevos <at> telenet.be
Cc: Chadwain Holness <chadwainholness <at> gmail.com>
Subject: Re: [bug#54052] [PATCH] gnu: cgdb: Add gdb to propagated-inputs
Date: Sun, 20 Feb 2022 03:11:56 -0500
Hello Maxime, thank you for the suggestion. Is this new patch better in your opinion?

* gnu/packages/debug.scm (cgdb)[inputs]: Add gdb
[arguments]: Add phase to fix hardcoded gdb and sh paths
---
 gnu/packages/debug.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index 24d17d95b0..85003feeae 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -760,9 +760,19 @@ (define-public cgdb
         (base32 "1w8ib2vg3pg68d9hh97fw5042c73i9nqavdddc87n9bpscjbaf0d"))))
     (build-system gnu-build-system)
     (inputs
-     (list ncurses readline))
+     (list ncurses readline gdb))
     (native-inputs
      (list flex texinfo))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+        (add-after 'unpack 'fix-paths
+         (lambda* (#:key inputs #:allow-other-keys)
+          (let ((gdb (assoc-ref inputs "gdb")))
+           (substitute* "lib/util/fork_util.cpp"
+            (("GDB = \"gdb\"") (string-append "GDB = \"" gdb "/bin/gdb\"")))
+           (substitute* "cgdb/cgdb.cpp"
+            (("/bin/sh") (which "sh")))))))))
     (home-page "https://cgdb.github.io")
     (synopsis "Console front-end to the GNU debugger")
     (description
-- 
2.35.1





Information forwarded to guix-patches <at> gnu.org:
bug#54052; Package guix-patches. (Sun, 20 Feb 2022 10:32:02 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: Chadwain Holness <chadwainholness <at> gmail.com>, 54052 <at> debbugs.gnu.org
Subject: Re: [bug#54052] [PATCH] gnu: cgdb: Add gdb to propagated-inputs
Date: Sun, 20 Feb 2022 11:30:52 +0100
[Message part 1 (text/plain, inline)]
Chadwain Holness schreef op zo 20-02-2022 om 03:11 [-0500]:
> Hello Maxime, thank you for the suggestion. Is this new patch better in your opinion?

It does look quite a bit better, but there's a cross-compilation
problem now: when cross-compiling, 'which' looks in the 'native-inputs'
instead of the 'inputs' (native-inputs = compiled for the architecture
the build is performed on, inputs = compiled for the architecture
'cgdb' will be run on).  You can use 'search-input-file' to solve this:

    (arguments
      (list
         #:phases
         #~(modify-phases %standard-phases
             (add-after 'unpack 'fix-paths
               (lambda* (#:key inputs #:allow-other-keys)
                 (define gdb (search-input-file inputs "bin/gdb"))
                 (define sh (search-input-file inputs "bin/sh"))
                 (substitute* "lib/util/fork_util.cpp"
                   (("GDB = \"gdb\"") (string-append "GDB = \"" gdb))
                   (("/bin/sh") sh)))))))

>      (inputs
> -     (list ncurses readline))
> +     (list ncurses readline gdb))

You are using a 'sh' from 'inputs' in 'fix-paths', so the package
'bash-minimal' needs to be included, otherwise the build would fail
when cross-compiling.

('bash-minimal' is an (implicit) native-input, so the build failure
would not happen when compiling natively).

To test whether cross-compiling cgdb works, you can try

  ./pre-inst-env guix build cgdb --target=aarch64-linux-gnu

(warning: this might build a cross-compiler toolchain first, which can
take quite some time, and possibly 'gdb' is not cross-compilable!)

Greetings,
Maxime.

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#54052; Package guix-patches. (Thu, 03 Mar 2022 22:25:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Chadwain Holness <chadwainholness <at> gmail.com>
Cc: Maxime Devos <maximedevos <at> telenet.be>, 54052 <at> debbugs.gnu.org
Subject: Re: bug#54052: [PATCH] gnu: cgdb: Add gdb to propagated-inputs
Date: Thu, 03 Mar 2022 23:24:46 +0100
Hi Chadwain,

Did you have a chance to look into this?

  https://issues.guix.gnu.org/54052

Thanks in advance!

Ludo’.

Maxime Devos <maximedevos <at> telenet.be> skribis:

> Chadwain Holness schreef op zo 20-02-2022 om 03:11 [-0500]:
>> Hello Maxime, thank you for the suggestion. Is this new patch better in your opinion?
>
> It does look quite a bit better, but there's a cross-compilation
> problem now: when cross-compiling, 'which' looks in the 'native-inputs'
> instead of the 'inputs' (native-inputs = compiled for the architecture
> the build is performed on, inputs = compiled for the architecture
> 'cgdb' will be run on).  You can use 'search-input-file' to solve this:
>
>     (arguments
>       (list
>          #:phases
>          #~(modify-phases %standard-phases
>              (add-after 'unpack 'fix-paths
>                (lambda* (#:key inputs #:allow-other-keys)
>                  (define gdb (search-input-file inputs "bin/gdb"))
>                  (define sh (search-input-file inputs "bin/sh"))
>                  (substitute* "lib/util/fork_util.cpp"
>                    (("GDB = \"gdb\"") (string-append "GDB = \"" gdb))
>                    (("/bin/sh") sh)))))))
>
>>      (inputs
>> -     (list ncurses readline))
>> +     (list ncurses readline gdb))
>
> You are using a 'sh' from 'inputs' in 'fix-paths', so the package
> 'bash-minimal' needs to be included, otherwise the build would fail
> when cross-compiling.
>
> ('bash-minimal' is an (implicit) native-input, so the build failure
> would not happen when compiling natively).
>
> To test whether cross-compiling cgdb works, you can try
>
>   ./pre-inst-env guix build cgdb --target=aarch64-linux-gnu
>
> (warning: this might build a cross-compiler toolchain first, which can
> take quite some time, and possibly 'gdb' is not cross-compilable!)
>
> Greetings,
> Maxime.




Added tag(s) moreinfo. Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 03 Mar 2022 22:26:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#54052; Package guix-patches. (Sun, 06 Mar 2022 06:33:02 GMT) Full text and rfc822 format available.

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

From: Chadwain Holness <chadwainholness <at> gmail.com>
To: 54052 <at> debbugs.gnu.org,
	ludo <at> gnu.org
Cc: Chadwain Holness <chadwainholness <at> gmail.com>
Subject: [PATCH] gnu: cgdb: Reference gdb
Date: Sun,  6 Mar 2022 01:24:36 -0500
Hello Ludovic,

I was able to compile cgdb natively and cross with the following patch.

Cheers,
Chadwain

* gnu/packages/debug.scm (cgdb)[inputs]: Add gdb, bash-minimal
[arguments]: Add phase to fix hardcoded gdb and sh paths
Add configure flags for cross-compilation
---
 gnu/packages/debug.scm | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index 24d17d95b0..63e5553484 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -760,9 +760,25 @@ (define-public cgdb
         (base32 "1w8ib2vg3pg68d9hh97fw5042c73i9nqavdddc87n9bpscjbaf0d"))))
     (build-system gnu-build-system)
     (inputs
-     (list ncurses readline))
+     (list bash-minimal ncurses readline gdb))
     (native-inputs
      (list flex texinfo))
+    (arguments
+     `(#:configure-flags
+        (list
+          (string-append "ac_cv_rl_version=" ,(package-version readline))
+          "ac_cv_file__dev_ptmx=no"
+          "ac_cv_file__proc_self_status=no"
+          "ac_cv_func_setpgrp_void=no")
+       #:phases
+       (modify-phases %standard-phases
+        (add-after 'unpack 'fix-paths
+         (lambda* (#:key inputs #:allow-other-keys)
+          (let ((gdb (search-input-file inputs "bin/gdb"))
+                (sh (search-input-file inputs "bin/sh")))
+           (substitute* "lib/util/fork_util.cpp"
+            (("GDB = \"gdb\"") (string-append "GDB = \"" gdb "\"")))
+           (substitute* "cgdb/cgdb.cpp" (("/bin/sh") sh))))))))
     (home-page "https://cgdb.github.io")
     (synopsis "Console front-end to the GNU debugger")
     (description
-- 
2.35.1





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 06 Mar 2022 21:14:04 GMT) Full text and rfc822 format available.

Notification sent to Chadwain Holness <chadwainholness <at> gmail.com>:
bug acknowledged by developer. (Sun, 06 Mar 2022 21:14:04 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Chadwain Holness <chadwainholness <at> gmail.com>
Cc: 54052-done <at> debbugs.gnu.org
Subject: Re: bug#54052: [PATCH] gnu: cgdb: Add gdb to propagated-inputs
Date: Sun, 06 Mar 2022 22:13:44 +0100
Hi Chadwain,

Chadwain Holness <chadwainholness <at> gmail.com> skribis:

> Hello Ludovic,
>
> I was able to compile cgdb natively and cross with the following patch.
>
> Cheers,
> Chadwain
>
> * gnu/packages/debug.scm (cgdb)[inputs]: Add gdb, bash-minimal
> [arguments]: Add phase to fix hardcoded gdb and sh paths
> Add configure flags for cross-compilation

Perfect, applied!

Thanks,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 04 Apr 2022 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 137 days ago.

Previous Next


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