unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 54728@debbugs.gnu.org
Subject: bug#54728: Valgrind not working out of the box due to stripped ld.so
Date: Fri, 15 Apr 2022 01:26:11 +0200	[thread overview]
Message-ID: <20220415012611.6edbf92c@primarylaptop.localdomain> (raw)
In-Reply-To: <87mtgwetjr.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 1899 bytes --]

On Thu, 07 Apr 2022 18:40:08 +0200
Ludovic Courtès <ludo@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.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: libsamsung-ipc.scm --]
[-- Type: text/x-scheme, Size: 4364 bytes --]

;;; Copyright © 2022 Denis Carikli <GNUtoo@cyberdimension.org>
;;;
;;; This file is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; This file is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License.
;;; If not, see <http://www.gnu.org/licenses/>.
;;;
;;; This file is meant to test valgrind support in Guix.
;;;
;;; The libsamsung-ipc library is not ready to be packaged in general
;;; purpose distributions as right now as it requires either a vendor
;;; kernel or the compbinaison of a recent upstream kernel with on top
;;; work in progress out of tree modem drivers, out of tree
;;; libsamsung-ipc code to support theses drivers and kernel patches
;;; to support the nonfree bootloader of the Galaxy SIII
;;; (GT-I9300). Beside the library, the tools are of very limited use
;;; beside testing or reverse engineering.

(use-modules
 (ice-9 popen)
 (ice-9 rdelim)
 (sxml ssax input-parse)
 ((guix licenses) #:prefix license:)
 (guix build-system android-ndk)
 (guix build-system gnu)
 (guix gexp)
 (guix git-download)
 (guix packages)
 (gnu packages android)
 (gnu packages autotools)
 (gnu packages commencement)
 (gnu packages curl)
 (gnu packages disk)
 (gnu packages linux)
 (gnu packages llvm)
 (gnu packages pkg-config)
 (gnu packages python)
 (gnu packages python-xyz)
 (gnu packages tls)
 (gnu packages valgrind))

(define-public libsamsung-ipc
  (package
    (name "libsamsung-ipc")
    ;; we use a work in progress version that has support for --with-valgrind-tests
    (version (git-version "0.0" "HEAD" "4d3062db15783c188d6952f7b9b794b65cd93f66"))
    (source
     (origin
       (method git-fetch)
       (uri
        (git-reference
         (url "https://git.replicant.us/replicant-next/hardware_replicant_libsamsung-ipc")
         (commit "4d3062db15783c188d6952f7b9b794b65cd93f66")))
       (sha256
        (base32 "1jzv9z5rkgcx394akf2svja586z54vhd46pvdmzm3ilmspnvjcdx"))
       (file-name (git-file-name name version))))
    (build-system gnu-build-system)
    (native-inputs
     `(("autoreconf" ,autoconf)
       ("aclocal" ,automake)
       ("libcurl" ,curl)
       ("ddrescue", ddrescue)
       ;; ("libc:debug", (@@ (gnu packages commencement) glibc-final) "debug")
       ("libtool" ,libtool)
       ("pkgconfig" ,pkg-config)
       ("python" ,python)
       ("python-sh" ,python-sh)
       ("valgrind" ,valgrind)))
    (inputs
     `(("openssl" ,openssl)))
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'build 'patch-python
           (lambda _
             (substitute* (find-files "." ".*\\.py$")
               (("/usr/bin/env python") (which "python3")))
           #t))
         (add-after 'patch-python 'fix-valgrind
           (lambda _
             (substitute* (find-files "." ".*\\.py$")
                          (("'--leak-check=full',")
                            "'-v', '--leak-check=full',"))
             #t))
         ;; (add-after 'patch-python 'fix-valgrind
         ;;   (lambda _
         ;;     (substitute* (find-files "." ".*\\.py$")
         ;;                  (("'--leak-check=full',")
         ;;                   (string-append
         ;;                    "'--leak-check=full', '--extra-debuginfo-path="
         ;;                    (assoc-ref %build-inputs "libc:debug")
         ;;                    "/lib/debug',")))
         ;;     #t))
	 )
       #:configure-flags
       (list "--enable-debug"
             "--enable-valgrind-tests")))
    (synopsis "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol")
    (description
     "libsamsung-ipc is a free software implementation of the Samsung IPC modem protocol,
found in many Samsung smartphones and tablets.")
    (home-page "https://www.replicant.us")
    (license license:gpl2+)))

(list libsamsung-ipc)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-04-14 23:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 15:01 bug#54728: Valgrind not working out of the box due to stripped ld.so Denis 'GNUtoo' Carikli
2022-04-07 16:40 ` Ludovic Courtès
2022-04-14 23:26   ` Denis 'GNUtoo' Carikli [this message]
2022-04-14 23:30     ` bug#54728: [PATCH 1/2] gnu: valgrind: impots: sort imports alphabetically Denis 'GNUtoo' Carikli
2022-04-14 23:30       ` bug#54728: [PATCH 2/2] gnu: valgrind: fix ld.so symbols not found Denis 'GNUtoo' Carikli
2022-04-15 16:21         ` Ludovic Courtès
2022-04-25 16:39           ` Denis 'GNUtoo' Carikli
2022-04-25 17:41             ` Maxime Devos
2022-04-26  1:39               ` Denis 'GNUtoo' Carikli
2022-04-26  1:39                 ` bug#54728: [PATCH v2 1/2] gnu: valgrind: impots: sort imports alphabetically Denis 'GNUtoo' Carikli
2022-04-26  1:39                 ` bug#54728: [PATCH v2 2/2] gnu: valgrind: fix ld.so symbols not found Denis 'GNUtoo' Carikli
2022-04-26 22:37                   ` Denis 'GNUtoo' Carikli
2022-05-06 20:16                     ` Denis 'GNUtoo' Carikli
2022-05-06 20:20                       ` Maxime Devos
2022-05-09  9:24                   ` bug#54728: Valgrind not working out of the box due to stripped ld.so Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220415012611.6edbf92c@primarylaptop.localdomain \
    --to=gnutoo@cyberdimension.org \
    --cc=54728@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).