ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Bug: missing Lua API in binaries
@ 2021-04-23 20:07 Sylvain Hubert
  2021-04-23 21:51 ` luigi scarso
  0 siblings, 1 reply; 4+ messages in thread
From: Sylvain Hubert @ 2021-04-23 20:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1048 bytes --]

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
...

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

It seems that lua_gettop and others are optimized out from the `context`
binary, while lua_getiuservalue and others are missing from `luatex`.

I'm not sure if it works but I would suggest adding `__attribute__
((used))` to the `LUA_API` macro if the binaries are compiled with gcc.

Best,
Sylvain

[-- Attachment #1.2: Type: text/html, Size: 1461 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug: missing Lua API in binaries
  2021-04-23 20:07 Bug: missing Lua API in binaries Sylvain Hubert
@ 2021-04-23 21:51 ` luigi scarso
  2021-04-23 23:32   ` Sylvain Hubert
  0 siblings, 1 reply; 4+ messages in thread
From: luigi scarso @ 2021-04-23 21:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1218 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 2158 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug: missing Lua API in binaries
  2021-04-23 21:51 ` luigi scarso
@ 2021-04-23 23:32   ` Sylvain Hubert
  2021-04-24  0:01     ` luigi scarso
  0 siblings, 1 reply; 4+ messages in thread
From: Sylvain Hubert @ 2021-04-23 23:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2203 bytes --]

You're right, I just checked the symbols of luatex and they contain all the
APIs of lua 5.3.
So I guess the problem is specific to luametatex and the latest context.

> but in any case you should compile against the luatex headers, not the
stock lua 5.3.6.

Does luatex have dedicated headers different from the ones for stock lua?

On Fri, 23 Apr 2021 at 23:53, luigi scarso <luigi.scarso@gmail.com> wrote:

>
>
> 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
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 3911 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug: missing Lua API in binaries
  2021-04-23 23:32   ` Sylvain Hubert
@ 2021-04-24  0:01     ` luigi scarso
  0 siblings, 0 replies; 4+ messages in thread
From: luigi scarso @ 2021-04-24  0:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 518 bytes --]

On Sat, Apr 24, 2021 at 1:33 AM Sylvain Hubert <champignoom@gmail.com>
wrote:

> You're right, I just checked the symbols of luatex and they contain all
> the APIs of lua 5.3.
> So I guess the problem is specific to luametatex and the latest context.
>
> > but in any case you should compile against the luatex headers, not the
> stock lua 5.3.6.
>
> Does luatex have dedicated headers different from the ones for stock lua?
>

There are some small differences, because we had to harmonize luajit and
lua .

-- 
luigi

[-- Attachment #1.2: Type: text/html, Size: 988 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-24  0:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 20:07 Bug: missing Lua API in binaries Sylvain Hubert
2021-04-23 21:51 ` luigi scarso
2021-04-23 23:32   ` Sylvain Hubert
2021-04-24  0:01     ` luigi scarso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).