From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#20102: Problem with ld.so RUNPATH on armhf Date: Thu, 09 Apr 2015 00:33:14 +0200 Message-ID: <87y4m2z1w5.fsf@gnu.org> References: <87y4n0ybdd.fsf@netris.org> <87pp7jh7y8.fsf@gnu.org> <87384f5goy.fsf@netris.org> <87oan16m4z.fsf@gnu.org> <87d23hynqe.fsf@netris.org> <87fv8b0wwx.fsf@gnu.org> <87bniyy7au.fsf@netris.org> <87twwqv50y.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfyXr-0001ER-Df for bug-guix@gnu.org; Wed, 08 Apr 2015 18:34:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YfyXq-0002en-8Y for bug-guix@gnu.org; Wed, 08 Apr 2015 18:34:03 -0400 Received: from debbugs.gnu.org ([140.186.70.43]:59849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfyXq-0002ed-5a for bug-guix@gnu.org; Wed, 08 Apr 2015 18:34:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YfyXp-0006lx-To for bug-guix@gnu.org; Wed, 08 Apr 2015 18:34:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87twwqv50y.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 08 Apr 2015 20:39:09 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Mark H Weaver Cc: 20102@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > That way it would match GNU_USER_TARGET_LINK_SPEC in i386/gnu-user.h, > where -dynamic-linker appears within %{!static ... %{!shared ...}}. > > So, could you do: > > (define patched-gcc > (package > (inherit gcc-4.8) > (sources (origin (inherit (package-source gcc-4.8)) > (patches ...))))) > > build it, and then use it in the failed glibc build tree to rebuild > ld.so? > > > There are ways we could have worked around it, for instance by adding: > > (setenv "GUIX_LD_WRAPPER_DISABLE_RPATH" "yes") > > in the glibc recipe. I=E2=80=99m forgetting another possibility: fix ld-wrapper so that it doesn= =E2=80=99t add =E2=80=9C-rpath $(dirname ld.so)=E2=80=9D when it encounters =E2=80=9C-= dynamic-linker ld.so=E2=80=9D. This patch does that: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/packages/ld-wrapper.in b/gnu/packages/ld-wrapper.in index 094018d..125edee 100644 --- a/gnu/packages/ld-wrapper.in +++ b/gnu/packages/ld-wrapper.in @@ -142,34 +142,45 @@ exec @GUILE@ -c "(load-compiled \"@SELF@.go\") (apply $main (cdr (command-line)) (define (library-files-linked args) ;; Return the file names of shared libraries explicitly linked against via ;; `-l' or with an absolute file name in ARGS. - (define path+files + (define path+files+args (fold (lambda (argument result) (match result - ((library-path . library-files) + ((library-path library-files ("-dynamic-linker" . rest)) + ;; When passed '-dynamic-linker ld.so', ignore 'ld.so'. + ;; See . + (list library-path + library-files + (cons* argument "-dynamic-linker" rest))) + ((library-path library-files previous-args) (cond ((string-prefix? "-L" argument) ;augment the search path - (cons (append library-path + (list (append library-path (list (string-drop argument 2))) - library-files)) + library-files + (cons argument previous-args))) ((string-prefix? "-l" argument) ;add library (let* ((lib (string-append "lib" (string-drop argument 2) ".so")) (full (search-path library-path lib))) + (list library-path (if full - (cons library-path - (cons full library-files)) - result))) + (cons full library-files) + library-files) + (cons argument previous-args)))) ((and (string-prefix? %store-directory argument) (shared-library? argument)) ;add library - (cons library-path - (cons argument library-files))) + (list library-path + (cons argument library-files) + (cons argument previous-args))) (else - result))))) - (cons '() '()) + (list library-path + library-files + (cons argument previous-args))))))) + (list '() '() '()) args)) - (match path+files - ((path . files) + (match path+files+args + ((path files arguments) (reverse files)))) (define (rpath-arguments library-files) @@ -202,6 +213,8 @@ impure library ~s~%" (args (append args (rpath-arguments libs)))) (when %debug? (format (current-error-port) + "ld-wrapper: libraries linked: ~s~%" libs) + (format (current-error-port) "ld-wrapper: invoking `~a' with ~s~%" %real-ld args)) (apply execl %real-ld (basename %real-ld) args))) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Could you check whether it solves the problem? (Tested on x86_64, no regressions AFAICS.) Ludo=E2=80=99. --=-=-=--