Message ID | 20220220081155.13053-1-chadwainholness@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [bug#54052] gnu: cgdb: Add gdb to propagated-inputs | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
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.
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.
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