How should I deal with packages that require FFI external libraries?

Karl Berry karl at
Sat Apr 15 00:31:41 CEST 2023

    1) When the external library is loaded, I have something like:
    lib = ffi.load('<path to the .so file>')

    For now, the path is hardcoded. Where should I put the .so file so
    that luatex finds it? What is good practice for CTAN/TeXLive? Does
    luatex rely on kpsewhich for that kind of thing?

Kpathsea has a path CLUAINPUTS, but I don't know if LuaTeX actually uses
it. When you ask on the luatex list, they can advise.

>From texmf.cnf:
CLUAINPUTS = $TEXMFDOTDIR;$SELFAUTOLOC/lib/{$progname,$engine,}/lua//

    2) Can I distribute the .so file (or .dll) with the CTAN/TeXLive
    package or should it be compiled on the user computer?

TeX Live does not distribute any user-created .so files, and I don't
foresee this changing. I can't speak for whether CTAN is willing to hold

For the rest, I have nothing to add to Norbert's replies.
Sorry I can't be more help ... --best, karl.

More information about the tex-live mailing list.