[PATCH] gnu: cgdb: Add gdb to propagated-inputs

  • Done
  • quality assurance status badge
Details
3 participants
  • Chadwain Holness
  • Ludovic Courtès
  • Maxime Devos
Owner
unassigned
Submitted by
Chadwain Holness
Severity
normal

Debbugs page

C
C
Chadwain Holness wrote on 17 Feb 2022 21:20
(address . guix-patches@gnu.org)(name . Chadwain Holness)(address . chadwainholness@gmail.com)
20220218052005.10687-1-chadwainholness@gmail.com
* gnu/packages/debug.scm (cgdb)[propagated-inputs]: Add gdb
---
gnu/packages/debug.scm | 2 ++
1 file changed, 2 insertions(+)

Toggle diff (15 lines)
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
M
M
Maxime Devos wrote on 17 Feb 2022 23:56
a311b3e466ea030ce2f4bb8f8887074c00e65526.camel@telenet.be
Chadwain Holness schreef op vr 18-02-2022 om 00:20 [-0500]:
Toggle quote (3 lines)
> +    (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.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYg9RPhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ob0AQCiH49u+LxZzdGrjFjvWFfE6H8d
v48jZcmQDrD2DrTqagD/Ym+lNbO/HBXLO/mVteZIj250973x2LYdyK1857M0JQo=
=suAf
-----END PGP SIGNATURE-----


C
C
Chadwain Holness wrote on 20 Feb 2022 00:11
(name . Chadwain Holness)(address . chadwainholness@gmail.com)
20220220081155.13053-1-chadwainholness@gmail.com
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(-)

Toggle diff (27 lines)
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
M
M
Maxime Devos wrote on 20 Feb 2022 02:30
d18c61c3127492333183362db9d50e25917b3d11.camel@telenet.be
Chadwain Holness schreef op zo 20-02-2022 om 03:11 [-0500]:
Toggle quote (2 lines)
> 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)))))))

Toggle quote (4 lines)
>      (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.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhIYXBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7pc7AP9IOFkM11nrNMn3wK8NwkZkH7/i
xRFUBsLaReQe0koORQD/cPYNlMyF63+mFv6+1g74yZasl96aLRZjSZ2m9nBGMgA=
=myRk
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 3 Mar 2022 14:24
Re: bug#54052: [PATCH] gnu: cgdb: Add gdb to propagated-inputs
(name . Chadwain Holness)(address . chadwainholness@gmail.com)
87mti6vfm9.fsf_-_@gnu.org
Hi Chadwain,

Did you have a chance to look into this?


Thanks in advance!

Ludo’.

Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (41 lines)
> 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.
L
L
Ludovic Courtès wrote on 3 Mar 2022 14:24
control message for bug #54052
(address . control@debbugs.gnu.org)
87lexqvfm1.fsf@gnu.org
tags 54052 + moreinfo
quit
C
C
Chadwain Holness wrote on 5 Mar 2022 22:24
[PATCH] gnu: cgdb: Reference gdb
(name . Chadwain Holness)(address . chadwainholness@gmail.com)
20220306062434.17898-1-chadwainholness@gmail.com
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(-)

Toggle diff (33 lines)
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
L
L
Ludovic Courtès wrote on 6 Mar 2022 13:13
Re: bug#54052: [PATCH] gnu: cgdb: Add gdb to propagated-inputs
(name . Chadwain Holness)(address . chadwainholness@gmail.com)(address . 54052-done@debbugs.gnu.org)
87v8wqkcmv.fsf_-_@gnu.org
Hi Chadwain,

Chadwain Holness <chadwainholness@gmail.com> skribis:

Toggle quote (11 lines)
> 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’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 54052@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 54052
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch