all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pierre Neidhardt <ambrevar@gmail.com>
To: Nils Gillmann <ng0@n0.is>
Cc: help-guix@gnu.org
Subject: Re: How should I install non-guix software?
Date: Tue, 07 Aug 2018 19:11:31 +0200	[thread overview]
Message-ID: <87y3dije4c.fsf@gmail.com> (raw)
In-Reply-To: <20180807154251.a3rbvfenyhksomjd@abyayala>

[-- Attachment #1: Type: text/plain, Size: 1962 bytes --]

Indeed.

Foreign binaries must be patched to modify the interpreter (i.e. the dynamic
library loader, also known as ld-linux) and the RPATH (the library path).

$ patchelf --print-interpreter /bin/sh
/gnu/store/l4lr0f5cjd0nbsaaf8b5dmcw1a1yypr3-glibc-2.27/lib/ld-linux-x86-64.so.2
$ patchelf --set-interpreter /gnu/store/l4lr0f5cjd0nbsaaf8b5dmcw1a1yypr3-glibc-2.27/lib/ld-linux-x86-64.so.2 /path/to/foo/bin

You can then check the libraries with ldd:

$ ldd /path/to/foo/bin
	linux-vdso.so.1 (0x00007ffefb6e4000)
	libreadline.so.7 => /gnu/store/s5qvyb3lp0b12qmgiwj3754an7dr1r0s-readline-7.0.3/lib/libreadline.so.7 (0x00007f0b638f7000)
	libhistory.so.7 => /gnu/store/s5qvyb3lp0b12qmgiwj3754an7dr1r0s-readline-7.0.3/lib/libhistory.so.7 (0x00007f0b636ed000)
	libncursesw.so.6 => /gnu/store/s9gbq6q72w9vf7zjm0amjf1iw1fy856h-ncurses-6.1/lib/libncursesw.so.6 (0x00007f0b6347e000)
	libdl.so.2 => /gnu/store/l4lr0f5cjd0nbsaaf8b5dmcw1a1yypr3-glibc-2.27/lib/libdl.so.2 (0x00007f0b6327a000)
	libgcc_s.so.1 => /gnu/store/vla5j7pbkpcp39lsdfsmz7m9azn48lr4-gcc-5.5.0-lib/lib/libgcc_s.so.1 (0x00007f0b63063000)
	libc.so.6 => /gnu/store/l4lr0f5cjd0nbsaaf8b5dmcw1a1yypr3-glibc-2.27/lib/libc.so.6 (0x00007f0b62cb0000)
	libbgdrtm.so => not found

In this example, one library is missing.  If you check the RPATH, you can see
the list of folders that are search for libraries:

$ patchelf --print-rpath /path/to/foo/bin
/gnu/store/s5qvyb3lp0b12qmgiwj3754an7dr1r0s-readline-7.0.3/lib:/gnu/store/s9gbq6q72w9vf7zjm0amjf1iw1fy856h-ncurses-6.1/lib:/gnu/store/l4lr0f5cjd0nbsaaf8b5dmcw1a1yypr3-glibc-2.27/lib:/gnu/store/vla5j7pbkpcp39lsdfsmz7m9azn48lr4-gcc-5.5.0-lib/lib:/gnu/store/vla5j7pbkpcp39lsdfsmz7m9azn48lr4-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../..

You can extend the RPATH to include the missing library:

$ patchelf --set-rpath /path/to/missing/lib /path/to/foo/bin

And it should work!
Hope that helps!
-- 
Pierre Neidhardt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

  reply	other threads:[~2018-08-07 17:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-05  1:45 How should I install non-guix software? Luther Thompson
2018-08-05  4:48 ` Chris Marusich
2018-08-05  8:58   ` Pierre Neidhardt
2018-08-07 15:38     ` Benjamin Slade
2018-08-07 15:42       ` Nils Gillmann
2018-08-07 17:11         ` Pierre Neidhardt [this message]
     [not found]         ` <20180807170728.GB917@jasmine.lan>
2018-08-07 17:22           ` Benjamin Slade
2018-08-13  0:53   ` Luther Thompson

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

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

  git send-email \
    --in-reply-to=87y3dije4c.fsf@gmail.com \
    --to=ambrevar@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=ng0@n0.is \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.