From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pierre Neidhardt Subject: LIBRARY_PATH and foreign binaries: error while loading shared libraries Date: Wed, 18 Apr 2018 11:31:49 +0530 Message-ID: <87bmeh59yq.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8gAL-0008D6-Ov for help-guix@gnu.org; Wed, 18 Apr 2018 02:02:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f8gAE-0005bv-LN for help-guix@gnu.org; Wed, 18 Apr 2018 02:01:57 -0400 Received: from mail-it0-x243.google.com ([2607:f8b0:4001:c0b::243]:54774) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f8gAE-0005bq-Fw for help-guix@gnu.org; Wed, 18 Apr 2018 02:01:54 -0400 Received: by mail-it0-x243.google.com with SMTP id h143-v6so1054802ita.4 for ; Tue, 17 Apr 2018 23:01:54 -0700 (PDT) Received: from mimimi ([103.61.255.46]) by smtp.gmail.com with ESMTPSA id 194-v6sm428536itm.15.2018.04.17.23.01.51 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Apr 2018 23:01:52 -0700 (PDT) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: help-guix --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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/Lin= ux 2.6.24, BuildID[sha1]=3Dedf4cff78e6710ff4f7ac14cb99b38aefed2659e, stripp= ed I can fix it with > patchelf --set-interpreter "$(realpath "$(which sh)")" /path/to/foreign/b= inary (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 =3D> /gnu/store/4sqaib7c2dfjv62ivrg9b8wa7bh226la-glibc-2.26.105= -g0890d5379c/lib/libdl.so.2 (0x00007fa746ffd000) libpthread.so.0 =3D> /gnu/store/4sqaib7c2dfjv62ivrg9b8wa7bh226la-glibc-2.2= 6.105-g0890d5379c/lib/libpthread.so.0 (0x00007fa746ddf000) librt.so.1 =3D> /gnu/store/4sqaib7c2dfjv62ivrg9b8wa7bh226la-glibc-2.26.105= -g0890d5379c/lib/librt.so.1 (0x00007fa746bd7000) libstdc++.so.6 =3D> not found libm.so.6 =3D> /gnu/store/4sqaib7c2dfjv62ivrg9b8wa7bh226la-glibc-2.26.105-= g0890d5379c/lib/libm.so.6 (0x00007fa74688b000) libgcc_s.so.1 =3D> not found libc.so.6 =3D> /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=3D/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=3D$LIBRARY_PATH > /path/to/foreign/binary Is there a better way? =2D-=20 Pierre Neidhardt Price does not include taxes. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAlrW300ACgkQm9z0l6S7 zH9YJgf/amnYxxHRXCPNwHe5XB87ejDSFtyaH87jleP5B24UpeQvgbVANE4GU/1A WYVGwtO+6rxk7YYxw4IL7LoN/Tngd+sHyU1O8+djolqmde8mNxobnKD1zOoTA9pG ViGv62dSm8ho9Wonu+S9dIuGTy4Tyof7/JLhpnEBcfkzbl09vN3XghHiprRmGimf Uzv8Rjm6psashgHOMK2gC7g9m341q6TKHVwodlrqlYYJ4mYjqDghXZMx07tNPoKJ TUeBzNLwcPc0GUvhwHuVgUeZBxZZ1hCGAiTAMCcsUeBSdmRVMsCoj/nngimG6q3m 2wMuqUv7oUEwgQv3mN0BNW7wVocNJw== =Lzdi -----END PGP SIGNATURE----- --=-=-=--