Package: guix;
Reported by: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
Date: Tue, 5 Apr 2022 15:01:02 UTC
Severity: normal
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 54728 in the body.
You can then email your comments to 54728 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
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Tue, 05 Apr 2022 15:01:02 GMT) Full text and rfc822 format available.Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
:bug-guix <at> gnu.org
.
(Tue, 05 Apr 2022 15:01:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> To: bug-guix <at> gnu.org Subject: Valgrind not working out of the box due to stripped ld.so Date: Tue, 5 Apr 2022 17:01:32 +0200
[Message part 1 (text/plain, inline)]
Hi, The fact that Valgrind doesn't work out of the box seems to already be known[1] but I didn't find any bugreports on it. The workaround[1] mentioned is extremely useful but it's far from ideal. For instance if you have a software that uses Valgrind in its tests (for instance in 'make check') you end up having to add something like that in the native-inputs to refer to the right glibc debug symbols directory: > ("libc:debug", (@@ (gnu packages commencement) glibc-final) "debug") In my case I'm using guix and a guix.scm for testing the build of a library I maintain and I also wanted to automatically check for memory safety. I was helped a lot on #guix to solve the issue I had, and during that mjw suggested to fix the root issue by keeping "the .symtab in ld.so" without the full debug info (to save space) and if I understood right mjw is a valgrind contributor. According to mjw that could be done with strip -g or strip -d or -strip -S. Reference: ---------- [1]https://lists.gnu.org/archive/html/help-guix/2022-03/msg00036.html Denis.
[Message part 2 (application/pgp-signature, inline)]
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Thu, 07 Apr 2022 16:41:02 GMT) Full text and rfc822 format available.Message #8 received at 54728 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> Cc: 54728 <at> debbugs.gnu.org Subject: Re: bug#54728: Valgrind not working out of the box due to stripped ld.so Date: Thu, 07 Apr 2022 18:40:08 +0200
Hi, Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> skribis: > The fact that Valgrind doesn't work out of the box seems to already be > known[1] but I didn't find any bugreports on it. Indeed. Fixed in 6b6fb78724869c03394d0e6dc2f50f0777f6d467 on ‘core-updates’ as discussed with Mark (mjw) a couple of days ago on IRC. Unfortunately, until that branch is merge (most likely a few months from now), we’ll have to use the workaround you mentioned. Alternatively, maybe we could temporarily patch the ‘valgrind’ package such that it has ‘--extra-debuginfo-path=…’ by default. Would you like to give it a try? Thanks, Ludo’.
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Thu, 14 Apr 2022 23:26:01 GMT) Full text and rfc822 format available.Message #11 received at 54728 <at> debbugs.gnu.org (full text, mbox):
From: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 54728 <at> debbugs.gnu.org Subject: Re: bug#54728: Valgrind not working out of the box due to stripped ld.so Date: Fri, 15 Apr 2022 01:26:11 +0200
[Message part 1 (text/plain, inline)]
On Thu, 07 Apr 2022 18:40:08 +0200 Ludovic Courtès <ludo <at> gnu.org> wrote: > Hi, Hi, > Unfortunately, until that branch is merge (most likely a few months > from now), we’ll have to use the workaround you mentioned. > > Alternatively, maybe we could temporarily patch the ‘valgrind’ package > such that it has ‘--extra-debuginfo-path=…’ by default. Would you > like to give it a try? That is a good idea. As I need it anyway[1], I've actually worked on doing that through patching Valgrind source code to use better defaults than /usr/lib/debug but there is a couple of things I'm unsure with my patch: - First it works fine in 'guix shell -C' but it still fails in packages. Maybe I didn't patch the right Valgrind? - Then for some reasons guix style messes up the whitespaces with the following command: $ ./pre-inst-env guix style -e \ '(@@ (gnu packages valgrind) valgrind/interactive)'; So I did the style by hand instead, so it might contain mistakes. - And finally I'm not comfortable enough with Valgrind or how it's been used in Guix. As I understand from the comment in the first Valgrind being defined in valgrind.scm, it seems to be depended on by a lot of packages. In addition I've not looked why there is a valgrind/interactive or how it works yet, so someone would need to double check my patch carefuly. I've attached a libsamsung-ipc.scm file as I used that for testing my patch (in addition of just running Valgrind in a Guix shell container and while building this package it fails. I'll send the patch as a response to this mail. References: ----------- [1] At the end of the day I need it to work in both standalone mode and also in package builds as I use a guix.scm to run various compilation and runtime for libsamsung-ipc before pushing patches to the main branch. Denis.
[libsamsung-ipc.scm (text/x-scheme, attachment)]
[Message part 3 (application/pgp-signature, inline)]
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Thu, 14 Apr 2022 23:30:02 GMT) Full text and rfc822 format available.Message #14 received at 54728 <at> debbugs.gnu.org (full text, mbox):
From: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>, 54728 <at> debbugs.gnu.org Subject: [PATCH 1/2] gnu: valgrind: impots: sort imports alphabetically Date: Fri, 15 Apr 2022 01:30:11 +0200
* gnu/packages/valgrind.scm: sort imports alphabetically Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> --- gnu/packages/valgrind.scm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gnu/packages/valgrind.scm b/gnu/packages/valgrind.scm index 1cdc0f3b71..6648f17dfa 100644 --- a/gnu/packages/valgrind.scm +++ b/gnu/packages/valgrind.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2016, 2020, 2022 Efraim Flashner <efraim <at> flashner.co.il> ;;; Copyright © 2018 Tobias Geerinckx-Rice <me <at> tobias.gr> ;;; Copyright © 2020 Marius Bakke <marius <at> gnu.org> +;;; Copyright © 2022 Denis Carikli <GNUtoo <at> cyberdimension.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,13 +23,13 @@ ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (gnu packages valgrind) - #:use-module (guix packages) - #:use-module (guix download) #:use-module (guix build-system gnu) + #:use-module (guix download) #:use-module (guix licenses) + #:use-module (guix packages) + #:use-module (gnu packages) #:use-module (gnu packages gdb) - #:use-module (gnu packages perl) - #:use-module (gnu packages)) + #:use-module (gnu packages perl)) (define-public valgrind (package -- 2.35.1
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Thu, 14 Apr 2022 23:30:03 GMT) Full text and rfc822 format available.Message #17 received at 54728 <at> debbugs.gnu.org (full text, mbox):
From: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>, 54728 <at> debbugs.gnu.org Subject: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found Date: Fri, 15 Apr 2022 01:30:12 +0200
* gnu/packages/valgrind.scm (valgrind/interactive)[native-inputs]: Add libc:debug [arguments]: Add patch-default-debuginfo-path phase * gnu/packages/commencement.scm (glibc-final): Export variable. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> --- gnu/packages/commencement.scm | 2 +- gnu/packages/valgrind.scm | 66 +++++++++++++++++++++++++++++++---- 2 files changed, 61 insertions(+), 7 deletions(-) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index e8b47fbeab..c2de02411c 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -3381,7 +3381,7 @@ (define gettext-boot0 (("^PROGRAMS =.*$") "PROGRAMS =\n"))))))))) -(define glibc-final +(define-public glibc-final ;; The final glibc, which embeds the statically-linked Bash built above. ;; Use 'package/inherit' so we get the 'replacement' of 'glibc', if any. (package/inherit diff --git a/gnu/packages/valgrind.scm b/gnu/packages/valgrind.scm index 6648f17dfa..a09721071d 100644 --- a/gnu/packages/valgrind.scm +++ b/gnu/packages/valgrind.scm @@ -25,8 +25,10 @@ (define-module (gnu packages valgrind) #:use-module (guix build-system gnu) #:use-module (guix download) + #:use-module (guix gexp) #:use-module (guix licenses) #:use-module (guix packages) + #:use-module (guix utils) #:use-module (gnu packages) #:use-module (gnu packages gdb) #:use-module (gnu packages perl)) @@ -91,12 +93,64 @@ (define-public valgrind (properties '((hidden? . #t))))) (define-public valgrind/interactive - (package/inherit - valgrind - (inputs - ;; GDB is needed to provide a sane default for `--db-command'. - `(("gdb" ,gdb))) - (properties '()))) + (package/inherit valgrind + (inputs + ;; GDB is needed to provide a sane default for `--db-command'. + `(("gdb" ,gdb) + ("libc:debug" ,(@@ (gnu packages commencement) glibc-final) "debug"))) + (arguments + (substitute-keyword-arguments (package-arguments valgrind) + ((#:phases those-phases #~%standard-phases) + #~(let* ((those-phases #$those-phases) + (unpack (assoc-ref those-phases 'unpack))) + (modify-phases those-phases + (add-before 'build 'patch-default-debuginfo-path + (lambda _ + ;; This helps Valgrind find the debug symbols of ld.so. + ;; Without it, Valgrind does not work in a Guix shell + ;; container and cannot be used as-is during packages tests + ;; phases + (substitute* ' + ("coregrind/m_debuginfo/readelf.c" + "docs/xml/manual-core-adv.xml" + "docs/xml/manual-core.xml") + (("/usr/lib/debug") + (string-append + (assoc-ref %build-inputs "libc:debug") + "/lib/debug"))) + ;; We also need to account for the bigger path in + ;; the malloc-ed variables + (substitute* ' + ("coregrind/m_debuginfo/readelf.c") + (("VG_\\(strlen\\)\\(buildid\\) \\+ 33") + (string-append + "VG_(strlen)(buildid) + " + (number->string + (+ (string-length + (string-append + (assoc-ref %build-inputs "libc:debug") + "/lib/debug")) + (string-length "/.build-id//.debug") + 1))))) + (substitute* ' + ("coregrind/m_debuginfo/readelf.c") + ((string-append + "VG_\\(strlen\\)\\(objdir\\) \\+ " + "VG_\\(strlen\\)\\(debugname\\) \\+ 64") + (string-append + "VG_(strlen)(objdir) + VG_(strlen)(debugname) + " + (number->string + (+ (string-length + (string-append + (assoc-ref + %build-inputs + "libc:debug") + "/lib/debug")) + (string-length + "/usr/lib/debug") + 1))))) + #t))))))) + (properties '()))) (define-public valgrind-3.18 (package -- 2.35.1
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Fri, 15 Apr 2022 16:22:02 GMT) Full text and rfc822 format available.Message #20 received at 54728 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> Cc: 54728 <at> debbugs.gnu.org Subject: Re: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found Date: Fri, 15 Apr 2022 18:21:33 +0200
Hello! Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> skribis: > (define-public valgrind/interactive > - (package/inherit > - valgrind > - (inputs > - ;; GDB is needed to provide a sane default for `--db-command'. > - `(("gdb" ,gdb))) > - (properties '()))) > + (package/inherit valgrind > + (inputs > + ;; GDB is needed to provide a sane default for `--db-command'. > + `(("gdb" ,gdb) > + ("libc:debug" ,(@@ (gnu packages commencement) glibc-final) "debug"))) Rather: ("libc:debug" ,(canonical-package glibc) "debug"). > + (arguments > + (substitute-keyword-arguments (package-arguments valgrind) > + ((#:phases those-phases #~%standard-phases) > + #~(let* ((those-phases #$those-phases) > + (unpack (assoc-ref those-phases 'unpack))) > + (modify-phases those-phases > + (add-before 'build 'patch-default-debuginfo-path > + (lambda _ > + ;; This helps Valgrind find the debug symbols of ld.so. > + ;; Without it, Valgrind does not work in a Guix shell > + ;; container and cannot be used as-is during packages tests > + ;; phases > + (substitute* ' > + ("coregrind/m_debuginfo/readelf.c" > + "docs/xml/manual-core-adv.xml" > + "docs/xml/manual-core.xml") > + (("/usr/lib/debug") > + (string-append > + (assoc-ref %build-inputs "libc:debug") > + "/lib/debug"))) > + ;; We also need to account for the bigger path in > + ;; the malloc-ed variables > + (substitute* ' > + ("coregrind/m_debuginfo/readelf.c") > + (("VG_\\(strlen\\)\\(buildid\\) \\+ 33") > + (string-append > + "VG_(strlen)(buildid) + " > + (number->string > + (+ (string-length > + (string-append > + (assoc-ref %build-inputs "libc:debug") > + "/lib/debug")) > + (string-length "/.build-id//.debug") > + 1))))) > + (substitute* ' > + ("coregrind/m_debuginfo/readelf.c") > + ((string-append > + "VG_\\(strlen\\)\\(objdir\\) \\+ " > + "VG_\\(strlen\\)\\(debugname\\) \\+ 64") > + (string-append > + "VG_(strlen)(objdir) + VG_(strlen)(debugname) + " > + (number->string > + (+ (string-length > + (string-append > + (assoc-ref > + %build-inputs > + "libc:debug") > + "/lib/debug")) > + (string-length > + "/usr/lib/debug") > + 1))))) I find this patch-as-code snippet rather difficult to follow; it might also break easily if minor things change in those C files. How about making it an actual patch? In the patch, you’d have placeholders for the store file names, like @LIBC_DEBUG_DIRECTORY@; the phase would replace those placeholders with ‘substitute*’. How does that sound? Thanks, Ludo’.
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Mon, 25 Apr 2022 16:39:02 GMT) Full text and rfc822 format available.Message #23 received at 54728 <at> debbugs.gnu.org (full text, mbox):
From: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 54728 <at> debbugs.gnu.org Subject: Re: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found Date: Mon, 25 Apr 2022 18:39:09 +0200
[Message part 1 (text/plain, inline)]
On Fri, 15 Apr 2022 18:21:33 +0200 Ludovic Courtès <ludo <at> gnu.org> wrote: > Hello! Hi, [...] > I find this patch-as-code snippet rather difficult to follow; it might > also break easily if minor things change in those C files. > > How about making it an actual patch? In the patch, you’d have > placeholders for the store file names, like @LIBC_DEBUG_DIRECTORY@; > the phase would replace those placeholders with ‘substitute*’. Thanks, I've done that and now the code is much easier to read. > Rather: ("libc:debug" ,(canonical-package glibc) "debug"). The issue with that is that importing "gnu packages commencement" fails with the following error: > $ ./pre-inst-env guix build hello > error: tcc: unbound variable > hint: Did you forget a `use-modules' form? > > error: googletest: unbound variable > hint: Did you forget a `use-modules' form? > > error: bzip2: unbound variable > hint: Did you forget a `use-modules' form? > > error: binutils: unbound variable > hint: Did you forget a `use-modules' form? > > error: gcc-4.9: unbound variable > hint: Did you forget a `use-modules' form? > > error: xz: unbound variable > hint: Did you forget a `use-modules' form? > > error: gnu-make: unbound variable > hint: Did you forget a `use-modules' form? > > error: binutils: unbound variable > hint: Did you forget a `use-modules' form? > > error: perl: unbound variable > hint: Did you forget a `use-modules' form? > > error: coreutils: unbound variable > hint: Did you forget a `use-modules' form? > > Throw to key `unbound-variable' with args `("resolve-interface" "no > binding `~A' in module ~A" (python (gnu packages python)) #f)'. > Backtrace: In guix/store.scm: > 658:37 19 (thunk) > 1320:8 18 (call-with-build-handler #<procedure 995c6f0 at guix/u?> > ?) In guix/scripts/build.scm: > 499:2 17 (_) > In srfi/srfi-1.scm: > 673:15 16 (append-map _ _ . _) > 586:17 15 (map1 ((argument . "hello") (build-mode . 0) (# . #t) ?)) > In guix/scripts/build.scm: > 519:31 14 (_ _) > In gnu/packages.scm: > 480:2 13 (%find-package "hello" "hello" #f) > 365:6 12 (find-best-packages-by-name _ _) > 295:56 11 (_ "hello" _) > In unknown file: > 10 (force #<promise #<procedure 9a81870 at > gnu/packages.sc?>) In gnu/packages.scm: > 242:33 9 (fold-packages #<procedure b45e1e78 at gnu/packages.sc?> > ?) In guix/discovery.scm: > 159:11 8 (all-modules _ #:warn _) > In srfi/srfi-1.scm: > 460:18 7 (fold #<procedure 9814390 at guix/discovery.scm:143:8 ?> > ?) In guix/discovery.scm: > 149:19 6 (_ _ ()) > 116:5 5 (scheme-modules _ _ #:warn _) > In srfi/srfi-1.scm: > 691:23 4 (filter-map #<procedure 98142e0 at guix/discovery.sc?> . > #) In guix/discovery.scm: > 124:24 3 (_ . _) > In guix/ui.scm: > 319:2 2 (report-unbound-variable-error _ #:frame _) > In ice-9/boot-9.scm: > 1685:16 1 (raise-exception _ #:continuable? _) > 1685:16 0 (raise-exception _ #:continuable? _) > > ice-9/boot-9.scm:1685:16: In procedure raise-exception: > Throw to key `match-error' with args `("match" "no matching pattern" > (unbound-variable "resolve-interface" "no binding `~A' in module ~A" > (python (gnu packages python)) #f))'. So I need to not import gnu packages commencement globally. I can also do something like that instead: > ("glibc:debug" > ,((@@ (gnu packages commencement) canonical-package) > (@@ (gnu packages commencement) glibc)) "debug") Which form is the best? Beside the glibc:debug input, the new patch is ready to be sent. I also successfully managed to run tests that use valgrind transparently (by using valgrind/interactive in the native inputs). Denis.
[Message part 2 (application/pgp-signature, inline)]
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Mon, 25 Apr 2022 17:42:02 GMT) Full text and rfc822 format available.Message #26 received at 54728 <at> debbugs.gnu.org (full text, mbox):
From: Maxime Devos <maximedevos <at> telenet.be> To: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>, Ludovic Courtès <ludo <at> gnu.org> Cc: 54728 <at> debbugs.gnu.org Subject: Re: bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found Date: Mon, 25 Apr 2022 19:41:12 +0200
[Message part 1 (text/plain, inline)]
Denis 'GNUtoo' Carikli schreef op ma 25-04-2022 om 18:39 [+0200]: > The issue with that is that importing "gnu packages commencement" > fails > with the following error: This does not work (due to import cycles I think)? From (gnu packages commencement) ;;; To avoid circular dependencies, this module should not be imported ;;; directly from anywhere. Instead, try using the 'canonical-package' defined in (gnu packages base). Greetings, Maxime.
[signature.asc (application/pgp-signature, inline)]
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Tue, 26 Apr 2022 01:39:01 GMT) Full text and rfc822 format available.Message #29 received at 54728 <at> debbugs.gnu.org (full text, mbox):
From: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> To: 54728 <at> debbugs.gnu.org, ludo <at> gnu.org, maximedevos <at> telenet.be Subject: Re: bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found Date: Tue, 26 Apr 2022 03:39:11 +0200
Hi, I've now managed to make a proper patch. I've used 'v2' for more clarity. I'll send the files used to test them in a subsequent mails. As for the tests, I've done them in Guix system, once installed valgrind works fine: > $ make check > valgrind -v --leak-check=full ./main > ==20324== Memcheck, a memory error detector > ==20324== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. > ==20324== Using Valgrind-3.18.1-42b08ed5bd-20211015 and LibVEX; rerun with -h for copyright info > ==20324== Command: ./main > ==20324== > --20324-- Valgrind options: > --20324-- -v > --20324-- --leak-check=full > --20324-- Contents of /proc/version: > --20324-- Linux version 5.16.20-gnu (guix <at> guix) (gcc (GCC) 10.3.0, GNU ld (GNU Binutils) 2.37) #1 SMP PREEMPT 1 > --20324-- > --20324-- Arch and hwcaps: X86, LittleEndian, x86-mmxext-sse1-sse2-sse3 > --20324-- Page sizes: currently 4096, max supported 4096 > --20324-- Valgrind library directory: /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind > --20324-- Reading syms from /gnu/store/0iapawfss4xnxls622g23qpk4mwb9ihp-glibc-2.33/lib/ld-2.33.so > --20324-- Considering /gnu/store/wznq4d1i3znqjhcribfr2m9ljyyrsdyd-glibc-2.33-debug/lib/debug/gnu/store/0iapawfss4xnxls622g23qpk4mwb9ihp-glibc-2.33/lib/ld-2.33.so.debug .. > --20324-- .. CRC is valid > --20324-- Reading syms from /home/gnutoo/work/projects/guix/valgrind-test/main > --20324-- Reading syms from /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/memcheck-x86-linux > --20324-- object doesn't have a symbol table > --20324-- object doesn't have a dynamic symbol table > --20324-- Scheduler: using generic scheduler lock implementation. > --20324-- Reading suppressions file: /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/default.supp > ==20324== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-20324-by-gnutoo-on-??? > ==20324== embedded gdbserver: writing to /tmp/vgdb-pipe-to-vgdb-from-20324-by-gnutoo-on-??? > ==20324== embedded gdbserver: shared mem /tmp/vgdb-pipe-shared-mem-vgdb-20324-by-gnutoo-on-??? > ==20324== > ==20324== TO CONTROL THIS PROCESS USING vgdb (which you probably > ==20324== don't want to do, unless you know exactly what you're doing, > ==20324== or are doing some strange experiment): > ==20324== /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/../../bin/vgdb --pid=20324 ...command... > ==20324== > ==20324== TO DEBUG THIS PROCESS USING GDB: start GDB like this > ==20324== /path/to/gdb ./main > ==20324== and then give GDB the following command > ==20324== target remote | /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/../../bin/vgdb --pid=20324 > ==20324== --pid is optional if only one valgrind process is running > ==20324== > --20324-- REDIR: 0x4021570 (ld-linux.so.2:strlen) redirected to 0x580a1f4a (???) > --20324-- REDIR: 0x40212d0 (ld-linux.so.2:index) redirected to 0x580a1f25 (???) > --20324-- Reading syms from /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/vgpreload_core-x86-linux.so > --20324-- object doesn't have a symbol table > --20324-- Reading syms from /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/vgpreload_memcheck-x86-linux.so > --20324-- object doesn't have a symbol table > ==20324== WARNING: new redirection conflicts with existing -- ignoring it > --20324-- old: 0x04021570 (strlen ) R-> (0000.0) 0x580a1f4a ??? > --20324-- new: 0x04021570 (strlen ) R-> (2007.0) 0x04043ca0 strlen > --20324-- Reading syms from /gnu/store/r7n4snily34ld9nm4crzc0z65jr2y26c-gcc-10.3.0-lib/lib/libgcc_s.so.1 > --20324-- object doesn't have a symbol table > --20324-- Reading syms from /gnu/store/0iapawfss4xnxls622g23qpk4mwb9ihp-glibc-2.33/lib/libc-2.33.so > --20324-- Considering /gnu/store/wznq4d1i3znqjhcribfr2m9ljyyrsdyd-glibc-2.33-debug/lib/debug/gnu/store/0iapawfss4xnxls622g23qpk4mwb9ihp-glibc-2.33/lib/libc-2.33.so.debug .. > --20324-- .. CRC is valid > ==20324== WARNING: new redirection conflicts with existing -- ignoring it > --20324-- old: 0x040f08c0 (memalign ) R-> (1011.0) 0x04043084 memalign > --20324-- new: 0x040f08c0 (memalign ) R-> (1017.0) 0x0404303d aligned_alloc > ==20324== WARNING: new redirection conflicts with existing -- ignoring it > --20324-- old: 0x040f08c0 (memalign ) R-> (1011.0) 0x04043084 memalign > --20324-- new: 0x040f08c0 (memalign ) R-> (1017.0) 0x04042ff6 aligned_alloc > ==20324== WARNING: new redirection conflicts with existing -- ignoring it > --20324-- old: 0x040f08c0 (memalign ) R-> (1011.0) 0x04043084 memalign > --20324-- new: 0x040f08c0 (memalign ) R-> (1017.0) 0x0404303d aligned_alloc > ==20324== WARNING: new redirection conflicts with existing -- ignoring it > --20324-- old: 0x040f08c0 (memalign ) R-> (1011.0) 0x04043084 memalign > --20324-- new: 0x040f08c0 (memalign ) R-> (1017.0) 0x04042ff6 aligned_alloc > --20324-- REDIR: 0x40f49e0 (libc.so.6:strncasecmp) redirected to 0x40351e6 (_vgnU_ifunc_wrapper) > --20324-- REDIR: 0x40fa870 (libc.so.6:memrchr) redirected to 0x40351e6 (_vgnU_ifunc_wrapper) > --20324-- REDIR: 0x410df30 (libc.so.6:wcslen) redirected to 0x40351e6 (_vgnU_ifunc_wrapper) > --20324-- REDIR: 0x410d5c0 (libc.so.6:__GI_strrchr) redirected to 0x4043730 (__GI_strrchr) > --20324-- REDIR: 0x410da60 (libc.so.6:__GI_strlen) redirected to 0x4043c20 (__GI_strlen) > --20324-- REDIR: 0x40efb60 (libc.so.6:malloc) redirected to 0x403e5ae (malloc) > Hello world > --20324-- REDIR: 0x40f0190 (libc.so.6:free) redirected to 0x40409fc (free) > ==20324== > ==20324== HEAP SUMMARY: > ==20324== in use at exit: 0 bytes in 0 blocks > ==20324== total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated > ==20324== > ==20324== All heap blocks were freed -- no leaks are possible > ==20324== > ==20324== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 5) > --20324-- > --20324-- used_suppression: 5 dl-hack3-cond-1 /gnu/store/gkrqxqxs20mzxwxqpasy1q3w7a1v42w6-valgrind-3.18.1/libexec/valgrind/default.supp:1232 > ==20324== > ==20324== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 5) In addition it also works fine with either valgrind/interactive or valgrind-3.18 as dependency, when it is used in the tests of a package. I've used the 'make && ./pre-inst-env guix build -f libsamsung-ipc.scm' command for that (with a libsamsung-ipc.scm that is slightly modified since last time). Denis.
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Tue, 26 Apr 2022 01:39:02 GMT) Full text and rfc822 format available.Message #32 received at 54728 <at> debbugs.gnu.org (full text, mbox):
From: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> To: 54728 <at> debbugs.gnu.org, ludo <at> gnu.org, maximedevos <at> telenet.be Cc: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> Subject: [PATCH v2 1/2] gnu: valgrind: impots: sort imports alphabetically Date: Tue, 26 Apr 2022 03:39:12 +0200
* gnu/packages/valgrind.scm: sort imports alphabetically Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> --- gnu/packages/valgrind.scm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gnu/packages/valgrind.scm b/gnu/packages/valgrind.scm index 1cdc0f3b71..6648f17dfa 100644 --- a/gnu/packages/valgrind.scm +++ b/gnu/packages/valgrind.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2016, 2020, 2022 Efraim Flashner <efraim <at> flashner.co.il> ;;; Copyright © 2018 Tobias Geerinckx-Rice <me <at> tobias.gr> ;;; Copyright © 2020 Marius Bakke <marius <at> gnu.org> +;;; Copyright © 2022 Denis Carikli <GNUtoo <at> cyberdimension.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,13 +23,13 @@ ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (gnu packages valgrind) - #:use-module (guix packages) - #:use-module (guix download) #:use-module (guix build-system gnu) + #:use-module (guix download) #:use-module (guix licenses) + #:use-module (guix packages) + #:use-module (gnu packages) #:use-module (gnu packages gdb) - #:use-module (gnu packages perl) - #:use-module (gnu packages)) + #:use-module (gnu packages perl)) (define-public valgrind (package -- 2.35.1
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Tue, 26 Apr 2022 01:39:02 GMT) Full text and rfc822 format available.Message #35 received at 54728 <at> debbugs.gnu.org (full text, mbox):
From: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> To: 54728 <at> debbugs.gnu.org, ludo <at> gnu.org, maximedevos <at> telenet.be Cc: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> Subject: [PATCH v2 2/2] gnu: valgrind: fix ld.so symbols not found Date: Tue, 26 Apr 2022 03:39:13 +0200
* gnu/packages/valgrind.scm (valgrind/interactive)[native-inputs]: Add libc:debug [arguments]: Add patch-default-debuginfo-path phase [source]: Add patch. (valgrind-3.18)[source]: Add patch. * gnu/packages/commencement.scm (glibc-final): Export variable. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> --- gnu/local.mk | 3 +- gnu/packages/commencement.scm | 2 +- .../valgrind-fix-default-debuginfo-path.patch | 100 ++++++++++++++++++ gnu/packages/valgrind.scm | 67 +++++++++++- 4 files changed, 168 insertions(+), 4 deletions(-) create mode 100644 gnu/packages/patches/valgrind-fix-default-debuginfo-path.patch diff --git a/gnu/local.mk b/gnu/local.mk index 9bad87710c..c28efcab32 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1919,7 +1919,8 @@ dist_patch_DATA = \ %D%/packages/patches/util-linux-tests.patch \ %D%/packages/patches/util-linux-CVE-2021-3995.patch \ %D%/packages/patches/util-linux-CVE-2021-3996.patch \ - %D%/packages/patches/valgrind-enable-arm.patch \ + %D%/packages/patches/valgrind-enable-arm.patch \ + %D%/packages/patches/valgrind-fix-default-debuginfo-path.patch \ %D%/packages/patches/vboot-utils-fix-format-load-address.patch \ %D%/packages/patches/vboot-utils-fix-tests-show-contents.patch \ %D%/packages/patches/vboot-utils-skip-test-workbuf.patch \ diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 1fed8bcd6e..769139e779 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -3381,7 +3381,7 @@ (define gettext-boot0 (("^PROGRAMS =.*$") "PROGRAMS =\n"))))))))) -(define glibc-final +(define-public glibc-final ;; The final glibc, which embeds the statically-linked Bash built above. ;; Use 'package/inherit' so we get the 'replacement' of 'glibc', if any. (package/inherit diff --git a/gnu/packages/patches/valgrind-fix-default-debuginfo-path.patch b/gnu/packages/patches/valgrind-fix-default-debuginfo-path.patch new file mode 100644 index 0000000000..f78dec02dc --- /dev/null +++ b/gnu/packages/patches/valgrind-fix-default-debuginfo-path.patch @@ -0,0 +1,100 @@ +From a7f17b57a94e9cde6d7fa96ac86be5c4fc4f9211 Mon Sep 17 00:00:00 2001 +From: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> +Date: Sun, 24 Apr 2022 22:20:50 +0200 +Subject: [PATCH] valgrind: fix default debuginfo path + +Description: Workaround for missing symbol in Guix's ld.so. The + correct fix (not stripping all the ld.so symbols) will be done in the + next Guix release as it requires to recompile a lot of packages. + +Forwarded: not-needed +Bug-Guix: https://issues.guix.gnu.org/54728 +Author: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> +--- + coregrind/m_debuginfo/readelf.c | 11 ++++++----- + docs/xml/manual-core-adv.xml | 4 ++-- + docs/xml/manual-core.xml | 2 +- + 3 files changed, 9 insertions(+), 8 deletions(-) + +diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c +index c586e3f33..947fcc500 100644 +--- a/coregrind/m_debuginfo/readelf.c ++++ b/coregrind/m_debuginfo/readelf.c +@@ -1509,9 +1509,9 @@ DiImage* find_debug_file( struct _DebugInfo* di, + + if (buildid != NULL) { + debugpath = ML_(dinfo_zalloc)("di.fdf.1", +- VG_(strlen)(buildid) + 33); ++ VG_(strlen)(buildid) + DEBUGPATH_EXTRA_BYTES_1); + +- VG_(sprintf)(debugpath, "/usr/lib/debug/.build-id/%c%c/%s.debug", ++ VG_(sprintf)(debugpath, "DEFAULT_DEBUGINFO_PATH/.build-id/%c%c/%s.debug", + buildid[0], buildid[1], buildid + 2); + + dimg = open_debug_file(debugpath, buildid, 0, rel_ok, NULL); +@@ -1536,7 +1536,8 @@ DiImage* find_debug_file( struct _DebugInfo* di, + + debugpath = ML_(dinfo_zalloc)( + "di.fdf.3", +- VG_(strlen)(objdir) + VG_(strlen)(debugname) + 64 ++ VG_(strlen)(objdir) + VG_(strlen)(debugname) ++ + VG_(strlen)("DEFAULT_DEBUGINFO_PATH/") + 1 + + (extrapath ? VG_(strlen)(extrapath) : 0) + + (serverpath ? VG_(strlen)(serverpath) : 0)); + +@@ -1561,7 +1562,7 @@ DiImage* find_debug_file( struct _DebugInfo* di, + + TRY_OBJDIR_USRMERGE_OBJDIR("%s/%s"); + TRY_OBJDIR_USRMERGE_OBJDIR("%s/.debug/%s"); +- TRY_OBJDIR_USRMERGE_OBJDIR("/usr/lib/debug%s/%s"); ++ TRY_OBJDIR_USRMERGE_OBJDIR("DEFAULT_DEBUGINFO_PATH%s/%s"); + + if (extrapath) { + TRY_OBJDIR("%s%s/%s", extrapath, objdir, debugname); +@@ -1631,7 +1632,7 @@ DiImage* find_debug_file_ad_hoc( const DebugInfo* di, + + debugpath = ML_(dinfo_zalloc)( + "di.fdfah.3", +- VG_(strlen)(objdir) + 64 ++ VG_(strlen)(objdir) + DEBUGPATH_EXTRA_BYTES_2 + + (extrapath ? VG_(strlen)(extrapath) : 0) + + (serverpath ? VG_(strlen)(serverpath) : 0)); + +diff --git a/docs/xml/manual-core-adv.xml b/docs/xml/manual-core-adv.xml +index 1fa801edc..a7c01d5e6 100644 +--- a/docs/xml/manual-core-adv.xml ++++ b/docs/xml/manual-core-adv.xml +@@ -447,7 +447,7 @@ Valgrind embedded gdbserver:</para> + Remote debugging using | vgdb + relaying data between gdb and process 2418 + Reading symbols from /lib/ld-linux.so.2...done. +-Reading symbols from /usr/lib/debug/lib/ld-2.11.2.so.debug...done. ++Reading symbols from DEFAULT_DEBUGINFO_PATH/lib/ld-2.11.2.so.debug...done. + Loaded symbols for /lib/ld-linux.so.2 + [Switching to Thread 2418] + 0x001f2850 in _start () from /lib/ld-linux.so.2 +@@ -475,7 +475,7 @@ Remote communication error: Resource temporarily unavailable. + Remote debugging using | vgdb --pid=2479 + relaying data between gdb and process 2479 + Reading symbols from /lib/ld-linux.so.2...done. +-Reading symbols from /usr/lib/debug/lib/ld-2.11.2.so.debug...done. ++Reading symbols from DEFAULT_DEBUGINFO_PATH/lib/ld-2.11.2.so.debug...done. + Loaded symbols for /lib/ld-linux.so.2 + [Switching to Thread 2479] + 0x001f2850 in _start () from /lib/ld-linux.so.2 +diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml +index dc33e1269..f6eb60086 100644 +--- a/docs/xml/manual-core.xml ++++ b/docs/xml/manual-core.xml +@@ -1409,7 +1409,7 @@ that can report errors, e.g. Memcheck, but not Cachegrind.</para> + <listitem> + <para>By default Valgrind searches in several well-known paths + for debug objects, such +- as <computeroutput>/usr/lib/debug/</computeroutput>.</para> ++ as <computeroutput>DEFAULT_DEBUGINFO_PATH/</computeroutput>.</para> + + <para>However, there may be scenarios where you may wish to put + debug objects at an arbitrary location, such as external storage +-- +2.35.1 + diff --git a/gnu/packages/valgrind.scm b/gnu/packages/valgrind.scm index 6648f17dfa..1269e07593 100644 --- a/gnu/packages/valgrind.scm +++ b/gnu/packages/valgrind.scm @@ -25,9 +25,12 @@ (define-module (gnu packages valgrind) #:use-module (guix build-system gnu) #:use-module (guix download) + #:use-module (guix gexp) #:use-module (guix licenses) #:use-module (guix packages) + #:use-module (guix utils) #:use-module (gnu packages) + #:use-module (gnu packages base) #:use-module (gnu packages gdb) #:use-module (gnu packages perl)) @@ -93,9 +96,68 @@ (define-public valgrind (define-public valgrind/interactive (package/inherit valgrind + (version "3.17.0") + (source (origin + (method url-fetch) + (uri (list (string-append "https://sourceware.org/pub/valgrind" + "/valgrind-" version ".tar.bz2") + (string-append "ftp://sourceware.org/pub/valgrind" + "/valgrind-" version ".tar.bz2"))) + (sha256 + (base32 + "18l5jbk301j3462gipqn9bkfx44mdmwn0pwr73r40gl1irkfqfmd")) + (patches (search-patches + "valgrind-enable-arm.patch" + "valgrind-fix-default-debuginfo-path.patch")))) (inputs ;; GDB is needed to provide a sane default for `--db-command'. - `(("gdb" ,gdb))) + `(("gdb" ,gdb) + ("glibc:debug" ,(canonical-package glibc) "debug"))) + (arguments + (substitute-keyword-arguments (package-arguments valgrind) + ((#:phases those-phases #~%standard-phases) + #~(let* ((those-phases #$those-phases) + (unpack (assoc-ref those-phases 'unpack))) + (modify-phases + those-phases + (add-before 'configure 'patch-default-debuginfo-path + (lambda _ + ;; This helps Valgrind find the debug symbols of ld.so. + ;; Without it, Valgrind does not work in a Guix shell + ;; container and cannot be used as-is during packages tests + ;; phases + (substitute* ' + ("coregrind/m_debuginfo/readelf.c" + "docs/xml/manual-core-adv.xml" + "docs/xml/manual-core.xml") + (("DEFAULT_DEBUGINFO_PATH") + (string-append (assoc-ref %build-inputs "glibc:debug") + "/lib/debug"))) + ;; We also need to account for the bigger path in + ;; the malloc-ed variables + (substitute* ' + ("coregrind/m_debuginfo/readelf.c") + (("DEBUGPATH_EXTRA_BYTES_1") + (number->string + (+ (string-length + (string-append + (assoc-ref %build-inputs "glibc:debug") + "/lib/debug")) + (string-length "/.build-id//.debug") + 1)))) + (substitute* ' + ("coregrind/m_debuginfo/readelf.c") + (("DEBUGPATH_EXTRA_BYTES_2") + (number->string + (+ (string-length + (string-append + (assoc-ref + %build-inputs + "glibc:debug") + "/lib/debug")) + (string-length + "/usr/lib/debug") + 1))))))))))) (properties '()))) (define-public valgrind-3.18 @@ -111,4 +173,5 @@ (define-public valgrind-3.18 (sha256 (base32 "1xgph509i6adv9w2glviw3xrmlz0dssg8992hbvxsbkp7ahrm180")) - (patches (search-patches "valgrind-enable-arm.patch")))))) + (patches (search-patches "valgrind-enable-arm.patch" + "valgrind-fix-default-debuginfo-path.patch")))))) -- 2.35.1
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Tue, 26 Apr 2022 22:37:02 GMT) Full text and rfc822 format available.Message #38 received at 54728 <at> debbugs.gnu.org (full text, mbox):
From: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> To: 54728 <at> debbugs.gnu.org, ludo <at> gnu.org, maximedevos <at> telenet.be Subject: Re: [PATCH v2 2/2] gnu: valgrind: fix ld.so symbols not found Date: Wed, 27 Apr 2022 00:37:17 +0200
[Message part 1 (text/plain, inline)]
For some reasons I didn't receive a copy of the cover letter patch I sent with git-send-email yet, so I can't reply to the cover letter, so I'm replying to the patch instead. In any case the patches and the cover letter are in the bug[1] report and so as promised here's the libsamsung-ipc.scm I used for the tests. References: ----------- [1]https://issues.guix.gnu.org/54728#8 Denis.
[libsamsung-ipc.scm (text/x-scheme, attachment)]
[Message part 3 (application/pgp-signature, inline)]
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Fri, 06 May 2022 20:16:01 GMT) Full text and rfc822 format available.Message #41 received at 54728 <at> debbugs.gnu.org (full text, mbox):
From: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> To: 54728 <at> debbugs.gnu.org, ludo <at> gnu.org, maximedevos <at> telenet.be Subject: Re: [PATCH v2 2/2] gnu: valgrind: fix ld.so symbols not found Date: Fri, 6 May 2022 22:16:22 +0200
[Message part 1 (text/plain, inline)]
Hi, Did you manage to receive the patches, or were they lost somehow[1]? At least I see them on https://issues.guix.gnu.org/54728 . References: ----------- [1]Personally for some reason I didn't receive a copy of the patches I sent through git-send-email in my mail. Denis.
[Message part 2 (application/pgp-signature, inline)]
bug-guix <at> gnu.org
:bug#54728
; Package guix
.
(Fri, 06 May 2022 20:21:01 GMT) Full text and rfc822 format available.Message #44 received at 54728 <at> debbugs.gnu.org (full text, mbox):
From: Maxime Devos <maximedevos <at> telenet.be> To: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>, 54728 <at> debbugs.gnu.org, ludo <at> gnu.org Subject: Re: [PATCH v2 2/2] gnu: valgrind: fix ld.so symbols not found Date: Fri, 06 May 2022 22:20:18 +0200
[Message part 1 (text/plain, inline)]
Denis 'GNUtoo' Carikli schreef op vr 06-05-2022 om 22:16 [+0200]: > Hi, > > Did you manage to receive the patches, or were they lost somehow[1]? > > At least I see them on https://issues.guix.gnu.org/54728 . > I've received ‘https://issues.guix.gnu.org/54728#11’ (at least, received it now, via issues.guix.gnu.org) but this is way outside my expertise and I'm currently to busy for reviewing something like that. Greetings, Maxime.
[signature.asc (application/pgp-signature, inline)]
Ludovic Courtès <ludo <at> gnu.org>
:Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
:Message #49 received at 54728-done <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> Cc: 54728-done <at> debbugs.gnu.org, maximedevos <at> telenet.be Subject: Re: bug#54728: Valgrind not working out of the box due to stripped ld.so Date: Mon, 09 May 2022 11:24:44 +0200
[Message part 1 (text/plain, inline)]
Hi Denis, Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> skribis: > * gnu/packages/valgrind.scm (valgrind/interactive)[native-inputs]: > Add libc:debug > [arguments]: Add patch-default-debuginfo-path phase > [source]: Add patch. > (valgrind-3.18)[source]: Add patch. > > * gnu/packages/commencement.scm (glibc-final): Export variable. > > Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> I had lost track of it, so thanks for pinging. I’ve applied it and confirmed it works. I made the following cosmetic changes (patch below): • removing the ‘glibc-final’ export, which is unnecessary; • in phases, refer to the ‘inputs’ parameter rather than the ‘%build-inputs’ global variable (which is deprecated); • avoid repetition of (string-append (assoc-ref …) "/lib/debug"); • tweak indentation. Thanks! Ludo’.
[Message part 2 (text/x-patch, inline)]
diff --git a/gnu/packages/valgrind.scm b/gnu/packages/valgrind.scm index 1269e07593..0da011087c 100644 --- a/gnu/packages/valgrind.scm +++ b/gnu/packages/valgrind.scm @@ -95,83 +95,71 @@ (define-public valgrind (define-public valgrind/interactive (package/inherit - valgrind - (version "3.17.0") - (source (origin - (method url-fetch) - (uri (list (string-append "https://sourceware.org/pub/valgrind" - "/valgrind-" version ".tar.bz2") - (string-append "ftp://sourceware.org/pub/valgrind" - "/valgrind-" version ".tar.bz2"))) - (sha256 - (base32 - "18l5jbk301j3462gipqn9bkfx44mdmwn0pwr73r40gl1irkfqfmd")) - (patches (search-patches - "valgrind-enable-arm.patch" - "valgrind-fix-default-debuginfo-path.patch")))) - (inputs - ;; GDB is needed to provide a sane default for `--db-command'. - `(("gdb" ,gdb) - ("glibc:debug" ,(canonical-package glibc) "debug"))) - (arguments + valgrind + (version "3.17.0") + (source (origin + (method url-fetch) + (uri (list (string-append "https://sourceware.org/pub/valgrind" + "/valgrind-" version ".tar.bz2") + (string-append "ftp://sourceware.org/pub/valgrind" + "/valgrind-" version ".tar.bz2"))) + (sha256 + (base32 + "18l5jbk301j3462gipqn9bkfx44mdmwn0pwr73r40gl1irkfqfmd")) + (patches (search-patches + "valgrind-enable-arm.patch" + "valgrind-fix-default-debuginfo-path.patch")))) + (inputs + ;; GDB is needed to provide a sane default for `--db-command'. + `(("gdb" ,gdb) + ("glibc:debug" ,(canonical-package glibc) "debug"))) + (arguments (substitute-keyword-arguments (package-arguments valgrind) - ((#:phases those-phases #~%standard-phases) - #~(let* ((those-phases #$those-phases) - (unpack (assoc-ref those-phases 'unpack))) - (modify-phases - those-phases - (add-before 'configure 'patch-default-debuginfo-path - (lambda _ - ;; This helps Valgrind find the debug symbols of ld.so. - ;; Without it, Valgrind does not work in a Guix shell - ;; container and cannot be used as-is during packages tests - ;; phases - (substitute* ' - ("coregrind/m_debuginfo/readelf.c" - "docs/xml/manual-core-adv.xml" - "docs/xml/manual-core.xml") - (("DEFAULT_DEBUGINFO_PATH") - (string-append (assoc-ref %build-inputs "glibc:debug") - "/lib/debug"))) - ;; We also need to account for the bigger path in - ;; the malloc-ed variables - (substitute* ' - ("coregrind/m_debuginfo/readelf.c") - (("DEBUGPATH_EXTRA_BYTES_1") - (number->string - (+ (string-length - (string-append - (assoc-ref %build-inputs "glibc:debug") - "/lib/debug")) - (string-length "/.build-id//.debug") - 1)))) - (substitute* ' - ("coregrind/m_debuginfo/readelf.c") - (("DEBUGPATH_EXTRA_BYTES_2") - (number->string - (+ (string-length - (string-append - (assoc-ref - %build-inputs - "glibc:debug") - "/lib/debug")) - (string-length - "/usr/lib/debug") - 1))))))))))) - (properties '()))) + ((#:phases phases #~%standard-phases) + #~(modify-phases #$phases + (add-before 'configure 'patch-default-debuginfo-path + (lambda* (#:key inputs #:allow-other-keys) + ;; This helps Valgrind find the debug symbols of ld.so. + ;; Without it, Valgrind does not work in a Guix shell + ;; container and cannot be used as-is during packages tests + ;; phases. + ;; TODO: Remove on the next rebuild cycle, when libc is not + ;; longer fully stripped. + (define libc-debug + (string-append (assoc-ref inputs "glibc:debug") + "/lib/debug")) + + (substitute* '("coregrind/m_debuginfo/readelf.c" + "docs/xml/manual-core-adv.xml" + "docs/xml/manual-core.xml") + (("DEFAULT_DEBUGINFO_PATH") + libc-debug)) + ;; We also need to account for the bigger path in + ;; the malloc-ed variables. + (substitute* '("coregrind/m_debuginfo/readelf.c") + (("DEBUGPATH_EXTRA_BYTES_1") + (number->string + (+ (string-length libc-debug) + (string-length "/.build-id//.debug") + 1)))) + (substitute* '("coregrind/m_debuginfo/readelf.c") + (("DEBUGPATH_EXTRA_BYTES_2") + (number->string + (+ (string-length libc-debug) + (string-length "/usr/lib/debug") + 1)))))))))) + (properties '()))) (define-public valgrind-3.18 (package (inherit valgrind/interactive) (version "3.18.1") (source (origin - (method url-fetch) + (inherit (package-source valgrind/interactive)) (uri (list (string-append "https://sourceware.org/pub/valgrind" "/valgrind-" version ".tar.bz2") (string-append "ftp://sourceware.org/pub/valgrind" "/valgrind-" version ".tar.bz2"))) (sha256 (base32 - "1xgph509i6adv9w2glviw3xrmlz0dssg8992hbvxsbkp7ahrm180")) - (patches (search-patches "valgrind-enable-arm.patch" - "valgrind-fix-default-debuginfo-path.patch")))))) + "1xgph509i6adv9w2glviw3xrmlz0dssg8992hbvxsbkp7ahrm180"))))))
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Mon, 06 Jun 2022 11:24:08 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.