From unknown Mon Jun 23 05:59:21 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#31208 <31208@debbugs.gnu.org> To: bug#31208 <31208@debbugs.gnu.org> Subject: Status: [PATCH 0/3] Add 'strip-runpath' in (guix build gremlin) Reply-To: bug#31208 <31208@debbugs.gnu.org> Date: Mon, 23 Jun 2025 12:59:21 +0000 retitle 31208 [PATCH 0/3] Add 'strip-runpath' in (guix build gremlin) reassign 31208 guix-patches submitter 31208 Ludovic Court=C3=A8s severity 31208 normal tag 31208 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 18 12:39:02 2018 Received: (at submit) by debbugs.gnu.org; 18 Apr 2018 16:39:02 +0000 Received: from localhost ([127.0.0.1]:59503 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8q6o-00022V-4z for submit@debbugs.gnu.org; Wed, 18 Apr 2018 12:39:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38006) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8q6n-000221-0Y for submit@debbugs.gnu.org; Wed, 18 Apr 2018 12:39:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f8q6g-0001yI-V1 for submit@debbugs.gnu.org; Wed, 18 Apr 2018 12:38:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:54914) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f8q6g-0001yD-SS for submit@debbugs.gnu.org; Wed, 18 Apr 2018 12:38:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8q6f-0002Ly-KI for guix-patches@gnu.org; Wed, 18 Apr 2018 12:38:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f8q6d-0001wC-7j for guix-patches@gnu.org; Wed, 18 Apr 2018 12:38:52 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48386) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8q6b-0001vX-4h; Wed, 18 Apr 2018 12:38:49 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=51264 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1f8q6a-0008IT-Jl; Wed, 18 Apr 2018 12:38:48 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH 0/3] Add 'strip-runpath' in (guix build gremlin) Date: Wed, 18 Apr 2018 18:38:42 +0200 Message-Id: <20180418163842.29823-1-ludo@gnu.org> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit Cc: Marius Bakke , =?UTF-8?q?Ludovic=20Court=C3=A8s?= , Peter Mikkelsen 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: -6.0 (------) Hello! As discussed before, this patch set is a first stab at getting rid of PatchELF (which has portability issues) in particular in the Meson build system. (The patches are for the next ‘core-updates’.) The second patch adds ‘strip-runpath’. It doesn’t add ‘augment-rpath’ though, because that’s a bit more involved (it needs to grow the string table and the section it’s in), and so I wanted to make sure we really need it first. :-) In the discussion of ‘meson-build-system’ in , we didn’t discuss this specific part. Peter & Marius: can you explain whether/why this is needed? Thanks, Ludo’. Ludovic Courtès (3): gremlin: Preserve offset info for dynamic entries. gremlin: Add 'strip-runpath'. build-system/meson: Use 'strip-runpath' instead of PatchELF. guix/build/gremlin.scm | 130 +++++++++++++++++++++--------- guix/build/meson-build-system.scm | 2 +- tests/gremlin.scm | 35 +++++++- 3 files changed, 129 insertions(+), 38 deletions(-) -- 2.17.0 From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 18 12:41:26 2018 Received: (at 31208) by debbugs.gnu.org; 18 Apr 2018 16:41:26 +0000 Received: from localhost ([127.0.0.1]:59510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8q98-00026g-Ix for submit@debbugs.gnu.org; Wed, 18 Apr 2018 12:41:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39385) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8q97-00026H-6A for 31208@debbugs.gnu.org; Wed, 18 Apr 2018 12:41:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f8q90-0003FX-Tb for 31208@debbugs.gnu.org; Wed, 18 Apr 2018 12:41:20 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8q8y-0003AP-FU; Wed, 18 Apr 2018 12:41:16 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=51306 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1f8q8y-0008Un-0k; Wed, 18 Apr 2018 12:41:16 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 31208@debbugs.gnu.org Subject: [PATCH 1/3] gremlin: Preserve offset info for dynamic entries. Date: Wed, 18 Apr 2018 18:40:52 +0200 Message-Id: <20180418164054.29979-1-ludo@gnu.org> X-Mailer: git-send-email 2.17.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31208 Cc: Marius Bakke , =?UTF-8?q?Ludovic=20Court=C3=A8s?= , Peter Mikkelsen 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: -6.0 (------) * guix/build/gremlin.scm (): New record type. (raw-dynamic-entries): Return a list of . (dynamic-entries): Adjust accordingly and return a list of . (elf-dynamic-info)[matching-entry]: New procedure. Use it. --- guix/build/gremlin.scm | 84 ++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 35 deletions(-) diff --git a/guix/build/gremlin.scm b/guix/build/gremlin.scm index bb019967e..78d133311 100644 --- a/guix/build/gremlin.scm +++ b/guix/build/gremlin.scm @@ -99,10 +99,16 @@ dynamic linking information." ;; } d_un; ;; } Elf64_Dyn; +(define-record-type + (dynamic-entry type value offset) + dynamic-entry? + (type dynamic-entry-type) ;DT_* + (value dynamic-entry-value) ;string | number | ... + (offset dynamic-entry-offset)) ;integer + (define (raw-dynamic-entries elf segment) - "Return as a list of type/value pairs all the dynamic entries found in -SEGMENT, the 'PT_DYNAMIC' segment of ELF. In the result, each car is a DT_ -value, and the interpretation of the cdr depends on the type." + "Return as a list of for the dynamic entries found in +SEGMENT, the 'PT_DYNAMIC' segment of ELF." (define start (elf-segment-offset segment)) (define bytes @@ -123,7 +129,9 @@ value, and the interpretation of the cdr depends on the type." (if (= type DT_NULL) ;finished? (reverse result) (loop (+ offset (* 2 word-size)) - (alist-cons type value result))))))) + (cons (dynamic-entry type value + (+ start offset word-size)) + result))))))) (define (vma->offset elf vma) "Convert VMA, a virtual memory address, to an offset within ELF. @@ -148,35 +156,33 @@ offset." (define (dynamic-entries elf segment) "Return all the dynamic entries found in SEGMENT, the 'PT_DYNAMIC' segment -of ELF, as a list of type/value pairs. The type is a DT_ value, and the value -may be a string or an integer depending on the entry type (for instance, the -value of DT_NEEDED entries is a string.)" +of ELF, as a list of . The value of each entry may be a string +or an integer depending on the entry type (for instance, the value of +DT_NEEDED entries is a string.) Likewise the offset is the offset within the +string table if the type is a string." (define entries (raw-dynamic-entries elf segment)) (define string-table-offset - (any (match-lambda - ((type . value) - (and (= type DT_STRTAB) value)) - (_ #f)) + (any (lambda (entry) + (and (= (dynamic-entry-type entry) DT_STRTAB) + (dynamic-entry-value entry))) entries)) - (define (interpret-dynamic-entry type value) - (cond ((memv type (list DT_NEEDED DT_SONAME DT_RPATH DT_RUNPATH)) - (if string-table-offset - (pointer->string - (bytevector->pointer (elf-bytes elf) - (vma->offset - elf - (+ string-table-offset value)))) - value)) - (else - value))) + (define (interpret-dynamic-entry entry) + (let ((type (dynamic-entry-type entry)) + (value (dynamic-entry-value entry))) + (cond ((memv type (list DT_NEEDED DT_SONAME DT_RPATH DT_RUNPATH)) + (if string-table-offset + (let* ((offset (vma->offset elf (+ string-table-offset value))) + (value (pointer->string + (bytevector->pointer (elf-bytes elf) offset)))) + (dynamic-entry type value offset)) + (dynamic-entry type value (dynamic-entry-offset entry)))) + (else + (dynamic-entry type value (dynamic-entry-offset entry)))))) - (map (match-lambda - ((type . value) - (cons type (interpret-dynamic-entry type value)))) - entries)) + (map interpret-dynamic-entry entries)) ;;; @@ -200,21 +206,29 @@ value of DT_NEEDED entries is a string.)" (define (elf-dynamic-info elf) "Return dynamic-link information for ELF as an object, or #f if ELF lacks dynamic-link information." + (define (matching-entry type) + (lambda (entry) + (= type (dynamic-entry-type entry)))) + (match (dynamic-link-segment elf) (#f #f) ((? elf-segment? dynamic) (let ((entries (dynamic-entries elf dynamic))) - (%elf-dynamic-info (assv-ref entries DT_SONAME) - (filter-map (match-lambda - ((type . value) - (and (= type DT_NEEDED) value)) - (_ #f)) + (%elf-dynamic-info (find (matching-entry DT_SONAME) entries) + (filter-map (lambda (entry) + (and (= (dynamic-entry-type entry) + DT_NEEDED) + (dynamic-entry-value entry))) entries) - (or (and=> (assv-ref entries DT_RPATH) - search-path->list) + (or (and=> (find (matching-entry DT_RPATH) + entries) + (compose search-path->list + dynamic-entry-value)) '()) - (or (and=> (assv-ref entries DT_RUNPATH) - search-path->list) + (or (and=> (find (matching-entry DT_RUNPATH) + entries) + (compose search-path->list + dynamic-entry-value)) '())))))) (define %libc-libraries -- 2.17.0 From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 18 12:41:27 2018 Received: (at 31208) by debbugs.gnu.org; 18 Apr 2018 16:41:27 +0000 Received: from localhost ([127.0.0.1]:59512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8q98-00026i-Sh for submit@debbugs.gnu.org; Wed, 18 Apr 2018 12:41:27 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39390) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8q97-00026J-Iv for 31208@debbugs.gnu.org; Wed, 18 Apr 2018 12:41:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f8q91-0003Gl-Hy for 31208@debbugs.gnu.org; Wed, 18 Apr 2018 12:41:20 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48414) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8q8z-0003Bs-Bv; Wed, 18 Apr 2018 12:41:17 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=51306 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1f8q8y-0008Un-UQ; Wed, 18 Apr 2018 12:41:17 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 31208@debbugs.gnu.org Subject: [PATCH 2/3] gremlin: Add 'strip-runpath'. Date: Wed, 18 Apr 2018 18:40:53 +0200 Message-Id: <20180418164054.29979-2-ludo@gnu.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180418164054.29979-1-ludo@gnu.org> References: <20180418164054.29979-1-ludo@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31208 Cc: Marius Bakke , =?UTF-8?q?Ludovic=20Court=C3=A8s?= , Peter Mikkelsen 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: -6.0 (------) * guix/build/gremlin.scm (strip-runpath): New procedure. * tests/gremlin.scm (c-compiler): New variable. ("strip-runpath"): New test. --- guix/build/gremlin.scm | 46 +++++++++++++++++++++++++++++++++++++++++- tests/gremlin.scm | 35 +++++++++++++++++++++++++++++++- 2 files changed, 79 insertions(+), 2 deletions(-) diff --git a/guix/build/gremlin.scm b/guix/build/gremlin.scm index 78d133311..e8ea66dfb 100644 --- a/guix/build/gremlin.scm +++ b/guix/build/gremlin.scm @@ -41,7 +41,8 @@ elf-dynamic-info-runpath expand-origin - validate-needed-in-runpath)) + validate-needed-in-runpath + strip-runpath)) ;;; Commentary: ;;; @@ -320,4 +321,47 @@ be found in RUNPATH ~s~%" ;; (format (current-error-port) "~a is OK~%" file)) (null? not-found)))))) +(define (strip-runpath file) + "Remove from the DT_RUNPATH of FILE any entries that are not necessary +according to DT_NEEDED." + (define (minimal-runpath needed runpath) + (filter (lambda (directory) + (and (string-prefix? "/" directory) + (any (lambda (lib) + (file-exists? (string-append directory "/" lib))) + needed))) + runpath)) + + (define port + (open-file file "r+b")) + + (catch #t + (lambda () + (let* ((elf (parse-elf (get-bytevector-all port))) + (entries (dynamic-entries elf (dynamic-link-segment elf))) + (needed (filter-map (lambda (entry) + (and (= (dynamic-entry-type entry) + DT_NEEDED) + (dynamic-entry-value entry))) + entries)) + (runpath (find (lambda (entry) + (= DT_RUNPATH (dynamic-entry-type entry))) + entries)) + (old (search-path->list + (dynamic-entry-value runpath))) + (new (minimal-runpath needed old))) + (unless (equal? old new) + (format (current-error-port) + "~a: stripping RUNPATH to ~s (removed ~s)~%" + file new + (lset-difference string=? old new)) + (seek port (dynamic-entry-offset runpath) SEEK_SET) + (put-bytevector port (string->utf8 (string-join new ":"))) + (put-u8 port 0)) + (close-port port) + new)) + (lambda (key . args) + (false-if-exception (close-port port)) + (apply throw key args)))) + ;;; gremlin.scm ends here diff --git a/tests/gremlin.scm b/tests/gremlin.scm index 288555496..1b47d5c38 100644 --- a/tests/gremlin.scm +++ b/tests/gremlin.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015 Ludovic Courtès +;;; Copyright © 2015, 2018 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,12 +18,14 @@ (define-module (test-gremlin) #:use-module (guix elf) + #:use-module ((guix utils) #:select (call-with-temporary-directory)) #:use-module (guix build utils) #:use-module (guix build gremlin) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-64) #:use-module (rnrs io ports) + #:use-module (ice-9 popen) #:use-module (ice-9 match)) (define %guile-executable @@ -37,6 +39,9 @@ (define read-elf (compose parse-elf get-bytevector-all)) +(define c-compiler + (or (which "gcc") (which "cc") (which "g++"))) + (test-begin "gremlin") @@ -63,4 +68,32 @@ "../${ORIGIN}/bar/$ORIGIN/baz" "ORIGIN/foo"))) +(unless c-compiler + (test-skip 1)) +(test-equal "strip-runpath" + "hello\n" + (call-with-temporary-directory + (lambda (directory) + (with-directory-excursion directory + (call-with-output-file "t.c" + (lambda (port) + (display "int main () { puts(\"hello\"); }" port))) + (invoke c-compiler "t.c" + "-Wl,-rpath=/foo" "-Wl,-rpath=/bar") + (let* ((dyninfo (elf-dynamic-info + (parse-elf (call-with-input-file "a.out" + get-bytevector-all)))) + (old (elf-dynamic-info-runpath dyninfo)) + (new (strip-runpath "a.out")) + (new* (strip-runpath "a.out"))) + (validate-needed-in-runpath "a.out") + (and (member "/foo" old) (member "/bar" old) + (not (member "/foo" new)) + (not (member "/bar" new)) + (equal? new* new) + (let* ((pipe (open-input-pipe "./a.out")) + (str (get-string-all pipe))) + (close-pipe pipe) + str))))))) + (test-end "gremlin") -- 2.17.0 From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 18 12:41:31 2018 Received: (at 31208) by debbugs.gnu.org; 18 Apr 2018 16:41:31 +0000 Received: from localhost ([127.0.0.1]:59514 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8q9D-000270-6w for submit@debbugs.gnu.org; Wed, 18 Apr 2018 12:41:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39393) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8q98-00026K-3F for 31208@debbugs.gnu.org; Wed, 18 Apr 2018 12:41:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f8q92-0003H5-8w for 31208@debbugs.gnu.org; Wed, 18 Apr 2018 12:41:21 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8q90-0003EI-Ah; Wed, 18 Apr 2018 12:41:18 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=51306 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1f8q8z-0008Un-Qm; Wed, 18 Apr 2018 12:41:18 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 31208@debbugs.gnu.org Subject: [PATCH 3/3] build-system/meson: Use 'strip-runpath' instead of PatchELF. Date: Wed, 18 Apr 2018 18:40:54 +0200 Message-Id: <20180418164054.29979-3-ludo@gnu.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180418164054.29979-1-ludo@gnu.org> References: <20180418164054.29979-1-ludo@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31208 Cc: Marius Bakke , =?UTF-8?q?Ludovic=20Court=C3=A8s?= , Peter Mikkelsen 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: -6.0 (------) * guix/build/meson-build-system.scm (fix-runpath): Call 'strip-runpath' instead of invoking 'patchelf'. --- guix/build/meson-build-system.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guix/build/meson-build-system.scm b/guix/build/meson-build-system.scm index e8cb5440e..793cc32e7 100644 --- a/guix/build/meson-build-system.scm +++ b/guix/build/meson-build-system.scm @@ -134,7 +134,7 @@ for example libraries only needed for the tests." (find-files dir elf-pred)) existing-elf-dirs)))) (for-each (lambda (elf-file) - (system* "patchelf" "--shrink-rpath" elf-file) + (strip-runpath elf-file) (handle-file elf-file elf-list)) elf-list))))) (for-each handle-output outputs) -- 2.17.0 From debbugs-submit-bounces@debbugs.gnu.org Fri May 04 16:52:51 2018 Received: (at 31208) by debbugs.gnu.org; 4 May 2018 20:52:51 +0000 Received: from localhost ([127.0.0.1]:50002 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fEhhD-0005nC-3l for submit@debbugs.gnu.org; Fri, 04 May 2018 16:52:51 -0400 Received: from hera.aquilenet.fr ([185.233.100.1]:55708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fEhhB-0005n4-Ii for 31208@debbugs.gnu.org; Fri, 04 May 2018 16:52:49 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 01A2D1D76F; Fri, 4 May 2018 22:52:49 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0Gvb7j9MpYz3; Fri, 4 May 2018 22:52:48 +0200 (CEST) Received: from ribbon (unknown [IPv6:2a01:e0a:1d:7270:af76:b9b:ca24:c465]) by hera.aquilenet.fr (Postfix) with ESMTPSA id B37AE128C8; Fri, 4 May 2018 22:52:47 +0200 (CEST) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: 31208@debbugs.gnu.org Subject: Re: [bug#31208] [PATCH 0/3] Add 'strip-runpath' in (guix build gremlin) References: <20180418163842.29823-1-ludo@gnu.org> Date: Fri, 04 May 2018 22:52:47 +0200 In-Reply-To: <20180418163842.29823-1-ludo@gnu.org> ("Ludovic \=\?utf-8\?Q\?Cou\?\= \=\?utf-8\?Q\?rt\=C3\=A8s\=22's\?\= message of "Wed, 18 Apr 2018 18:38:42 +0200") Message-ID: <87bmdvrvmo.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 31208 Cc: Marius Bakke , Peter Mikkelsen 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: -0.0 (/) Ping! :-) Ludovic Court=C3=A8s skribis: > Hello! > > As discussed before, this patch set is a first stab at getting rid of > PatchELF (which has portability issues) in particular in the Meson build > system. (The patches are for the next =E2=80=98core-updates=E2=80=99.) > > The second patch adds =E2=80=98strip-runpath=E2=80=99. It doesn=E2=80=99= t add =E2=80=98augment-rpath=E2=80=99 > though, because that=E2=80=99s a bit more involved (it needs to grow the = string > table and the section it=E2=80=99s in), and so I wanted to make sure we r= eally > need it first. :-) > > In the discussion of =E2=80=98meson-build-system=E2=80=99 in > , we didn=E2=80=99= t discuss > this specific part. Peter & Marius: can you explain whether/why this is > needed? > > Thanks, > Ludo=E2=80=99. > > Ludovic Court=C3=A8s (3): > gremlin: Preserve offset info for dynamic entries. > gremlin: Add 'strip-runpath'. > build-system/meson: Use 'strip-runpath' instead of PatchELF. > > guix/build/gremlin.scm | 130 +++++++++++++++++++++--------- > guix/build/meson-build-system.scm | 2 +- > tests/gremlin.scm | 35 +++++++- > 3 files changed, 129 insertions(+), 38 deletions(-) From debbugs-submit-bounces@debbugs.gnu.org Sat May 05 16:02:34 2018 Received: (at 31208) by debbugs.gnu.org; 5 May 2018 20:02:34 +0000 Received: from localhost ([127.0.0.1]:50839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fF3O6-0008HF-9e for submit@debbugs.gnu.org; Sat, 05 May 2018 16:02:34 -0400 Received: from hera.aquilenet.fr ([185.233.100.1]:50676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fF3O3-0008H4-Cb for 31208@debbugs.gnu.org; Sat, 05 May 2018 16:02:32 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 59F102BF28; Sat, 5 May 2018 22:02:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04jODD66de-r; Sat, 5 May 2018 22:02:29 +0200 (CEST) Received: from ribbon (unknown [IPv6:2a01:e0a:1d:7270:af76:b9b:ca24:c465]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 409E32BF83; Sat, 5 May 2018 22:02:29 +0200 (CEST) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Peter Mikkelsen Subject: Re: [bug#31208] [PATCH 0/3] Add 'strip-runpath' in (guix build gremlin) References: <20180418163842.29823-1-ludo@gnu.org> <87bmdvrvmo.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 16 =?utf-8?Q?Flor=C3=A9al?= an 226 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sat, 05 May 2018 22:02:28 +0200 In-Reply-To: (Peter Mikkelsen's message of "Fri, 4 May 2018 23:34:09 +0200") Message-ID: <876041swff.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 31208 Cc: Marius Bakke , 31208@debbugs.gnu.org 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: -0.0 (/) Hello Peter, (I=E2=80=99m re-adding Cc, hope you don=E2=80=99t mind.) Peter Mikkelsen skribis: > Since I am not really that much into meson, I am not sure my answer > will be enough, but I will give it a go: > The augment-rpath is needed because in some software projects such as > nautilus, there is both a library and an executable. > When building the software, the library is built first, and then the > executable which depends on it, but then the runpath of the executable > is 'fixed' so > that libnautilus is no longer in the runpath of the nautilus binary. > This is a problem since libnautilus is needed at runtime, so it is > added using augment-rpath. Oh, I see. Back to this patch series, it means we still need =E2=80=98augment-rpath=E2= =80=99. :-/ I suppose we can still apply these patches to =E2=80=98core-updates-next=E2= =80=99 though, it=E2=80=99s a step in the right direction. > I think I remember something about the meson developers saying that it > is no problem, since libnautilus will be installed in a standard > location or something, > but I really don't remember, sorry.. What Libtool does is that it =E2=80=9Crelinks=E2=80=9D executables upon =E2= =80=9Cmake install=E2=80=9D so that they have the correct RUNPATH. > Sorry for the not so good reply, but I hope it makes a little bit sense :) It makes a lot of sense yes, thank you! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Mon May 07 05:24:48 2018 Received: (at 31208-done) by debbugs.gnu.org; 7 May 2018 09:24:48 +0000 Received: from localhost ([127.0.0.1]:51971 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fFcO0-0008Hw-C3 for submit@debbugs.gnu.org; Mon, 07 May 2018 05:24:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48473) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fFcNy-0008Hk-Cy for 31208-done@debbugs.gnu.org; Mon, 07 May 2018 05:24:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFcNs-0008Cl-Il for 31208-done@debbugs.gnu.org; Mon, 07 May 2018 05:24:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47147) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFcNn-00088k-LQ; Mon, 07 May 2018 05:24:35 -0400 Received: from [193.50.110.223] (port=44254 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fFcNn-0000bW-5F; Mon, 07 May 2018 05:24:35 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Peter Mikkelsen Subject: Re: [bug#31208] [PATCH 0/3] Add 'strip-runpath' in (guix build gremlin) References: <20180418163842.29823-1-ludo@gnu.org> <87bmdvrvmo.fsf@gnu.org> <876041swff.fsf@gnu.org> Date: Mon, 07 May 2018 11:24:33 +0200 In-Reply-To: <876041swff.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sat, 05 May 2018 22:02:28 +0200") Message-ID: <87sh73akdq.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31208-done Cc: Marius Bakke , 31208-done@debbugs.gnu.org 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: -6.0 (------) ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > Back to this patch series, it means we still need =E2=80=98augment-rpath= =E2=80=99. :-/ > I suppose we can still apply these patches to =E2=80=98core-updates-next= =E2=80=99 > though, it=E2=80=99s a step in the right direction. Done! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Mon May 07 05:32:49 2018 Received: (at 31208) by debbugs.gnu.org; 7 May 2018 09:32:49 +0000 Received: from localhost ([127.0.0.1]:51978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fFcVl-0008U7-7H for submit@debbugs.gnu.org; Mon, 07 May 2018 05:32:49 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49936) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fFcVk-0008Tw-1n for 31208@debbugs.gnu.org; Mon, 07 May 2018 05:32:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFcVd-0006hH-PP for 31208@debbugs.gnu.org; Mon, 07 May 2018 05:32:42 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFcVV-0006VX-RH; Mon, 07 May 2018 05:32:33 -0400 Received: from [193.50.110.223] (port=44674 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fFcVV-0000KC-Cg; Mon, 07 May 2018 05:32:33 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Peter Mikkelsen Subject: Re: [bug#31208] [PATCH 0/3] Add 'strip-runpath' in (guix build gremlin) References: <20180418163842.29823-1-ludo@gnu.org> <87bmdvrvmo.fsf@gnu.org> <876041swff.fsf@gnu.org> Date: Mon, 07 May 2018 11:32:31 +0200 In-Reply-To: <876041swff.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sat, 05 May 2018 22:02:28 +0200") Message-ID: <87muxbak0g.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31208 Cc: Marius Bakke , 31208@debbugs.gnu.org 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: -6.0 (------) ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > Peter Mikkelsen skribis: [...] >> I think I remember something about the meson developers saying that it >> is no problem, since libnautilus will be installed in a standard >> location or something, >> but I really don't remember, sorry.. > > What Libtool does is that it =E2=80=9Crelinks=E2=80=9D executables upon = =E2=80=9Cmake install=E2=80=9D > so that they have the correct RUNPATH. I found this issue, which mentions the problem: https://github.com/mesonbuild/meson/issues/2121#issuecomment-377971590 It=E2=80=99s a pity this isn=E2=80=99t properly solved. :-/ Ludo=E2=80=99. From unknown Mon Jun 23 05:59:21 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 04 Jun 2018 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator