Subject: Re: bug#32770: Packaging SLIME/SWANK as Common Lisp library

From: Ricardo Wurmus <[email-masked]>
Date: Thu, 04 Oct 2018 20:08:30 +0200

Hi,

>> Adding to *foreign-library-directories* at compile time may allow a
>> package to compile, but I get the feeling that it may not have the
>> desired effect when you try to load the package later on.
>
> Why?  In my experience it works for a compiled Next executable.
>
>> I guess another approach we could take if replacement is undesirable
>> would be to modify the cffi package to honour some environment variable
>> for its default, and then add that variable to the search path for
>> cffi.
>
> The cffi:*foreign-library-directories* approach got recommended to me on
> the CFFI mailing list.  I find it similar to what you want, a sort of
> environment variable (a search-path global variable).  I haven't looked
> into Nix.
>
>> I personally tend to favour replacement, but others could chime in here
>> as well since this problem isn't specific to lisp packaging.

We usually replace plain references to libraries with exact store paths.

> Could this be automated?  What I like with cffi:*foreign-library-directories* is
> that we could automatically push
>
>     (string-append (assoc-ref inputs "foo") "/lib)
>
> to it so that packages only have to write something like
>
>     #:cffi-packages (list ,cl-sqlite ,cl-foo...)

This sounds useful, but to me it feels like wrapping executables in
LD_LIBRARY_PATH, which we try hard to avoid.

When using cffi:*foreign-library-directories* how would we deal with
cases where we have more than one package specifying cffi-packages?
Would this option need to be considered for every package in the package
closure?  Would it need to be handled by a profile hook in case these
packages are installed?

--
Ricardo