After a while, I'd like to play again with the FFI library with the help of an answer and a tutorial written by Henri Menke.
I run an archlinux up-to-date system with a TeXLive 2021 vanilla installed and up-to-date.
Unfortunately, running the following minimal example:
\documentclass{minimal}
\usepackage{luacode}
\begin{luacode}
local ffi = require("ffi")
local gsl = ffi.load("gsl")
\end{luacode}
\begin{document}
\end{document}
fails with:
christophe@cesium /tmp % lualatex --shell-escape t.tex
This is LuaHBTeX, Version 1.13.2 (TeX Live 2021)
system commands enabled.
(./t.tex
LaTeX2e <2021-11-15>
L3 programming layer <2021-11-22>
(/usr/local/texlive/2021/texmf-dist/tex/latex/base/minimal.cls
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
) (/usr/local/texlive/2021/texmf-dist/tex/lualatex/luacode/luacode.sty
(/usr/local/texlive/2021/texmf-dist/tex/generic/iftex/ifluatex.sty
(/usr/local/texlive/2021/texmf-dist/tex/generic/iftex/iftex.sty))
(/usr/local/texlive/2021/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
(/usr/local/texlive/2021/texmf-dist/tex/luatex/ctablestack/ctablestack.sty)))[\
directlua]:2: could not load library gsl
stack traceback:
[C]: in function 'FFISUPPORTED'
[\directlua]:2: in main chunk.
\luacode@dbg@exec ...code@maybe@printdbg {#1} #1 }
l.8 \end{luacode*}
My system has:
/usr/lib/libgsl.so
/usr/lib/libgsl.so.25
/usr/lib/libgsl.so.25.1.0
/usr/lib/libgslcblas.so
/usr/lib/libgslcblas.so.0
/usr/lib/libgslcblas.so.0.0.0
I tried hardcoding the path, like local gsl = ffi.load("/usr/lib/libgsl.so"), but I still get could not load library /usr/lib/libgsl.so.
The luatex manual has no hint : it doesn't even mention the ffi library. Should I use luaJITtex instead? I'm quite confused to be honest.
Note that luajit is able to find the gsl library but fails too:
christophe@cesium /tmp % luajit -v
LuaJIT 2.0.5 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
christophe@cesium /tmp % cat t.lua
local ffi = require("ffi")
local gsl = ffi.load("gsl")
christophe@cesium /tmp % luajit t.lua
luajit: t.lua:2: /usr/lib/libgsl.so: undefined symbol: cblas_ctrmv
Any ideas?
ffilibrary inluatex? – cjorssen Nov 30 '21 at 14:35luajitbut obfuscated butluatexI guess? – cjorssen Nov 30 '21 at 14:37ffilibrary in LuaJIT, so you can use the documentation there. The repo of the used library is https://github.com/facebookarchive/luaffifb, but that mostly links to the LuaJIT docs. As you've seen, error messages can be slightly different and there's also some difference regardingNULL. – Marcel Krüger Nov 30 '21 at 14:59