all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* LIBRARY_PATH and foreign binaries: error while loading shared libraries
@ 2018-04-18  6:01 Pierre Neidhardt
  2018-04-18  8:49 ` Pierre Neidhardt
  2018-04-18 20:39 ` Ricardo Wurmus
  0 siblings, 2 replies; 5+ messages in thread
From: Pierre Neidhardt @ 2018-04-18  6:01 UTC (permalink / raw)
  To: help-guix

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


I want to run some binaries which were not compiled on GuixSD
(e.g. games from Humble Bundle).

Two issues:

> /path/to/foreign/binary
/path/to/foreign/binary: No such file or directory

This is because the path to the linker is wrong:

> file /path/to/foreign/binary
/path/to/foreign/binary: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=edf4cff78e6710ff4f7ac14cb99b38aefed2659e, stripped

I can fix it with

> patchelf --set-interpreter "$(realpath "$(which sh)")" /path/to/foreign/binary

(Is this the commended way?)

Now it starts up but the linker fails to find some libraries:

> /path/to/foreign/binary
/path/to/foreign/binary: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

> ldd /path/to/foreign/binary
	linux-vdso.so.1 (0x00007ffd71355000)
	libdl.so.2 => /gnu/store/4sqaib7c2dfjv62ivrg9b8wa7bh226la-glibc-2.26.105-g0890d5379c/lib/libdl.so.2 (0x00007fa746ffd000)
	libpthread.so.0 => /gnu/store/4sqaib7c2dfjv62ivrg9b8wa7bh226la-glibc-2.26.105-g0890d5379c/lib/libpthread.so.0 (0x00007fa746ddf000)
	librt.so.1 => /gnu/store/4sqaib7c2dfjv62ivrg9b8wa7bh226la-glibc-2.26.105-g0890d5379c/lib/librt.so.1 (0x00007fa746bd7000)
	libstdc++.so.6 => not found
	libm.so.6 => /gnu/store/4sqaib7c2dfjv62ivrg9b8wa7bh226la-glibc-2.26.105-g0890d5379c/lib/libm.so.6 (0x00007fa74688b000)
	libgcc_s.so.1 => not found
	libc.so.6 => /gnu/store/4sqaib7c2dfjv62ivrg9b8wa7bh226la-glibc-2.26.105-g0890d5379c/lib/libc.so.6 (0x00007fa7464d9000)
	/gnu/store/4sqaib7c2dfjv62ivrg9b8wa7bh226la-glibc-2.26.105-g0890d5379c/lib/ld-linux-x86-64.so.2 (0x00007fa747201000)

The "missing" libraries are indeed in my ~/.guix-profile/lib.  This
folder is properly referenced in the environment:

> env | grep LIBRARY_PATH
LIBRARY_PATH=/home/ambrevar/.guix-profile/lib

My understanding is that the LIBRARY_PATH is only used for compiling,
not at runtime.  But then how come some libraries are found and not others?
Or is it just true for the libs in the glibc package, because
ld-linux-x86-64.so.2 is part of it, so it searchs its own path?

If I export LD_LIBRARY_PATH to the value of LIBRARY_PATH, then it works:

> export LD_LIBRARY_PATH=$LIBRARY_PATH
> /path/to/foreign/binary

Is there a better way?

-- 
Pierre Neidhardt

Price does not include taxes.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-04-19  3:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-18  6:01 LIBRARY_PATH and foreign binaries: error while loading shared libraries Pierre Neidhardt
2018-04-18  8:49 ` Pierre Neidhardt
2018-04-18 20:39 ` Ricardo Wurmus
2018-04-19  3:21   ` Pierre Neidhardt
2018-04-19  3:25   ` Pierre Neidhardt

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.