From debbugs-submit-bounces@debbugs.gnu.org Mon May 09 05:24:54 2022 Received: (at 54728-done) by debbugs.gnu.org; 9 May 2022 09:24:54 +0000 Received: from localhost ([127.0.0.1]:56054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnzdO-0008Lc-3Z for submit@debbugs.gnu.org; Mon, 09 May 2022 05:24:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnzdM-0008LQ-8Q for 54728-done@debbugs.gnu.org; Mon, 09 May 2022 05:24:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnzdG-0000eJ-Fm; Mon, 09 May 2022 05:24:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=LdSs3hlsS4s2CapCb+tCqKwtzoUOoPuZhz37QFWpyJA=; b=TfEERsVdVm/una84upgn as3Y3RTAq+8va1atu2ltCfbdIdpBV08ENvAHYVfpk2IGVg8lGOOstp0gYcbSQYXFCVm10bduZPEzM KWeGz79ct5qBOM/PGHwL0OtI2ieSOSflY0IsaP50le+v8Vs3NR7l+EahmdzOtIXgs3KfbEgWsbkxM hLFfXqLtRK3Vw8qc7NBwCy3vAdbfKV43vBBeuMPFkrIInhNHDPCO+DCYr6EdRf74aQCnwYKql+18X oytxT1Yq8B1em8RpGeUUe73S00/ZPo5ZKQW7J/EZPgCC3gA9bO+ZSwNnlwfTUtuEmQwLpHwNlvTZu 8RKaRZt8ErxlsQ==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=44914 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnzdG-0007HF-2j; Mon, 09 May 2022 05:24:46 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Denis 'GNUtoo' Carikli Subject: Re: bug#54728: Valgrind not working out of the box due to stripped ld.so References: <2d69d3b032cea71f038fad9bacd7d060d323c110.camel@telenet.be> <20220426013913.20117-1-GNUtoo@cyberdimension.org> <20220426013913.20117-3-GNUtoo@cyberdimension.org> Date: Mon, 09 May 2022 11:24:44 +0200 In-Reply-To: <20220426013913.20117-3-GNUtoo@cyberdimension.org> (Denis Carikli's message of "Tue, 26 Apr 2022 03:39:13 +0200") Message-ID: <87czgnrrc3.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54728-done Cc: 54728-done@debbugs.gnu.org, maximedevos@telenet.be X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Denis, Denis 'GNUtoo' Carikli 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 I had lost track of it, so thanks for pinging. I=E2=80=99ve applied it and confirmed it works. I made the following cosme= tic changes (patch below): =E2=80=A2 removing the =E2=80=98glibc-final=E2=80=99 export, which is unn= ecessary; =E2=80=A2 in phases, refer to the =E2=80=98inputs=E2=80=99 parameter rath= er than the =E2=80=98%build-inputs=E2=80=99 global variable (which is deprecated); =E2=80=A2 avoid repetition of (string-append (assoc-ref =E2=80=A6) "/lib/= debug"); =E2=80=A2 tweak indentation. Thanks! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: 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")))))) --=-=-=--