[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found
From: |
Denis 'GNUtoo' Carikli |
Subject: |
bug#54728: [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@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#54728: Valgrind not working out of the box due to stripped ld.so, Denis 'GNUtoo' Carikli, 2022/04/05
- bug#54728: Valgrind not working out of the box due to stripped ld.so, Ludovic Courtès, 2022/04/07
- bug#54728: Valgrind not working out of the box due to stripped ld.so, Denis 'GNUtoo' Carikli, 2022/04/14
- bug#54728: [PATCH 1/2] gnu: valgrind: impots: sort imports alphabetically, Denis 'GNUtoo' Carikli, 2022/04/14
- bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found,
Denis 'GNUtoo' Carikli <=
- bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found, Ludovic Courtès, 2022/04/15
- bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found, Denis 'GNUtoo' Carikli, 2022/04/25
- bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found, Maxime Devos, 2022/04/25
- bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found, Denis 'GNUtoo' Carikli, 2022/04/25
- bug#54728: [PATCH v2 1/2] gnu: valgrind: impots: sort imports alphabetically, Denis 'GNUtoo' Carikli, 2022/04/25
- bug#54728: [PATCH v2 2/2] gnu: valgrind: fix ld.so symbols not found, Denis 'GNUtoo' Carikli, 2022/04/25
- bug#54728: [PATCH v2 2/2] gnu: valgrind: fix ld.so symbols not found, Denis 'GNUtoo' Carikli, 2022/04/26