我正在尝试在 Mac OS 10.14 上将 luasql-odbc 库与 LuaLaTeX 结合使用。我使用 lua 5.3 和 luarocks 安装了该库,并且它可以很好地与 Lua 一起加载。但是,当我尝试使用 LuaLaTeX 加载它时遇到了问题。
我使用了以下代码:
\documentclass{article}
\usepackage{fontspec}
\usepackage{luacode}
\usepackage{luapackageloader}
\begin{document}
\begin{luacode}
package.path = "/usr/local/lib/lua/5.3/?;" .. package.path
package.cpath = "/usr/local/lib/lua/5.3/?.so;" .. package.cpath
driver = require "luasql.odbc"
\end{luacode}
\end{document}
这就是我得到的:
This is LuaHBTeX, Version 1.13.2 (TeX Live 2021)
system commands enabled.
(./test-luasql-orbd.tex
LaTeX2e <2021-06-01> patch level 1
tput: No value for $TERM and no -T specified
L3 programming layer <2021-08-27>
(/usr/local/texlive/2021/texmf-dist/tex/latex/base/article.cls
Document Class: article 2021/02/12 v1.4n Standard LaTeX document class
(/usr/local/texlive/2021/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2021/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/local/texlive/2021/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(/usr/local/texlive/2021/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2021/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)))
(/usr/local/texlive/2021/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
(/usr/local/texlive/2021/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/local/texlive/2021/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/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)))
(/usr/local/texlive/2021/texmf-dist/tex/luatex/luapackageloader/luapackageloade
r.sty) (./test-luasql-orbd.aux)
(/usr/local/texlive/2021/texmf-dist/tex/latex/base/ts1cmr.fd)error loading module
'luasql.odbc' from file './luasql/odbc.so':
dlopen(./luasql/odbc.so, 6): Symbol not found: _lua_newuserdatauv
Referenced from: ./luasql/odbc.so
Expected in: flat namespace
in ./luasql/odbc.so
stack traceback:
[C]: in ?
[C]: in local 'f'
...1/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua:398: in local 'loo
kup'
...1/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua:429: in function <
...1/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua:419>
[C]: in function 'require'
[\directlua]:3: in main chunk.
\luacode@dbg@exec ...code@maybe@printdbg {#1} #1 }
l.12 \end{luacode}
?
有什么想法可以解决这个问题吗?
更新
我读到,为了使用 Lua C 库,lua(hb)tex 应该使用该--nostrip
选项进行编译,我照做了。我将生成的 luatex 和 luahbtex 文件移动到我的 TEXMF 树的 bin 目录中,然后运行:
sudo mktexlsr
sudo fmtutil-sys --all
不幸的是,问题是一样的......