On Fri, Apr 23, 2021 at 10:08 PM Sylvain Hubert <champignoom@gmail.com> wrote:
Dear Devs,

Sorry if this is not the best place for reporting bugs.

I'm trying to use the lpeglabel library written in C and delivered as lpeglabel.so.

$ ls
testlabel.lua lpeglabel.so
$ cat testlabel.lua
require("lpeglabel")

The ConTeXt binary cannot load the library because it lacks certain Lua API:

$ context --forcecld --permitloadlib testlabel.lua
...
fatal lua error:
registered function call [1542]: ...tx/tex/texmf-context/tex/context/base/mkiv/l-package.lua:348: error loading module 'lpeglabel' from file './lpeglabel.so':
./lpeglabel.so: undefined symbol: lua_gettop


hm, lua_gettop  is a global symbol in latest luatex, it's not undefined... 
 

nor does LuaTeX:
$ luatex -luaonly testlabel.lua
error loading module 'lpeglabel' from file './lpeglabel.so':
./lpeglabel.so: undefined symbol: lua_getiuservalue


lua_getiuservalue is in lua 5.4 API, luatex is lua 5.3.6 API 
but in any case you should compile against the luatex headers, not the  stock lua 5.3.6.
I don't know lpeglabel, but luatex has the lpeg embedded and perhaps it can clash with the library. 

--
luigi