From mboxrd@z Thu Jan 1 00:00:00 1970 From: Evan Straw Subject: bug#39079: SBCL CFFI from Guix unable to find dynamic libraries Date: Tue, 14 Jan 2020 13:30:55 -0800 Message-ID: <87muapu3n4.fsf@gmail.com> References: <87v9pfm2fq.fsf@gmail.com> <87o8v7yp23.fsf@ambrevar.xyz> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:50825) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irTnB-0000RV-17 for bug-guix@gnu.org; Tue, 14 Jan 2020 16:32:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1irTn8-0005YM-SF for bug-guix@gnu.org; Tue, 14 Jan 2020 16:32:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:56016) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1irTn8-0005Y9-NA for bug-guix@gnu.org; Tue, 14 Jan 2020 16:32:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1irTn8-0000Od-Jh for bug-guix@gnu.org; Tue, 14 Jan 2020 16:32:02 -0500 In-Reply-To: <87ftgm3bo4.fsf@gmail.com> Sender: "Debbugs-submit" Resent-Message-ID: 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-mx.org@gnu.org Sender: "bug-Guix" To: Pierre Neidhardt , Konrad Hinsen Cc: 39079@debbugs.gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Pierre Neidhardt writes: > What are "dependencies" here? > Can you provide a full recipe of what you are trying to do, including > your .sbclrc and the Lisp code snippets you've run to test this? Absolutely. Apologies for the wall of text that is about to follow: My system is Ubuntu 19.04, with Guix 09bad3c, as shown by `guix describe:` =2D-8<---------------cut here---------------start------------->8--- guix 09bad3c repository URL: https://git.savannah.gnu.org/git/guix.git branch: master commit: 09bad3cd42ca51974f3697f04ce841bf2fe6786c =2D-8<---------------cut here---------------end--------------->8--- I am using SBCL 2.0.0 and sbcl-cffi 0.19.0, both from Guix. My .sbclrc file is as follows: =2D-8<---------------cut here---------------start------------->8--- ;;; The following lines added by ql:add-to-init-file: #-quicklisp (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init))) (when (ignore-errors (asdf:load-system "cffi")) ;; Warning: Trailing "/" matters! (dolist (guix-profile `(,(when (uiop:directory-exists-p "~/.guix-profile") (format nil "~a/.guix-profile/lib/" (uiop:getenv "HOME"))) ,@(mapcar (lambda (d) (format nil "~a~a/lib/" (namestring d) (first (last (pathname-directory d))))) (uiop:subdirectories "~/.guix-extra-profiles/")) "/usr/lib/x86_64-linux-gnu/")) (push guix-profile (symbol-value (find-symbol (string '*foreign-library-directories*) (find-package 'cffi)))))) =2D-8<---------------cut here---------------end--------------->8--- I am attempting to load "/usr/lib/x86_64-linux-gnu/libcurl.so.4" since the tutorial for CFFI starts by loading libcurl. This library depends on the following other libraries, as reported by `ldd /usr/lib/x86_64-linux-gnu/libcurl.so.4`: =2D-8<---------------cut here---------------start------------->8--- linux-vdso.so.1 (0x00007ffd5f393000) libnghttp2.so.14 =3D> /usr/lib/x86_64-linux-gnu/libnghttp2.so.14 (0x00007f9= 41aae8000) libidn2.so.0 =3D> /usr/lib/x86_64-linux-gnu/libidn2.so.0 (0x00007f941aac800= 0) librtmp.so.1 =3D> /usr/lib/x86_64-linux-gnu/librtmp.so.1 (0x00007f941a8a800= 0) libssh.so.4 =3D> /usr/lib/x86_64-linux-gnu/libssh.so.4 (0x00007f941a828000) libpsl.so.5 =3D> /usr/lib/x86_64-linux-gnu/libpsl.so.5 (0x00007f941a810000) libssl.so.1.1 =3D> /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f941a780= 000) libcrypto.so.1.1 =3D> /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f9= 41a4b0000) libgssapi_krb5.so.2 =3D> /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x0= 0007f941a460000) libldap_r-2.4.so.2 =3D> /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 (0x000= 07f941a408000) liblber-2.4.so.2 =3D> /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 (0x00007f9= 41a3f0000) libz.so.1 =3D> /lib/x86_64-linux-gnu/libz.so.1 (0x00007f941a3d0000) libpthread.so.0 =3D> /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f941a3a8= 000) libc.so.6 =3D> /lib/x86_64-linux-gnu/libc.so.6 (0x00007f941a1b8000) libunistring.so.2 =3D> /home/evan/.guix-profile/lib/libunistring.so.2 (0x00= 007f941a030000) libgnutls.so.30 =3D> /usr/lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007f941= 9e88000) libhogweed.so.4 =3D> /usr/lib/x86_64-linux-gnu/libhogweed.so.4 (0x00007f941= 9e50000) libnettle.so.6 =3D> /usr/lib/x86_64-linux-gnu/libnettle.so.6 (0x00007f9419e= 18000) libgmp.so.10 =3D> /home/evan/.guix-profile/lib/libgmp.so.10 (0x00007f9419d8= 0000) librt.so.1 =3D> /lib/x86_64-linux-gnu/librt.so.1 (0x00007f9419d70000) /lib64/ld-linux-x86-64.so.2 (0x00007f941abd8000) libdl.so.2 =3D> /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9419d68000) libkrb5.so.3 =3D> /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f9419c8800= 0) libk5crypto.so.3 =3D> /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f9= 419c50000) libcom_err.so.2 =3D> /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f9419c48= 000) libkrb5support.so.0 =3D> /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x0= 0007f9419c38000) libresolv.so.2 =3D> /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f9419c1800= 0) libsasl2.so.2 =3D> /usr/lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007f9419bf8= 000) libgssapi.so.3 =3D> /usr/lib/x86_64-linux-gnu/libgssapi.so.3 (0x00007f9419b= b0000) libgcc_s.so.1 =3D> /gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-li= b/lib/libgcc_s.so.1 (0x00007f9419b90000) libp11-kit.so.0 =3D> /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f941= 9a60000) libtasn1.so.6 =3D> /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007f9419848= 000) libkeyutils.so.1 =3D> /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f94198= 40000) libheimntlm.so.0 =3D> /usr/lib/x86_64-linux-gnu/libheimntlm.so.0 (0x00007f9= 419830000) libkrb5.so.26 =3D> /usr/lib/x86_64-linux-gnu/libkrb5.so.26 (0x00007f94197a0= 000) libasn1.so.8 =3D> /usr/lib/x86_64-linux-gnu/libasn1.so.8 (0x00007f94196f800= 0) libhcrypto.so.4 =3D> /usr/lib/x86_64-linux-gnu/libhcrypto.so.4 (0x00007f941= 96c0000) libroken.so.18 =3D> /usr/lib/x86_64-linux-gnu/libroken.so.18 (0x00007f94196= a0000) libffi.so.6 =3D> /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f9419690000) libwind.so.0 =3D> /usr/lib/x86_64-linux-gnu/libwind.so.0 (0x00007f941966000= 0) libheimbase.so.1 =3D> /usr/lib/x86_64-linux-gnu/libheimbase.so.1 (0x00007f9= 419648000) libhx509.so.5 =3D> /usr/lib/x86_64-linux-gnu/libhx509.so.5 (0x00007f94195f8= 000) libsqlite3.so.0 =3D> /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f941= 94d8000) libcrypt.so.1 =3D> /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f9419498000) libm.so.6 =3D> /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9419348000) =2D-8<---------------cut here---------------end--------------->8--- In order to load this library, I run the following Lisp code in the SBCL REPL: =2D-8<---------------cut here---------------start------------->8--- CL-USER> (asdf:load-system :cffi) T ;;; *foreign-library-directories* has the right directories in it CL-USER> cffi:*foreign-library-directories* ("/usr/lib/x86_64-linux-gnu/" "/home/evan/.guix-extra-profiles/emacs/emacs/lib/" "/home/evan/.guix-profile/lib/") =20 CL-USER> (cffi:load-foreign-library "libcurl.so.4") =2D-8<---------------cut here---------------end--------------->8--- The last expression fails with the following error, which states that it failed while trying to load libnghttp2.so.14, listed above as one of the dependencies for libcurl: =2D-8<---------------cut here---------------start------------->8--- Unable to load foreign library (LIBCURL.SO.4-464). Error opening shared object "/usr/lib/x86_64-linux-gnu/libcurl.so.4.5.0": libnghttp2.so.14: cannot open shared object file: No such file or directo= ry. [Condition of type CFFI:LOAD-FOREIGN-LIBRARY-ERROR] Restarts: 0: [RETRY] Try loading the foreign library again. 1: [USE-VALUE] Use another library instead. 2: [RETRY] Retry SLIME REPL evaluation request. 3: [*ABORT] Return to SLIME's top level. 4: [ABORT] abort thread (#) Backtrace: 0: (CFFI::FL-ERROR "Unable to load foreign library (~A).~% ~A" #:LIBCURL= .SO.4-464 "Error opening shared object \"/usr/lib/x86_64-linux-gnu/libcurl.= so.4.5.0\": ..) 1: (CFFI::REPORT-SIMPLE-ERROR #:LIBCURL.SO.4-464 # #:LIBCURL.SO.4-464 "libcurl.so.4") 4: (CFFI::%DO-LOAD-FOREIGN-LIBRARY "libcurl.so.4" NIL) 5: (CFFI:LOAD-FOREIGN-LIBRARY "libcurl.so.4" :SEARCH-PATH NIL) 6: (SB-INT:SIMPLE-EVAL-IN-LEXENV (CFFI:LOAD-FOREIGN-LIBRARY "libcurl.so.4= ") #) 7: (EVAL (CFFI:LOAD-FOREIGN-LIBRARY "libcurl.so.4")) =2D-8<---------------cut here---------------end--------------->8--- >> Ideally, I would just install the libraries I need from Guix, but I >> specifically want to interface with a library from the system, in this >> case PulseAudio (I've just been using libcurl as a test to make sure >> it works). > > Does it work for the libraries installed with Guix? To test this, I attempted to load `~/.guix-profile/lib/libguile-2.2.so` since I don't have many libraries installed from Guix. This library depends on the following libraries, as reported by `ldd`: =2D-8<---------------cut here---------------start------------->8--- linux-vdso.so.1 (0x00007ffe3a353000) libgc.so.1 =3D> /gnu/store/3xs3dnc28p9fi8in7hkfcdx20incrdvq-libgc-7.6.12/li= b/libgc.so.1 (0x00007faeaee00000) libpthread.so.0 =3D> /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29= /lib/libpthread.so.0 (0x00007faeaedd8000) libffi.so.6 =3D> /gnu/store/ain96mrdwqd4s9shdd3s7m4syp5icdx5-libffi-3.2.1/l= ib/libffi.so.6 (0x00007faeaedc8000) libunistring.so.2 =3D> /gnu/store/nsikjxykcaqa0zjpfmkqd569bngbv5nl-libunist= ring-0.9.10/lib/libunistring.so.2 (0x00007faeaec40000) libgmp.so.10 =3D> /gnu/store/y7qk8raalgvdnxcglvxa320cfxrjk1x6-gmp-6.1.2/lib= /libgmp.so.10 (0x00007faeaeba8000) libltdl.so.7 =3D> /gnu/store/zasz52va238yyaq68rjm8ljwl4ikij4p-libltdl-2.4.6= /lib/libltdl.so.7 (0x00007faeaeb98000) libdl.so.2 =3D> /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib/= libdl.so.2 (0x00007faeaeb90000) libcrypt.so.1 =3D> /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/l= ib/libcrypt.so.1 (0x00007faeaeb50000) libm.so.6 =3D> /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib/l= ibm.so.6 (0x00007faeaea10000) libgcc_s.so.1 =3D> /gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-li= b/lib/libgcc_s.so.1 (0x00007faeae9f0000) libc.so.6 =3D> /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib/l= ibc.so.6 (0x00007faeae830000) /lib64/ld-linux-x86-64.so.2 (0x00007faeaefb0000) =2D-8<---------------cut here---------------end--------------->8--- Attempting the same steps in the SBCL REPL again succeeds with no errors: =2D-8<---------------cut here---------------start------------->8--- CL-USER> (asdf:load-system :cffi) T CL-USER> (cffi:load-foreign-library "libguile-2.2.so") # =2D-8<---------------cut here---------------end--------------->8--- Hopefully this clarifies the problem somewhat. =2D- Evan --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE6f/SZXb4DLdwy+VR9TDDtKKp8G0FAl4eMw8ACgkQ9TDDtKKp 8G3ushAAi6SPEVXeqYYIpzk7/qaYs71eRcjDxBexXkjP+6XZsdRIVgTwV//WRlqu mNAwVKUCf1vjtrdyLumvHaWBlhZv2mhIzxK93+4OqnAxcPayb+Y/d7tG3EiBRe7O GhjW5hyl+H426U5NbmIODAn+M9ebCIGJifF8UTUgjGsaTZgpw7nJNgUWUdMg1JNb Qp7YT4iguYoliujve2bwfzyz3AUZw1JW5K86hkTU9EtS3u2P6ju86fnv6EshOZJu 1u0g6Q+VDdFXw+tAwHTggwV9EvXvF29je4UBjcC8IcYfDpX3lvlInwwEtwZlwhLP x89lDcPbjOCARWb3fUrAlcHPLL4ihqUld0wGYT7GsWLi3/tg+5a766AkbXF3GchX GwUeRbpNURJhZ1sV9CuYycxtyW9AoSz84+OtEBB8U640HY2rnB0LjmuE2btfVAHD tp/UEdFV8bdQw0qRrK2VJcXkfzAyIRXHB4n0Da3OSn90zi9qiIADqZ6S5I4k1f++ pBrQ1Bc2vKXO9rhNWJTdbkXhxpvzb+NKKjUBZSJG6QfqdnVhieVf+o/p/C1d+BIf DlIPYQDogOVTSTyAfwpNl1ve3VmAeGVmqsTvrU0FPf5bjPswcjUFeZMDT6KJBwYh 60wLf0IJl66tUyqVPmSoTdjcI14I5N/T0QErHIUle5a7l33tzS0= =mZpQ -----END PGP SIGNATURE----- --=-=-=--