unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#54052] [PATCH] gnu: cgdb: Add gdb to propagated-inputs
@ 2022-02-18  5:20 Chadwain Holness
  2022-02-18  7:56 ` Maxime Devos
  0 siblings, 1 reply; 7+ messages in thread
From: Chadwain Holness @ 2022-02-18  5:20 UTC (permalink / raw)
  To: 54052; +Cc: Chadwain Holness

* 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





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#54052] [PATCH] gnu: cgdb: Add gdb to propagated-inputs
  2022-02-18  5:20 [bug#54052] [PATCH] gnu: cgdb: Add gdb to propagated-inputs Chadwain Holness
@ 2022-02-18  7:56 ` Maxime Devos
  2022-02-20  8:11   ` Chadwain Holness
  0 siblings, 1 reply; 7+ messages in thread
From: Maxime Devos @ 2022-02-18  7:56 UTC (permalink / raw)
  To: Chadwain Holness, 54052

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#54052] [PATCH] gnu: cgdb: Add gdb to propagated-inputs
  2022-02-18  7:56 ` Maxime Devos
@ 2022-02-20  8:11   ` Chadwain Holness
  2022-02-20 10:30     ` Maxime Devos
  0 siblings, 1 reply; 7+ messages in thread
From: Chadwain Holness @ 2022-02-20  8:11 UTC (permalink / raw)
  To: 54052, maximedevos; +Cc: Chadwain Holness

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





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#54052] [PATCH] gnu: cgdb: Add gdb to propagated-inputs
  2022-02-20  8:11   ` Chadwain Holness
@ 2022-02-20 10:30     ` Maxime Devos
  2022-03-03 22:24       ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Maxime Devos @ 2022-02-20 10:30 UTC (permalink / raw)
  To: Chadwain Holness, 54052

[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]

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.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#54052] [PATCH] gnu: cgdb: Add gdb to propagated-inputs
  2022-02-20 10:30     ` Maxime Devos
@ 2022-03-03 22:24       ` Ludovic Courtès
  2022-03-06  6:24         ` [bug#54052] [PATCH] gnu: cgdb: Reference gdb Chadwain Holness
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2022-03-03 22:24 UTC (permalink / raw)
  To: Chadwain Holness; +Cc: Maxime Devos, 54052

Hi Chadwain,

Did you have a chance to look into this?

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

Thanks in advance!

Ludo’.

Maxime Devos <maximedevos@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.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#54052] [PATCH] gnu: cgdb: Reference gdb
  2022-03-03 22:24       ` Ludovic Courtès
@ 2022-03-06  6:24         ` Chadwain Holness
  2022-03-06 21:13           ` bug#54052: [PATCH] gnu: cgdb: Add gdb to propagated-inputs Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Chadwain Holness @ 2022-03-06  6:24 UTC (permalink / raw)
  To: 54052, ludo; +Cc: Chadwain Holness

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





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#54052: [PATCH] gnu: cgdb: Add gdb to propagated-inputs
  2022-03-06  6:24         ` [bug#54052] [PATCH] gnu: cgdb: Reference gdb Chadwain Holness
@ 2022-03-06 21:13           ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2022-03-06 21:13 UTC (permalink / raw)
  To: Chadwain Holness; +Cc: 54052-done

Hi Chadwain,

Chadwain Holness <chadwainholness@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’.




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-03-06 21:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18  5:20 [bug#54052] [PATCH] gnu: cgdb: Add gdb to propagated-inputs Chadwain Holness
2022-02-18  7:56 ` Maxime Devos
2022-02-20  8:11   ` Chadwain Holness
2022-02-20 10:30     ` Maxime Devos
2022-03-03 22:24       ` Ludovic Courtès
2022-03-06  6:24         ` [bug#54052] [PATCH] gnu: cgdb: Reference gdb Chadwain Holness
2022-03-06 21:13           ` bug#54052: [PATCH] gnu: cgdb: Add gdb to propagated-inputs Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).