cl: loading cl+ssl on guix or nix
Table of Contents
Context: for development, I prefer to load my common lisp libraries
from quicklisp because it's more flexible that loading them from nix
or guix's store. The main caveat, is that it doesn't work so well with
systems that uses CFFI. It is much easier to load those systems from
the store (when available). The system cl+ssl
is one such package
that I often use.
Here's an example of what usually happens when trying to load a system that uses CFFI from quicklisp:
CL-USER> (ql:quickload :cl+ssl) To load "cl+ssl": Load 1 ASDF system: cl+ssl ; Loading "cl+ssl" ............ debugger invoked on a CFFI:LOAD-FOREIGN-LIBRARY-ERROR in thread #<THREAD tid=16059 "main thread" RUNNING {100A660003}>: Unable to load any of the alternatives: ("libcrypto.so.1.1" "libcrypto.so.1.0.0" "libcrypto.so.3" "libcrypto.so")
cffi
fails to find the shared libraries because it is (usually) told
to look in standard locations, but shared libraries are not provided
at those locations under guix or nix.
1. Where is the system loaded from?
As explained in common lisp on guix, in guix
, asdf
is patched to
load configurations from directories in the environment variable
$XDG_CONFIG_DIRS
.
For example, if the package sbcl-cl+ssl
(a variant of cl-cl+ssl
)
is installed, we can find the corresponding asdf
configuration files
> echo $XDG_CONFIG_DIRS | tr : '\n' | xargs -n 1 find | grep -F 'cl+ssl' /home/fstamour/.guix-home/profile/etc/common-lisp/asdf-output-translations.conf.d/50-cl+ssl.conf /home/fstamour/.guix-home/profile/etc/common-lisp/source-registry.conf.d/50-cl+ssl.conf
2. Troubleshooting
2.1. check where the system is loaded from
(asdf:locate-system :cl+ssl)
2.2. make sure you don't call (ql:use-only-quicklisp-systems)
In the end, that was my issue 🙃
2.3. Try to locate and load the system without user configurations
To confirm that sbcl
, asdf
and cl+ssl
are configured correctly.
$ sbcl --no-userinit *(require 'asdf) ("ASDF" "asdf" "UIOP" "uiop") * (asdf:locate-system :cl+ssl) T NIL #P"/gnu/store/v0h4ija8d9h43d6x1wmp96w4bygb63jd-sbcl-cl+ssl-0.0.0-6.17d5cdd/share/common-lisp/sbcl/cl+ssl/cl+ssl.asd" NIL NIL NIL NIL
3. Related notes
4. Backlinks
- Common lisp on guix (commonlisponguix.org)
- Guix (guix.org)
- Common lisp (common-lisp.org)