Skip to contentSkip to conversation

Revert "package/luajit: back to mainline and bump to 05f1984e"

PATCH In review Romain Naour 4 participants 13 messages Nov 6, 2021 – Nov 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "package/luajit: back to mainline and bump to 05f1984e"

This reverts commit 9450b53c8e06f1b5a75840b82c0f4663a5d75c45 since it introcude a regretion to luvi package [1].

luvi doesn't work since the luv static linking doesn't seems to
work anymore.
(see https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c08622d70f6b7067)

 # luvi -v

[string "return require('init')(...)"]:1: module 'init' not found:

	no field package.preload['init']
	no file './init.lua'
	no file '/usr/share/luajit-2.1.0-beta3/init.lua'
	no file '/usr/local/share/lua/5.1/init.lua'
	no file '/usr/local/share/lua/5.1/init/init.lua'
	no file '/usr/share/lua/5.1/init.lua'
	no file '/usr/share/lua/5.1/init/init.lua'
	no file './init.so'
	no file '/usr/local/lib/lua/5.1/init.so'
	no file '/usr/lib/lua/5.1/init.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'

stack traceback:

	[C]: in function 'require'
	[string "return require('init')(...)"]:1: in main chunk

luvi now try to load init.lua script:
https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176

Luvi seems to rely on some moonjit extentions [2] not available yet in luajit.

[1] http://lists.busybox.net/pipermail/buildroot/2021-October/627134.html
[2] https://github.com/moonjit/moonjit/blob/master/doc/extensions.md

Cc Francois Perrad <[email protected]>
Cc Jörg Krause <[email protected]>
---
 package/luajit/Config.in   | 2 +-
 package/luajit/luajit.hash | 4 ++--
 package/luajit/luajit.mk   | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
package/luajit/Config.in +1 -1
index e4e1249240..eb3eb01998 100644
@@ -27,7 +27,7 @@ config BR2_PACKAGE_LUAJIT
 	  ABI-compatible to the standard Lua interpreter and can be
 	  deployed as a drop-in replacement.
 
-	  https://luajit.org/luajit.html
+	  https://github.com/moonjit/moonjit
 
 if BR2_PACKAGE_LUAJIT
 
package/luajit/luajit.hash +2 -2
index 1497ee9df4..532ec0b294 100644
@@ -1,5 +1,5 @@
 # Locally calculated
-sha256  b1b19f92451a661ba1167ee0b259299616cb3a1cdaf5ab05d7ccffaffeb4a0fb  luajit-05f1984e1a862e4b3d3c3b370c773492e2edf84a.tar.gz
+sha256 c3de8e29aa617fc594c043f57636ab9ad71af2b4a3a513932b05f5cdaa4320b2  luajit-2.1.2.tar.gz
 
 # Locally calculated
-sha256  43fc251179d900f9948e51dd3cc93733d1219f2db060faaa0c8100ad054f54d8  COPYRIGHT
+sha256 aa64a7706ded773011b933f4230d7b35ba662598197f82ac2c7bca62abdaa4d7  COPYRIGHT
package/luajit/luajit.mk +2 -2
index fbbd8ebc70..defa21dd3f 100644
@@ -4,8 +4,8 @@
 #
 ################################################################################
 
-LUAJIT_VERSION = 05f1984e1a862e4b3d3c3b370c773492e2edf84a
-LUAJIT_SITE = $(call github,LuaJIT,LuaJIT,$(LUAJIT_VERSION))
+LUAJIT_VERSION = 2.1.2
+LUAJIT_SITE = $(call github,moonjit,moonjit,$(LUAJIT_VERSION))
 LUAJIT_LICENSE = MIT
 LUAJIT_LICENSE_FILES = COPYRIGHT
 
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 29 lines · Romain Naour

This reverts commit 9450b53c8e06f1b5a75840b82c0f4663a5d75c45 since it introcude a regretion to luvi package [1].

luvi doesn't work since the luv static linking doesn't seems to work anymore.
(see
https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c08622d70f6b7067
)

 # luvi -v

[string "return require('init')(...)"]:1: module 'init' not found:

        no field package.preload['init']
        no file './init.lua'
        no file '/usr/share/luajit-2.1.0-beta3/init.lua'
        no file '/usr/local/share/lua/5.1/init.lua'
        no file '/usr/local/share/lua/5.1/init/init.lua'
        no file '/usr/share/lua/5.1/init.lua'
        no file '/usr/share/lua/5.1/init/init.lua'
        no file './init.so'
        no file '/usr/local/lib/lua/5.1/init.so'
        no file '/usr/lib/lua/5.1/init.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'

stack traceback:
[C]: in function 'require'
[string "return require('init')(...)"]:1: in main chunk

Quoted 10 lines

luvi now try to load init.lua script:
https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176

Luvi seems to rely on some moonjit extentions [2] not available yet in luajit.

[1] http://lists.busybox.net/pipermail/buildroot/2021-October/627134.html
[2] https://github.com/moonjit/moonjit/blob/master/doc/extensions.md

the module init.lua is supplied by luvi (see
https://github.com/luvit/luvi/blob/master/src/lua/init.lua)
and installed somewhere or not (I cannot find it).

moonjit 2.1.2 try to load a Lua module from these locations :

    './init.lua'
    '/usr/share/luajit-2.1.2/init.lua' (usually reserved to luajit itself)
    '/usr/local/share/lua/5.1/init.lua'
    '/usr/local/share/lua/5.1/init/init.lua'
    '/usr/share/lua/5.1/init.lua'
    '/usr/share/lua/5.1/init/init.lua'

luajit try to load a Lua module from these locations :
'./init.lua'
'/usr/share/luajit-2.1.0-beta3/init.lua' (usually reserved to luajit
itself)

    '/usr/local/share/lua/5.1/init.lua'
    '/usr/local/share/lua/5.1/init/init.lua'
    '/usr/share/lua/5.1/init.lua'
    '/usr/share/lua/5.1/init/init.lua'

this issue is not about moonjit vs luajit,
it is about init.lua is not installed by luvi package.

François

Quoted 5 lines
Cc Francois Perrad <[email protected]>
Cc Jörg Krause <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Le 06/11/2021 à 22:19, François Perrad a écrit :

Quoted 67 lines

Le sam. 6 nov. 2021 à 20:01, Romain Naour <[email protected] <mailto:[email protected]>> a écrit :

    This reverts commit 9450b53c8e06f1b5a75840b82c0f4663a5d75c45 since it
    introcude a regretion to luvi package [1].

    luvi doesn't work since the luv static linking doesn't seems to
    work anymore.
    (see
    https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c08622d70f6b7067 <https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c08622d70f6b7067>)

     # luvi -v

    [string "return require('init')(...)"]:1: module 'init' not found:

            no field package.preload['init']
            no file './init.lua'
            no file '/usr/share/luajit-2.1.0-beta3/init.lua'
            no file '/usr/local/share/lua/5.1/init.lua'
            no file '/usr/local/share/lua/5.1/init/init.lua'
            no file '/usr/share/lua/5.1/init.lua'
            no file '/usr/share/lua/5.1/init/init.lua'
            no file './init.so'
            no file '/usr/local/lib/lua/5.1/init.so'
            no file '/usr/lib/lua/5.1/init.so'
            no file '/usr/local/lib/lua/5.1/loadall.so'

    stack traceback:
            [C]: in function 'require'
            [string "return require('init')(...)"]:1: in main chunk

    luvi now try to load init.lua script:
    https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176
    <https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176>

    Luvi seems to rely on some moonjit extentions [2] not available yet in
    luajit.

    [1] http://lists.busybox.net/pipermail/buildroot/2021-October/627134.html
    <http://lists.busybox.net/pipermail/buildroot/2021-October/627134.html>
    [2] https://github.com/moonjit/moonjit/blob/master/doc/extensions.md
    <https://github.com/moonjit/moonjit/blob/master/doc/extensions.md>

the module init.lua is supplied by luvi (see
https://github.com/luvit/luvi/blob/master/src/lua/init.lua
<https://github.com/luvit/luvi/blob/master/src/lua/init.lua>)
and installed somewhere or not (I cannot find it).

moonjit 2.1.2 try to load a Lua module from these locations :
    './init.lua'
    '/usr/share/luajit-2.1.2/init.lua' (usually reserved to luajit itself) '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

luajit try to load a Lua module from these locations :
    './init.lua'
    '/usr/share/luajit-2.1.0-beta3/init.lua' (usually reserved to luajit itself) '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

Quoted 1 line

this issue is not about moonjit vs luajit,

The luajit vs moonjit traces are clearly not the same (using strace)

moonjit doesn't even try to open init.lua (init.lua is not installed in target):

open("/usr/bin/luvi", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 13
statx(13, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0,
stx_mode=S_IFREG|0755, stx_size=401472, ...}) = 0
pread64(13, "\213\240\5\0h'\4\0\373\277\5\0X5\4\0\342\305\5\0t-\4\0G\260\5\0\34'\4\0"...,
4096, 397376) = 4096
pread64(13, "\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\351\232\5\0K\253\5\0\361\232\5\0\367\232\5"..., 4096, 393283) = 4096
pread64(13, "\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N"...,
4096, 389190) = 4096
pread64(13, "ed\0lz.inflate.meta\0BEST_SPEED\0BE"..., 4096, 385097) = 4096 pread64(13, "Luvi/build/luvi-2.12.0/deps/lua-"..., 4096, 381004) = 4096
pread64(13, "ept fail\0#1 BIO must be memory t"..., 4096, 376911) = 4096
pread64(13, "scape_ca_dn_bug\0netscape_challen"..., 4096, 372818) = 4096
pread64(13, " to cert\0PKCS12_careate failed,p"..., 4096, 368725) = 4096
pread64(13,
"\200+\10\0\0-\t\0\08\t\7\t9\t\0\t\22\n\0\0B\t\2\3\22\3\n\0\22\10\t"..., 4096, 364632) = 4096
pread64(13, "'\7\2\0\22\10\2\0\22\t\3\0B\5\5\2&\4\5\4L\4\2\0K\0\1\0\6\\\6/"...,
4096, 360539) = 4096
pread64(13, "ve is too large\0validation faile"..., 4096, 356446) = 4096
pread64(13, "\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21"..., 4096, 352353) = 4096
pread64(13, "TP\237\345\3p\300\343\200\1\240\341\30`\0\342H\200\237\345\25V\240\341\1\220\240\341\0\0\227\345"..., 4096, 348260) = 4096
pread64(13,
"\1#\0\0:\1\0P\341\32\0\0\232\2\0\21\341\33\0\0\n\21?o\341\20/o\341\2 C"...,
4096, 344167) = 4096
pread64(13, "\215\342\4\360\235\344\363G-\351\34\221\237\345\0`\240\341\0@\240\343\2p\240\341\f\0\220\345\4 "..., 4096, 340074) = 4096
pread64(13, "!\315\341\3\0\226\350\276\v\377\353\f\0p\343\0\0P\23\0p\240\341%\0\0\272\0\0P\343\0"..., 4096, 335981) = 4096
pread64(13, "@\26\377\353\0\0P\343\n\0\0\32\4\0\235\345\326\f\0\353\0 \240\341\0010\240\341\4\0\240\341"..., 4096, 331888) = 4096
write(1, "luvi v2.12.0\n", 13luvi v2.12.0

luajit:

pipe2([6, 7], O_NONBLOCK|O_CLOEXEC) = 0
eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK) = 8
open("./init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/share/luajit-2.1.0-beta3/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("./init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("/usr/local/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/lua/5.1/loadall.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
write(2, "[string \"return require('init')("..., 596[string "return require('init')(...)"]:1: module 'init' not found:

Something is strange here...

Best regards,
Romain

Quoted 10 lines

it is about init.lua is not installed by luvi package.

François

<mailto:[email protected]>>
Cc: Francois Perrad <[email protected] <mailto:[email protected]>>
Cc: Jörg Krause <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
Quoted 173 lines · Romain Naour
Quoted 5 lines · François Perrad

Le sam. 6 nov. 2021 à 20:01, Romain Naour <[email protected] <mailto:[email protected]>> a écrit :

Quoted 7 lines

This reverts commit 9450b53c8e06f1b5a75840b82c0f4663a5d75c45 since it introcude a regretion to luvi package [1].

luvi doesn't work since the luv static linking doesn't seems to work anymore.
(see

https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c08622d70f6b7067
<
https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c08622d70f6b7067

Quoted 19 lines

)

     # luvi -v
    [string "return require('init')(...)"]:1: module 'init' not found:

            no field package.preload['init']
            no file './init.lua'
            no file '/usr/share/luajit-2.1.0-beta3/init.lua'
            no file '/usr/local/share/lua/5.1/init.lua'
            no file '/usr/local/share/lua/5.1/init/init.lua'
            no file '/usr/share/lua/5.1/init.lua'
            no file '/usr/share/lua/5.1/init/init.lua'
            no file './init.so'
            no file '/usr/local/lib/lua/5.1/init.so'
            no file '/usr/lib/lua/5.1/init.so'
            no file '/usr/local/lib/lua/5.1/loadall.so'

    stack traceback:
Quoted 8 lines
            [C]: in function 'require'
            [string "return require('init')(...)"]:1: in main chunk

    luvi now try to load init.lua script:
    https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176
    <https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176>

    Luvi seems to rely on some moonjit extentions [2] not available yet

in

Quoted 3 lines
    luajit.

    [1]

http://lists.busybox.net/pipermail/buildroot/2021-October/627134.html

Quoted 1 line
    <

http://lists.busybox.net/pipermail/buildroot/2021-October/627134.html>

Quoted 4 lines

[2] https://github.com/moonjit/moonjit/blob/master/doc/extensions.md
<https://github.com/moonjit/moonjit/blob/master/doc/extensions.md>

Quoted 8 lines

the module init.lua is supplied by luvi (see
https://github.com/luvit/luvi/blob/master/src/lua/init.lua
<https://github.com/luvit/luvi/blob/master/src/lua/init.lua>)
and installed somewhere or not (I cannot find it).

moonjit 2.1.2 try to load a Lua module from these locations :
'./init.lua'
'/usr/share/luajit-2.1.2/init.lua' (usually reserved to luajit

itself)

Quoted 8 lines
    '/usr/local/share/lua/5.1/init.lua'
    '/usr/local/share/lua/5.1/init/init.lua'
    '/usr/share/lua/5.1/init.lua'
    '/usr/share/lua/5.1/init/init.lua'

luajit try to load a Lua module from these locations :
'./init.lua'
'/usr/share/luajit-2.1.0-beta3/init.lua' (usually reserved to luajit

itself)

Quoted 6 lines
    '/usr/local/share/lua/5.1/init.lua'
    '/usr/local/share/lua/5.1/init/init.lua'
    '/usr/share/lua/5.1/init.lua'
    '/usr/share/lua/5.1/init/init.lua'

this issue is not about moonjit vs luajit,

The luajit vs moonjit traces are clearly not the same (using strace)

moonjit doesn't even try to open init.lua (init.lua is not installed in target):

open("/usr/bin/luvi", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 13 statx(13, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=401472, ...}) = 0 pread64(13,

"\213\240\5\0h'\4\0\373\277\5\0X5\4\0\342\305\5\0t-\4\0G\260\5\0\34'\4\0"..., 4096, 397376) = 4096
pread64(13,

"\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\351\232\5\0K\253\5\0\361\232\5\0\367\232\5"..., 4096, 393283) = 4096
pread64(13,

"\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N"..., 4096, 389190) = 4096
pread64(13, "ed\0lz.inflate.meta\0BEST_SPEED\0BE"..., 4096, 385097) = 4096 pread64(13, "Luvi/build/luvi-2.12.0/deps/lua-"..., 4096, 381004) = 4096 pread64(13, "ept fail\0#1 BIO must be memory t"..., 4096, 376911) = 4096 pread64(13, "scape_ca_dn_bug\0netscape_challen"..., 4096, 372818) = 4096 pread64(13, " to cert\0PKCS12_careate failed,p"..., 4096, 368725) = 4096 pread64(13, "\200+\10\0\0-\t\0\08\t\7\t9\t\0\t\22\n\0\0B\t\2\3\22\3\n\0\22\10\t"..., 4096,
364632) = 4096
pread64(13, "'\7\2\0\22\10\2\0\22\t\3\0B\5\5\2&\4\5\4L\4\2\0K\0\1\0\6\\\6/"..., 4096, 360539) = 4096
pread64(13, "ve is too large\0validation faile"..., 4096, 356446) = 4096 pread64(13,

"\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21"..., 4096, 352353) = 4096
pread64(13,

"TP\237\345\3p\300\343\200\1\240\341\30`\0\342H\200\237\345\25V\240\341\1\220\240\341\0\0\227\345"..., 4096, 348260) = 4096
pread64(13,
"\1#\0\0:\1\0P\341\32\0\0\232\2\0\21\341\33\0\0\n\21?o\341\20/o\341\2
C"...,
4096, 344167) = 4096
pread64(13,
"\215\342\4\360\235\344\363G-\351\34\221\237\345\0`\240\341\0@ \240\343\2p\240\341\f\0\220\345\4
"..., 4096, 340074) = 4096
pread64(13,

"!\315\341\3\0\226\350\276\v\377\353\f\0p\343\0\0P\23\0p\240\341%\0\0\272\0\0P\343\0"..., 4096, 335981) = 4096
pread64(13, "@\26\377\353\0\0P\343\n\0\0\32\4\0\235\345\326\f\0\353\0 \240\341\0010\240\341\4\0\240\341"..., 4096, 331888) = 4096
write(1, "luvi v2.12.0\n", 13luvi v2.12.0

luajit:

pipe2([6, 7], O_NONBLOCK|O_CLOEXEC) = 0
eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK) = 8
open("./init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/luajit-2.1.0-beta3/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/local/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory) open("/usr/local/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory)
open("/usr/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("./init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("/usr/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file
or directory)
open("/usr/local/lib/lua/5.1/loadall.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
write(2, "[string \"return require('init')("..., 596[string "return require('init')(...)"]:1: module 'init' not found:

Quoted 6 lines

Something is strange here...

Best regards,
Romain

luvi requires a luajit built with the -DLUAJIT_ENABLE_LUA52COMPAT flag. it was the default with moonjit.
the package luvi must :
select BR2_PACKAGE_LUAJIT_COMPAT52

François

Quoted 14 lines
Quoted 9 lines

it is about init.lua is not installed by luvi package.

François

<mailto:[email protected]>>
Cc: Francois Perrad <[email protected] <mailto:

[email protected]>>

Quoted 2 lines
Cc Jörg Krause <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Hi François, Hi Romain,

the issue has nothing to do with static linking (the issue Romain cited was raised by in 2015 has been fixed long time ago) nor is it an issue about moonjit vs luajit as correctly stated by François. Also, it is not about setting LUAJIT_ENABLE_LUA52COMPAT.

After applying the patch [1] from Romain I am building and running luvi on my machine successfully:

```
LD_LIBRARY_PATH="./output/target/usr/lib/:./output/target/lib" ./output/target/usr/bin/luvi
./output/target/usr/bin/luvi v2.12.0
libuv: 1.42.0
```

The file init.lua is Luajitted into an object file:

```
Building $BR/output/host/share/luajit-2.1.0-beta3/?.lua Luajitted $BR/output/build/luvi-2.12.0/src/lua/init.lua: $BR/output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o
```

My first guess is, that the byte code generated by luajit is generated for a different machine than luvi is actually running on. Is file output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o printing the correct file type information?

[1] http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Best regards
Jörg Krause

Quoted 197 lines · François Perrad

Le sam. 6 nov. 2021 à 23:02, Romain Naour <[email protected]> a écrit :

Quoted 185 lines

Le 06/11/2021 à 22:19, François Perrad a écrit :

Quoted 82 lines

Le sam. 6 nov. 2021 à 20:01, Romain Naour <[email protected] <mailto:[email protected]>> a écrit :

     This reverts commit 9450b53c8e06f1b5a75840b82c0f4663a5d75c45 since it
     introcude a regretion to luvi package [1].

     luvi doesn't work since the luv static linking doesn't seems to
     work anymore.
     (see

 https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c0862
2d70f6b7067
<https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c0862
2d70f6b7067>)

      # luvi -v

     [string "return require('init')(...)"]:1: module 'init' not found:

             no field package.preload['init']
             no file './init.lua'
             no file '/usr/share/luajit-2.1.0-beta3/init.lua' no file '/usr/local/share/lua/5.1/init.lua' no file '/usr/local/share/lua/5.1/init/init.lua' no file '/usr/share/lua/5.1/init.lua' no file '/usr/share/lua/5.1/init/init.lua' no file './init.so'
             no file '/usr/local/lib/lua/5.1/init.so' no file '/usr/lib/lua/5.1/init.so'
             no file '/usr/local/lib/lua/5.1/loadall.so'

     stack traceback:
             [C]: in function 'require'
             [string "return require('init')(...)"]:1: in main chunk

     luvi now try to load init.lua script:
     https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176
     <https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176>

     Luvi seems to rely on some moonjit extentions [2] not available yet in
     luajit.

     [1] http://lists.busybox.net/pipermail/buildroot/2021-
October/627134.html
     <http://lists.busybox.net/pipermail/buildroot/2021-
October/627134.html>
     [2]
https://github.com/moonjit/moonjit/blob/master/doc/extensions.md

 <https://github.com/moonjit/moonjit/blob/master/doc/extensions.md>

the module init.lua is supplied by luvi (see
https://github.com/luvit/luvi/blob/master/src/lua/init.lua
<https://github.com/luvit/luvi/blob/master/src/lua/init.lua>)
and installed somewhere or not (I cannot find it).

moonjit 2.1.2 try to load a Lua module from these locations :
    './init.lua'
    '/usr/share/luajit-2.1.2/init.lua' (usually reserved to luajit itself)
    '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

luajit try to load a Lua module from these locations :
    './init.lua' '/usr/share/luajit-2.1.0-beta3/init.lua' (usually reserved to luajit itself)
    '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

Quoted 1 line

this issue is not about moonjit vs luajit,

The luajit vs moonjit traces are clearly not the same (using strace)

moonjit doesn't even try to open init.lua (init.lua is not installed in target):

open("/usr/bin/luvi", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 13 statx(13, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=401472, ...}) = 0 pread64(13, "\213\240\5\0h'\4\0\373\277\5\0X5\4\0\342\305\5\0t- \4\0G\260\5\0\34'\4\0"...,
4096, 397376) = 4096
pread64(13, "\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\351\232\5\0K\253\5\0\361\232\5\0\
367\232\5"...,
4096, 393283) = 4096
pread64(13, "\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\
334N"...,
4096, 389190) = 4096
pread64(13, "ed\0lz.inflate.meta\0BEST_SPEED\0BE"..., 4096, 385097) = 4096
pread64(13, "Luvi/build/luvi-2.12.0/deps/lua-"..., 4096, 381004) = 4096
pread64(13, "ept fail\0#1 BIO must be memory t"..., 4096, 376911) = 4096
pread64(13, "scape_ca_dn_bug\0netscape_challen"..., 4096, 372818) = 4096
pread64(13, " to cert\0PKCS12_careate failed,p"..., 4096, 368725) = 4096
pread64(13,
"\200+\10\0\0- \t\0\08\t\7\t9\t\0\t\22\n\0\0B\t\2\3\22\3\n\0\22\10\t"..., 4096, 364632) = 4096
pread64(13, "'\7\2\0\22\10\2\0\22\t\3\0B\5\5\2&\4\5\4L\4\2\0K\0\1\0\6\\\6/"..., 4096, 360539) = 4096
pread64(13, "ve is too large\0validation faile"..., 4096, 356446) = 4096
pread64(13, "\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\2 1\21\21\21\21\21\21\21\21\21"...,
4096, 352353) = 4096
pread64(13, "TP\237\345\3p\300\343\200\1\240\341\30`\0\342H\200\237\345\25V\240\3 41\1\220\240\341\0\0\227\345"...,
4096, 348260) = 4096
pread64(13, "\1#\0\0:\1\0P\341\32\0\0\232\2\0\21\341\33\0\0\n\21?o\341\20/o\341\2 C"...,
4096, 344167) = 4096
pread64(13,
"\215\342\4\360\235\344\363G- \351\34\221\237\345\0`\240\341\0@\240\343\2p\240\341\f\0\220\345\4 "..., 4096, 340074) = 4096
pread64(13, "!\315\341\3\0\226\350\276\v\377\353\f\0p\343\0\0P\23\0p\240\341%\0\0 \272\0\0P\343\0"...,
4096, 335981) = 4096
pread64(13, "@\26\377\353\0\0P\343\n\0\0\32\4\0\235\345\326\f\0\353\0 \240\341\0010\240\341\4\0\240\341"..., 4096, 331888) = 4096 write(1, "luvi v2.12.0\n", 13luvi v2.12.0

luajit:

pipe2([6, 7], O_NONBLOCK|O_CLOEXEC)     = 0
eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK)   = 8 open("./init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/luajit-2.1.0-beta3/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/local/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory) open("/usr/local/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory) open("/usr/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("./init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("/usr/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file
or directory)
open("/usr/local/lib/lua/5.1/loadall.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
write(2, "[string \"return require('init')("..., 596[string "return require('init')(...)"]:1: module 'init' not found:

Quoted 6 lines

Something is strange here...

Best regards,
Romain

Quoted 21 lines

luvi requires a luajit built with the -DLUAJIT_ENABLE_LUA52COMPAT flag.
it was the default with moonjit.
the package luvi must :
       select BR2_PACKAGE_LUAJIT_COMPAT52

François

Quoted 13 lines
Quoted 12 lines

it is about init.lua is not installed by luvi package.

François

     <mailto:[email protected]>>
     Cc: Francois Perrad <[email protected] <mailto:[email protected]>>
     Cc: Jörg Krause <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

Le dim. 7 nov. 2021 à 12:12, Jörg Krause <[email protected]> a écrit :

Quoted 24 lines

Hi François, Hi Romain,

the issue has nothing to do with static linking (the issue Romain cited was raised by in 2015 has been fixed long time ago) nor is it an issue about moonjit vs luajit as correctly stated by François. Also, it is not about setting LUAJIT_ENABLE_LUA52COMPAT.

After applying the patch [1] from Romain I am building and running luvi on my machine successfully:

```
LD_LIBRARY_PATH="./output/target/usr/lib/:./output/target/lib"
./output/target/usr/bin/luvi
./output/target/usr/bin/luvi v2.12.0
libuv: 1.42.0
```

The file init.lua is Luajitted into an object file:

```
Building $BR/output/host/share/luajit-2.1.0-beta3/?.lua Luajitted
$BR/output/build/luvi-2.12.0/src/lua/init.lua:
$BR/output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o
```
Quoted 7 lines

My first guess is, that the byte code generated by luajit is generated for a different machine than luvi is actually running on. Is file output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o printing the correct file type information?

correct, src/init.lua is bytecoded in jitted_tmp/lua/src/init.lua_luvi_generated.o by the following command :
LUA_PATH=.../host/share/luajit-2.1.0-beta3/?.lua \
luajit -b -a arm .../src/lua/init.lua .../jitted_tmp/src/lua/init.lua_luvi_generated.o

$ nm .../jitted_tmp/src/lua/init.lua_luvi_generated.o
00000000 R luaJIT_BC_init
$ file .../jitted_tmp/src/lua/init.lua_luvi_generated.o
jitted_tmp/src/lua/init.lua_luvi_generated.o: ELF 32-bit LSB relocatable,
ARM, version 1 (SYSV), not stripped
$ nm .../luvi | grep luaJIT_BC_
000173e3 R luaJIT_BC_init
00018248 R luaJIT_BC_luvibundle
00017d28 R luaJIT_BC_luvipath
$ file .../luvi
luvi: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV),
dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux
3.2.0, with debug_info, not stripped

The LuaJIT bytecode is platform independent (not the case for PUC Lua). The bytecode could exported as C array in a .c or .h file :

    const unsigned char luaJIT_BC_init[] = {
    ...

when exported as .o or .obj, the option -a allows to set the target architecture.

François

Quoted 8 lines

[1]
http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Best regards
Jörg Krause

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#6 lore raw
In reply to Jörg Krause

Hello Jörg, François,

Le 07/11/2021 à 12:04, Jörg Krause a écrit :

Quoted 9 lines

Hi François, Hi Romain,

the issue has nothing to do with static linking (the issue Romain cited was raised by in 2015 has been fixed long time ago) nor is it an issue about moonjit vs luajit as correctly stated by François. Also, it is not about setting LUAJIT_ENABLE_LUA52COMPAT.

After applying the patch [1] from Romain I am building and running luvi on my machine successfully:

To reproduce easily the issue you can use the

./support/testing/run-tests -o testsuite-master/ -d dl/ -k --timeout-multiplier 10 tests.package.test_luvi.TestLuvi

Indeed, even with LUAJIT_ENABLE_LUA52COMPAT enabled the test is failing.

Quoted 10 lines
```
LD_LIBRARY_PATH="./output/target/usr/lib/:./output/target/lib" ./output/target/usr/bin/luvi
./output/target/usr/bin/luvi v2.12.0
libuv: 1.42.0
```

The file init.lua is Luajitted into an object file:
```
Building $BR/output/host/share/luajit-2.1.0-beta3/?.lua Luajitted $BR/output/build/luvi-2.12.0/src/lua/init.lua: $BR/output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o

Sorry, I used "static linking" but I talked about what you call "luajitted". When building using luajit I can still see init.lua_luvi_generated.o being compiled and used to link luvi binary.

Do you remember this issue ? it seems similar:
https://github.com/luvit/luvi/commit/b8781653dcb8815a3019a77baf4f3b7f7a255ebe

Quoted 6 lines

```

My first guess is, that the byte code generated by luajit is generated for a different machine than luvi is actually running on. Is file output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o printing the correct file type information?

This .o file seems ok

$ readelf -h
./TestLuvi/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o
En-tête ELF:
  Magique:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Classe:                            ELF32
  Données:                          complément à 2, système à octets de poids
faible d'abord (little endian)
  Version:                           1 (actuelle)
  OS/ABI:                            UNIX - System V
  Version ABI:                       0
  Type:                              REL (Fichier de réadressage)
  Machine:                           ARM

The luvi test has been added to buildroot before the switch to moonjit (was luajit 2.0.5). I just tested with luajit 2.0.5 and the test pass.

Best regards,
Romain

Quoted 226 lines

[1] http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Best regards
Jörg Krause

Quoted 218 lines · François Perrad

Le sam. 6 nov. 2021 à 23:02, Romain Naour <[email protected]> a écrit :

Quoted 185 lines

Le 06/11/2021 à 22:19, François Perrad a écrit :

Quoted 82 lines

Le sam. 6 nov. 2021 à 20:01, Romain Naour <[email protected] <mailto:[email protected]>> a écrit :

     This reverts commit 9450b53c8e06f1b5a75840b82c0f4663a5d75c45 since it
     introcude a regretion to luvi package [1].

     luvi doesn't work since the luv static linking doesn't seems to
     work anymore.
     (see

 https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c0862
2d70f6b7067
<https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c0862
2d70f6b7067>)

      # luvi -v

     [string "return require('init')(...)"]:1: module 'init' not found:

             no field package.preload['init']
             no file './init.lua'
             no file '/usr/share/luajit-2.1.0-beta3/init.lua' no file '/usr/local/share/lua/5.1/init.lua' no file '/usr/local/share/lua/5.1/init/init.lua' no file '/usr/share/lua/5.1/init.lua' no file '/usr/share/lua/5.1/init/init.lua' no file './init.so'
             no file '/usr/local/lib/lua/5.1/init.so' no file '/usr/lib/lua/5.1/init.so'
             no file '/usr/local/lib/lua/5.1/loadall.so'

     stack traceback:
             [C]: in function 'require'
             [string "return require('init')(...)"]:1: in main chunk

     luvi now try to load init.lua script:
     https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176
     <https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176>

     Luvi seems to rely on some moonjit extentions [2] not available yet in
     luajit.

     [1] http://lists.busybox.net/pipermail/buildroot/2021-
October/627134.html
     <http://lists.busybox.net/pipermail/buildroot/2021-
October/627134.html>
     [2]
https://github.com/moonjit/moonjit/blob/master/doc/extensions.md

 <https://github.com/moonjit/moonjit/blob/master/doc/extensions.md>

the module init.lua is supplied by luvi (see
https://github.com/luvit/luvi/blob/master/src/lua/init.lua
<https://github.com/luvit/luvi/blob/master/src/lua/init.lua>)
and installed somewhere or not (I cannot find it).

moonjit 2.1.2 try to load a Lua module from these locations :
    './init.lua'
    '/usr/share/luajit-2.1.2/init.lua' (usually reserved to luajit itself)
    '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

luajit try to load a Lua module from these locations :
    './init.lua' '/usr/share/luajit-2.1.0-beta3/init.lua' (usually reserved to luajit itself)
    '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

Quoted 1 line

this issue is not about moonjit vs luajit,

The luajit vs moonjit traces are clearly not the same (using strace)

moonjit doesn't even try to open init.lua (init.lua is not installed in target):

open("/usr/bin/luvi", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 13 statx(13, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=401472, ...}) = 0 pread64(13, "\213\240\5\0h'\4\0\373\277\5\0X5\4\0\342\305\5\0t- \4\0G\260\5\0\34'\4\0"...,
4096, 397376) = 4096
pread64(13, "\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\351\232\5\0K\253\5\0\361\232\5\0\
367\232\5"...,
4096, 393283) = 4096
pread64(13, "\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\
334N"...,
4096, 389190) = 4096
pread64(13, "ed\0lz.inflate.meta\0BEST_SPEED\0BE"..., 4096, 385097) = 4096
pread64(13, "Luvi/build/luvi-2.12.0/deps/lua-"..., 4096, 381004) = 4096
pread64(13, "ept fail\0#1 BIO must be memory t"..., 4096, 376911) = 4096
pread64(13, "scape_ca_dn_bug\0netscape_challen"..., 4096, 372818) = 4096
pread64(13, " to cert\0PKCS12_careate failed,p"..., 4096, 368725) = 4096
pread64(13,
"\200+\10\0\0- \t\0\08\t\7\t9\t\0\t\22\n\0\0B\t\2\3\22\3\n\0\22\10\t"..., 4096, 364632) = 4096
pread64(13, "'\7\2\0\22\10\2\0\22\t\3\0B\5\5\2&\4\5\4L\4\2\0K\0\1\0\6\\\6/"..., 4096, 360539) = 4096
pread64(13, "ve is too large\0validation faile"..., 4096, 356446) = 4096
pread64(13, "\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\2 1\21\21\21\21\21\21\21\21\21"...,
4096, 352353) = 4096
pread64(13, "TP\237\345\3p\300\343\200\1\240\341\30`\0\342H\200\237\345\25V\240\3 41\1\220\240\341\0\0\227\345"...,
4096, 348260) = 4096
pread64(13, "\1#\0\0:\1\0P\341\32\0\0\232\2\0\21\341\33\0\0\n\21?o\341\20/o\341\2 C"...,
4096, 344167) = 4096
pread64(13,
"\215\342\4\360\235\344\363G- \351\34\221\237\345\0`\240\341\0@\240\343\2p\240\341\f\0\220\345\4 "..., 4096, 340074) = 4096
pread64(13, "!\315\341\3\0\226\350\276\v\377\353\f\0p\343\0\0P\23\0p\240\341%\0\0 \272\0\0P\343\0"...,
4096, 335981) = 4096
pread64(13, "@\26\377\353\0\0P\343\n\0\0\32\4\0\235\345\326\f\0\353\0 \240\341\0010\240\341\4\0\240\341"..., 4096, 331888) = 4096 write(1, "luvi v2.12.0\n", 13luvi v2.12.0

luajit:

pipe2([6, 7], O_NONBLOCK|O_CLOEXEC)     = 0
eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK)   = 8 open("./init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/luajit-2.1.0-beta3/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/local/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory) open("/usr/local/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory) open("/usr/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("./init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("/usr/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file
or directory)
open("/usr/local/lib/lua/5.1/loadall.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
write(2, "[string \"return require('init')("..., 596[string "return require('init')(...)"]:1: module 'init' not found:

Quoted 6 lines

Something is strange here...

Best regards,
Romain

luvi requires a luajit built with the -DLUAJIT_ENABLE_LUA52COMPAT flag.
it was the default with moonjit.
the package luvi must :
       select BR2_PACKAGE_LUAJIT_COMPAT52

François

Quoted 13 lines
Quoted 12 lines

it is about init.lua is not installed by luvi package.

François

     <mailto:[email protected]>>
     Cc: Francois Perrad <[email protected] <mailto:[email protected]>>
     Cc: Jörg Krause <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#7 lore raw

Hi Romain,

I did run on my host machine:

```
./support/testing/run-tests -o testsuite-master/ -d dl/ -k --timeout-multiplier 10 tests.package.test_luvi.TestLuvi
```

Luvi build successfully (with the patch applied I mentioned in my previous mail. Running luvi -v hangs in qemu and eventually the command times out.

Can you provide a full log, please.

Best regards
Jörg Krause

Quoted 61 lines · Romain Naour

Hello Jörg, François,

Le 07/11/2021 à 12:04, Jörg Krause a écrit :

Quoted 9 lines

Hi François, Hi Romain,

the issue has nothing to do with static linking (the issue Romain cited was raised by in 2015 has been fixed long time ago) nor is it an issue about moonjit vs luajit as correctly stated by François. Also, it is not about setting LUAJIT_ENABLE_LUA52COMPAT.

After applying the patch [1] from Romain I am building and running luvi on my machine successfully:

To reproduce easily the issue you can use the

./support/testing/run-tests -o testsuite-master/ -d dl/ -k --timeout-multiplier 10 tests.package.test_luvi.TestLuvi

Indeed, even with LUAJIT_ENABLE_LUA52COMPAT enabled the test is failing.

Quoted 10 lines
```
LD_LIBRARY_PATH="./output/target/usr/lib/:./output/target/lib" ./output/target/usr/bin/luvi
./output/target/usr/bin/luvi v2.12.0
libuv: 1.42.0
```

The file init.lua is Luajitted into an object file:
```
Building $BR/output/host/share/luajit-2.1.0-beta3/?.lua Luajitted $BR/output/build/luvi-2.12.0/src/lua/init.lua: $BR/output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o

Sorry, I used "static linking" but I talked about what you call "luajitted". When building using luajit I can still see init.lua_luvi_generated.o being compiled and used to link luvi binary.

Do you remember this issue ? it seems similar:
https://github.com/luvit/luvi/commit/b8781653dcb8815a3019a77baf4f3b7f7a255ebe

Quoted 6 lines

```

My first guess is, that the byte code generated by luajit is generated for a different machine than luvi is actually running on. Is file output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o printing the correct file type information?

This .o file seems ok

$ readelf -h
./TestLuvi/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o
En-tête ELF:
  Magique:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Classe:                            ELF32
  Données:                          complément à 2, système à octets de poids
faible d'abord (little endian)
  Version:                           1 (actuelle)
  OS/ABI:                            UNIX - System V
  Version ABI:                       0
  Type:                              REL (Fichier de réadressage)
  Machine:                           ARM
Quoted 234 lines

The luvi test has been added to buildroot before the switch to moonjit (was luajit 2.0.5). I just tested with luajit 2.0.5 and the test pass.

Best regards,
Romain

Quoted 226 lines

[1] http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Best regards
Jörg Krause

Quoted 218 lines · François Perrad

Le sam. 6 nov. 2021 à 23:02, Romain Naour <[email protected]> a écrit :

Quoted 185 lines

Le 06/11/2021 à 22:19, François Perrad a écrit :

Quoted 82 lines

Le sam. 6 nov. 2021 à 20:01, Romain Naour <[email protected] <mailto:[email protected]>> a écrit :

     This reverts commit 9450b53c8e06f1b5a75840b82c0f4663a5d75c45 since it
     introcude a regretion to luvi package [1].

     luvi doesn't work since the luv static linking doesn't seems to
     work anymore.
     (see

 https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c0862
2d70f6b7067
<https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c0862
2d70f6b7067>)

      # luvi -v

     [string "return require('init')(...)"]:1: module 'init' not found:

             no field package.preload['init']
             no file './init.lua'
             no file '/usr/share/luajit-2.1.0-beta3/init.lua' no file '/usr/local/share/lua/5.1/init.lua' no file '/usr/local/share/lua/5.1/init/init.lua' no file '/usr/share/lua/5.1/init.lua' no file '/usr/share/lua/5.1/init/init.lua' no file './init.so'
             no file '/usr/local/lib/lua/5.1/init.so' no file '/usr/lib/lua/5.1/init.so'
             no file '/usr/local/lib/lua/5.1/loadall.so'

     stack traceback:
             [C]: in function 'require'
             [string "return require('init')(...)"]:1: in main chunk

     luvi now try to load init.lua script:
     https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176
     <https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176>

     Luvi seems to rely on some moonjit extentions [2] not available yet in
     luajit.

     [1] http://lists.busybox.net/pipermail/buildroot/2021-
October/627134.html
     <http://lists.busybox.net/pipermail/buildroot/2021-
October/627134.html>
     [2]
https://github.com/moonjit/moonjit/blob/master/doc/extensions.md

 <https://github.com/moonjit/moonjit/blob/master/doc/extensions.md>

the module init.lua is supplied by luvi (see
https://github.com/luvit/luvi/blob/master/src/lua/init.lua
<https://github.com/luvit/luvi/blob/master/src/lua/init.lua>)
and installed somewhere or not (I cannot find it).

moonjit 2.1.2 try to load a Lua module from these locations :
    './init.lua'
    '/usr/share/luajit-2.1.2/init.lua' (usually reserved to luajit itself)
    '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

luajit try to load a Lua module from these locations :
    './init.lua' '/usr/share/luajit-2.1.0-beta3/init.lua' (usually reserved to luajit itself)
    '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

Quoted 1 line

this issue is not about moonjit vs luajit,

The luajit vs moonjit traces are clearly not the same (using strace)

moonjit doesn't even try to open init.lua (init.lua is not installed in target):

open("/usr/bin/luvi", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 13 statx(13, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=401472, ...}) = 0 pread64(13, "\213\240\5\0h'\4\0\373\277\5\0X5\4\0\342\305\5\0t- \4\0G\260\5\0\34'\4\0"...,
4096, 397376) = 4096
pread64(13, "\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\351\232\5\0K\253\5\0\361\232\5\0\
367\232\5"...,
4096, 393283) = 4096
pread64(13, "\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\
334N"...,
4096, 389190) = 4096
pread64(13, "ed\0lz.inflate.meta\0BEST_SPEED\0BE"..., 4096, 385097) = 4096
pread64(13, "Luvi/build/luvi-2.12.0/deps/lua-"..., 4096, 381004) = 4096
pread64(13, "ept fail\0#1 BIO must be memory t"..., 4096, 376911) = 4096
pread64(13, "scape_ca_dn_bug\0netscape_challen"..., 4096, 372818) = 4096
pread64(13, " to cert\0PKCS12_careate failed,p"..., 4096, 368725) = 4096
pread64(13,
"\200+\10\0\0- \t\0\08\t\7\t9\t\0\t\22\n\0\0B\t\2\3\22\3\n\0\22\10\t"..., 4096, 364632) = 4096
pread64(13, "'\7\2\0\22\10\2\0\22\t\3\0B\5\5\2&\4\5\4L\4\2\0K\0\1\0\6\\\6/"..., 4096, 360539) = 4096
pread64(13, "ve is too large\0validation faile"..., 4096, 356446) = 4096
pread64(13, "\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\2 1\21\21\21\21\21\21\21\21\21"...,
4096, 352353) = 4096
pread64(13, "TP\237\345\3p\300\343\200\1\240\341\30`\0\342H\200\237\345\25V\240\3 41\1\220\240\341\0\0\227\345"...,
4096, 348260) = 4096
pread64(13, "\1#\0\0:\1\0P\341\32\0\0\232\2\0\21\341\33\0\0\n\21?o\341\20/o\341\2 C"...,
4096, 344167) = 4096
pread64(13,
"\215\342\4\360\235\344\363G- \351\34\221\237\345\0`\240\341\0@\240\343\2p\240\341\f\0\220\345\4 "..., 4096, 340074) = 4096
pread64(13, "!\315\341\3\0\226\350\276\v\377\353\f\0p\343\0\0P\23\0p\240\341%\0\0 \272\0\0P\343\0"...,
4096, 335981) = 4096
pread64(13, "@\26\377\353\0\0P\343\n\0\0\32\4\0\235\345\326\f\0\353\0 \240\341\0010\240\341\4\0\240\341"..., 4096, 331888) = 4096 write(1, "luvi v2.12.0\n", 13luvi v2.12.0

luajit:

pipe2([6, 7], O_NONBLOCK|O_CLOEXEC)     = 0
eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK)   = 8 open("./init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/luajit-2.1.0-beta3/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/local/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory) open("/usr/local/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory) open("/usr/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("./init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("/usr/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file
or directory)
open("/usr/local/lib/lua/5.1/loadall.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
write(2, "[string \"return require('init')("..., 596[string "return require('init')(...)"]:1: module 'init' not found:

Quoted 6 lines

Something is strange here...

Best regards,
Romain

luvi requires a luajit built with the -DLUAJIT_ENABLE_LUA52COMPAT flag.
it was the default with moonjit.
the package luvi must :
       select BR2_PACKAGE_LUAJIT_COMPAT52

François

Quoted 13 lines
Quoted 12 lines

it is about init.lua is not installed by luvi package.

François

     <mailto:[email protected]>>
     Cc: Francois Perrad <[email protected] <mailto:[email protected]>>
     Cc: Jörg Krause <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#8 lore raw
In reply to Romain Naour

Hello,

just noticed I missed the second patch [2] of the series. I will re-run the test with the patch applied.

[2]
http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Best regards
Jörg Krause

Quoted 61 lines · Romain Naour

Hello Jörg, François,

Le 07/11/2021 à 12:04, Jörg Krause a écrit :

Quoted 9 lines

Hi François, Hi Romain,

the issue has nothing to do with static linking (the issue Romain cited was raised by in 2015 has been fixed long time ago) nor is it an issue about moonjit vs luajit as correctly stated by François. Also, it is not about setting LUAJIT_ENABLE_LUA52COMPAT.

After applying the patch [1] from Romain I am building and running luvi on my machine successfully:

To reproduce easily the issue you can use the

./support/testing/run-tests -o testsuite-master/ -d dl/ -k --timeout-multiplier 10 tests.package.test_luvi.TestLuvi

Indeed, even with LUAJIT_ENABLE_LUA52COMPAT enabled the test is failing.

Quoted 10 lines
```
LD_LIBRARY_PATH="./output/target/usr/lib/:./output/target/lib" ./output/target/usr/bin/luvi
./output/target/usr/bin/luvi v2.12.0
libuv: 1.42.0
```

The file init.lua is Luajitted into an object file:
```
Building $BR/output/host/share/luajit-2.1.0-beta3/?.lua Luajitted $BR/output/build/luvi-2.12.0/src/lua/init.lua: $BR/output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o

Sorry, I used "static linking" but I talked about what you call "luajitted". When building using luajit I can still see init.lua_luvi_generated.o being compiled and used to link luvi binary.

Do you remember this issue ? it seems similar:
https://github.com/luvit/luvi/commit/b8781653dcb8815a3019a77baf4f3b7f7a255ebe

Quoted 6 lines

```

My first guess is, that the byte code generated by luajit is generated for a different machine than luvi is actually running on. Is file output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o printing the correct file type information?

This .o file seems ok

$ readelf -h
./TestLuvi/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o
En-tête ELF:
  Magique:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Classe:                            ELF32
  Données:                          complément à 2, système à octets de poids
faible d'abord (little endian)
  Version:                           1 (actuelle)
  OS/ABI:                            UNIX - System V
  Version ABI:                       0
  Type:                              REL (Fichier de réadressage)
  Machine:                           ARM
Quoted 234 lines

The luvi test has been added to buildroot before the switch to moonjit (was luajit 2.0.5). I just tested with luajit 2.0.5 and the test pass.

Best regards,
Romain

Quoted 226 lines

[1] http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Best regards
Jörg Krause

Quoted 218 lines · François Perrad

Le sam. 6 nov. 2021 à 23:02, Romain Naour <[email protected]> a écrit :

Quoted 185 lines

Le 06/11/2021 à 22:19, François Perrad a écrit :

Quoted 82 lines

Le sam. 6 nov. 2021 à 20:01, Romain Naour <[email protected] <mailto:[email protected]>> a écrit :

     This reverts commit 9450b53c8e06f1b5a75840b82c0f4663a5d75c45 since it
     introcude a regretion to luvi package [1].

     luvi doesn't work since the luv static linking doesn't seems to
     work anymore.
     (see

 https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c0862
2d70f6b7067
<https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c0862
2d70f6b7067>)

      # luvi -v

     [string "return require('init')(...)"]:1: module 'init' not found:

             no field package.preload['init']
             no file './init.lua'
             no file '/usr/share/luajit-2.1.0-beta3/init.lua' no file '/usr/local/share/lua/5.1/init.lua' no file '/usr/local/share/lua/5.1/init/init.lua' no file '/usr/share/lua/5.1/init.lua' no file '/usr/share/lua/5.1/init/init.lua' no file './init.so'
             no file '/usr/local/lib/lua/5.1/init.so' no file '/usr/lib/lua/5.1/init.so'
             no file '/usr/local/lib/lua/5.1/loadall.so'

     stack traceback:
             [C]: in function 'require'
             [string "return require('init')(...)"]:1: in main chunk

     luvi now try to load init.lua script:
     https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176
     <https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176>

     Luvi seems to rely on some moonjit extentions [2] not available yet in
     luajit.

     [1] http://lists.busybox.net/pipermail/buildroot/2021-
October/627134.html
     <http://lists.busybox.net/pipermail/buildroot/2021-
October/627134.html>
     [2]
https://github.com/moonjit/moonjit/blob/master/doc/extensions.md

 <https://github.com/moonjit/moonjit/blob/master/doc/extensions.md>

the module init.lua is supplied by luvi (see
https://github.com/luvit/luvi/blob/master/src/lua/init.lua
<https://github.com/luvit/luvi/blob/master/src/lua/init.lua>)
and installed somewhere or not (I cannot find it).

moonjit 2.1.2 try to load a Lua module from these locations :
    './init.lua'
    '/usr/share/luajit-2.1.2/init.lua' (usually reserved to luajit itself)
    '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

luajit try to load a Lua module from these locations :
    './init.lua' '/usr/share/luajit-2.1.0-beta3/init.lua' (usually reserved to luajit itself)
    '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

Quoted 1 line

this issue is not about moonjit vs luajit,

The luajit vs moonjit traces are clearly not the same (using strace)

moonjit doesn't even try to open init.lua (init.lua is not installed in target):

open("/usr/bin/luvi", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 13 statx(13, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=401472, ...}) = 0 pread64(13, "\213\240\5\0h'\4\0\373\277\5\0X5\4\0\342\305\5\0t- \4\0G\260\5\0\34'\4\0"...,
4096, 397376) = 4096
pread64(13, "\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\351\232\5\0K\253\5\0\361\232\5\0\
367\232\5"...,
4096, 393283) = 4096
pread64(13, "\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\
334N"...,
4096, 389190) = 4096
pread64(13, "ed\0lz.inflate.meta\0BEST_SPEED\0BE"..., 4096, 385097) = 4096
pread64(13, "Luvi/build/luvi-2.12.0/deps/lua-"..., 4096, 381004) = 4096
pread64(13, "ept fail\0#1 BIO must be memory t"..., 4096, 376911) = 4096
pread64(13, "scape_ca_dn_bug\0netscape_challen"..., 4096, 372818) = 4096
pread64(13, " to cert\0PKCS12_careate failed,p"..., 4096, 368725) = 4096
pread64(13,
"\200+\10\0\0- \t\0\08\t\7\t9\t\0\t\22\n\0\0B\t\2\3\22\3\n\0\22\10\t"..., 4096, 364632) = 4096
pread64(13, "'\7\2\0\22\10\2\0\22\t\3\0B\5\5\2&\4\5\4L\4\2\0K\0\1\0\6\\\6/"..., 4096, 360539) = 4096
pread64(13, "ve is too large\0validation faile"..., 4096, 356446) = 4096
pread64(13, "\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\2 1\21\21\21\21\21\21\21\21\21"...,
4096, 352353) = 4096
pread64(13, "TP\237\345\3p\300\343\200\1\240\341\30`\0\342H\200\237\345\25V\240\3 41\1\220\240\341\0\0\227\345"...,
4096, 348260) = 4096
pread64(13, "\1#\0\0:\1\0P\341\32\0\0\232\2\0\21\341\33\0\0\n\21?o\341\20/o\341\2 C"...,
4096, 344167) = 4096
pread64(13,
"\215\342\4\360\235\344\363G- \351\34\221\237\345\0`\240\341\0@\240\343\2p\240\341\f\0\220\345\4 "..., 4096, 340074) = 4096
pread64(13, "!\315\341\3\0\226\350\276\v\377\353\f\0p\343\0\0P\23\0p\240\341%\0\0 \272\0\0P\343\0"...,
4096, 335981) = 4096
pread64(13, "@\26\377\353\0\0P\343\n\0\0\32\4\0\235\345\326\f\0\353\0 \240\341\0010\240\341\4\0\240\341"..., 4096, 331888) = 4096 write(1, "luvi v2.12.0\n", 13luvi v2.12.0

luajit:

pipe2([6, 7], O_NONBLOCK|O_CLOEXEC)     = 0
eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK)   = 8 open("./init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/luajit-2.1.0-beta3/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/local/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory) open("/usr/local/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory) open("/usr/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("./init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("/usr/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file
or directory)
open("/usr/local/lib/lua/5.1/loadall.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
write(2, "[string \"return require('init')("..., 596[string "return require('init')(...)"]:1: module 'init' not found:

Quoted 6 lines

Something is strange here...

Best regards,
Romain

luvi requires a luajit built with the -DLUAJIT_ENABLE_LUA52COMPAT flag.
it was the default with moonjit.
the package luvi must :
       select BR2_PACKAGE_LUAJIT_COMPAT52

François

Quoted 13 lines
Quoted 12 lines

it is about init.lua is not installed by luvi package.

François

     <mailto:[email protected]>>
     Cc: Francois Perrad <[email protected] <mailto:[email protected]>>
     Cc: Jörg Krause <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#9 lore raw

Hi Jörg;

Le 07/11/2021 à 21:08, Jörg Krause a écrit :

Quoted 4 lines

Hello,

just noticed I missed the second patch [2] of the series. I will re-run the test with the patch applied.

git bisect says that luvi doesn't work with luajit since this commit [1].

Adding -DLUAJIT_DISABLE_GC64 to luajit.mk allow to use luvi -v on the target but I get a strange behavior. The list returned by luvi -v is not always in the same order:

# luvi -v
                            luvi v2.12.0

                                                        rex: 8.45 2021-06-15

libuv: 1.42.0

                               zlib: 1.2.11

                                                           ssl: OpenSSL 1.1.1l

24 Aug 2021, lua-openssl 0.7.8

# luvi -v
                            luvi v2.12.0

                                                        libuv: 1.42.0

ssl: OpenSSL 1.1.1l 24 Aug 2021, lua-openssl 0.7.8

                               rex: 8.45 2021-06-15

                                                           zlib: 1.2.11

The current test is expecting having a reproducible result.

With moonjit we get the same result each time.

I'm not sure if using luajit is really safe for the upcoming Buildroot release.

[1] https://github.com/LuaJIT/LuaJIT/commit/bd00094c3b50e193fb32aad79b7ea8ea6b78ed25

Best regards,
Romain

Quoted 304 lines

[2]
http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Best regards
Jörg Krause

Quoted 295 lines · Romain Naour

Hello Jörg, François,

Le 07/11/2021 à 12:04, Jörg Krause a écrit :

Quoted 9 lines

Hi François, Hi Romain,

the issue has nothing to do with static linking (the issue Romain cited was raised by in 2015 has been fixed long time ago) nor is it an issue about moonjit vs luajit as correctly stated by François. Also, it is not about setting LUAJIT_ENABLE_LUA52COMPAT.

After applying the patch [1] from Romain I am building and running luvi on my machine successfully:

To reproduce easily the issue you can use the

./support/testing/run-tests -o testsuite-master/ -d dl/ -k --timeout-multiplier 10 tests.package.test_luvi.TestLuvi

Indeed, even with LUAJIT_ENABLE_LUA52COMPAT enabled the test is failing.

Quoted 10 lines
```
LD_LIBRARY_PATH="./output/target/usr/lib/:./output/target/lib" ./output/target/usr/bin/luvi
./output/target/usr/bin/luvi v2.12.0
libuv: 1.42.0
```

The file init.lua is Luajitted into an object file:
```
Building $BR/output/host/share/luajit-2.1.0-beta3/?.lua Luajitted $BR/output/build/luvi-2.12.0/src/lua/init.lua: $BR/output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o

Sorry, I used "static linking" but I talked about what you call "luajitted". When building using luajit I can still see init.lua_luvi_generated.o being compiled and used to link luvi binary.

Do you remember this issue ? it seems similar:
https://github.com/luvit/luvi/commit/b8781653dcb8815a3019a77baf4f3b7f7a255ebe

Quoted 6 lines

```

My first guess is, that the byte code generated by luajit is generated for a different machine than luvi is actually running on. Is file output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o printing the correct file type information?

This .o file seems ok

$ readelf -h
./TestLuvi/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o
En-tête ELF:
  Magique:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Classe:                            ELF32
  Données:                          complément à 2, système à octets de poids
faible d'abord (little endian)
  Version:                           1 (actuelle)
  OS/ABI:                            UNIX - System V
  Version ABI:                       0
  Type:                              REL (Fichier de réadressage)
  Machine:                           ARM

The luvi test has been added to buildroot before the switch to moonjit (was luajit 2.0.5). I just tested with luajit 2.0.5 and the test pass.

Best regards,
Romain

Quoted 226 lines

[1] http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Best regards
Jörg Krause

Quoted 218 lines · François Perrad

Le sam. 6 nov. 2021 à 23:02, Romain Naour <[email protected]> a écrit :

Quoted 185 lines

Le 06/11/2021 à 22:19, François Perrad a écrit :

Quoted 82 lines

https://github.com/LuaJIT/LuaJIT/commit/bd00094c3b50e193fb32aad79b7ea8ea6b78ed25
Le sam. 6 nov. 2021 à 20:01, Romain Naour <[email protected] <mailto:[email protected]>> a écrit :

     This reverts commit 9450b53c8e06f1b5a75840b82c0f4663a5d75c45 since it
     introcude a regretion to luvi package [1].

     luvi doesn't work since the luv static linking doesn't seems to
     work anymore.
     (see

 https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c0862
2d70f6b7067
<https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c0862
2d70f6b7067>)

      # luvi -v

     [string "return require('init')(...)"]:1: module 'init' not found:

             no field package.preload['init']
             no file './init.lua'
             no file '/usr/share/luajit-2.1.0-beta3/init.lua' no file '/usr/local/share/lua/5.1/init.lua' no file '/usr/local/share/lua/5.1/init/init.lua' no file '/usr/share/lua/5.1/init.lua' no file '/usr/share/lua/5.1/init/init.lua' no file './init.so'
             no file '/usr/local/lib/lua/5.1/init.so' no file '/usr/lib/lua/5.1/init.so'
             no file '/usr/local/lib/lua/5.1/loadall.so'

     stack traceback:
             [C]: in function 'require'
             [string "return require('init')(...)"]:1: in main chunk

     luvi now try to load init.lua script:
     https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176
     <https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176>

     Luvi seems to rely on some moonjit extentions [2] not available yet in
     luajit.

     [1] http://lists.busybox.net/pipermail/buildroot/2021-
October/627134.html
     <http://lists.busybox.net/pipermail/buildroot/2021-
October/627134.html>
     [2]
https://github.com/moonjit/moonjit/blob/master/doc/extensions.md

 <https://github.com/moonjit/moonjit/blob/master/doc/extensions.md>

the module init.lua is supplied by luvi (see
https://github.com/luvit/luvi/blob/master/src/lua/init.lua
<https://github.com/luvit/luvi/blob/master/src/lua/init.lua>)
and installed somewhere or not (I cannot find it).

moonjit 2.1.2 try to load a Lua module from these locations :
    './init.lua'
    '/usr/share/luajit-2.1.2/init.lua' (usually reserved to luajit itself)
    '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

luajit try to load a Lua module from these locations :
    './init.lua' '/usr/share/luajit-2.1.0-beta3/init.lua' (usually reserved to luajit itself)
    '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

Quoted 1 line

this issue is not about moonjit vs luajit,

The luajit vs moonjit traces are clearly not the same (using strace)

moonjit doesn't even try to open init.lua (init.lua is not installed in target):

open("/usr/bin/luvi", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 13 statx(13, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=401472, ...}) = 0 pread64(13, "\213\240\5\0h'\4\0\373\277\5\0X5\4\0\342\305\5\0t- \4\0G\260\5\0\34'\4\0"...,
4096, 397376) = 4096
pread64(13, "\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\351\232\5\0K\253\5\0\361\232\5\0\
367\232\5"...,
4096, 393283) = 4096
pread64(13, "\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\
334N"...,
4096, 389190) = 4096
pread64(13, "ed\0lz.inflate.meta\0BEST_SPEED\0BE"..., 4096, 385097) = 4096
pread64(13, "Luvi/build/luvi-2.12.0/deps/lua-"..., 4096, 381004) = 4096
pread64(13, "ept fail\0#1 BIO must be memory t"..., 4096, 376911) = 4096
pread64(13, "scape_ca_dn_bug\0netscape_challen"..., 4096, 372818) = 4096
pread64(13, " to cert\0PKCS12_careate failed,p"..., 4096, 368725) = 4096
pread64(13,
"\200+\10\0\0- \t\0\08\t\7\t9\t\0\t\22\n\0\0B\t\2\3\22\3\n\0\22\10\t"..., 4096, 364632) = 4096
pread64(13, "'\7\2\0\22\10\2\0\22\t\3\0B\5\5\2&\4\5\4L\4\2\0K\0\1\0\6\\\6/"..., 4096, 360539) = 4096
pread64(13, "ve is too large\0validation faile"..., 4096, 356446) = 4096
pread64(13, "\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\2 1\21\21\21\21\21\21\21\21\21"...,
4096, 352353) = 4096
pread64(13, "TP\237\345\3p\300\343\200\1\240\341\30`\0\342H\200\237\345\25V\240\3 41\1\220\240\341\0\0\227\345"...,
4096, 348260) = 4096
pread64(13, "\1#\0\0:\1\0P\341\32\0\0\232\2\0\21\341\33\0\0\n\21?o\341\20/o\341\2 C"...,
4096, 344167) = 4096
pread64(13,
"\215\342\4\360\235\344\363G- \351\34\221\237\345\0`\240\341\0@\240\343\2p\240\341\f\0\220\345\4 "..., 4096, 340074) = 4096
pread64(13, "!\315\341\3\0\226\350\276\v\377\353\f\0p\343\0\0P\23\0p\240\341%\0\0 \272\0\0P\343\0"...,
4096, 335981) = 4096
pread64(13, "@\26\377\353\0\0P\343\n\0\0\32\4\0\235\345\326\f\0\353\0 \240\341\0010\240\341\4\0\240\341"..., 4096, 331888) = 4096 write(1, "luvi v2.12.0\n", 13luvi v2.12.0

luajit:

pipe2([6, 7], O_NONBLOCK|O_CLOEXEC)     = 0
eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK)   = 8 open("./init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/luajit-2.1.0-beta3/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/local/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory) open("/usr/local/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory) open("/usr/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("./init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("/usr/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file
or directory)
open("/usr/local/lib/lua/5.1/loadall.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
write(2, "[string \"return require('init')("..., 596[string "return require('init')(...)"]:1: module 'init' not found:

Quoted 6 lines

Something is strange here...

Best regards,
Romain

luvi requires a luajit built with the -DLUAJIT_ENABLE_LUA52COMPAT flag.
it was the default with moonjit.
the package luvi must :
       select BR2_PACKAGE_LUAJIT_COMPAT52

François

Quoted 13 lines
Quoted 12 lines

it is about init.lua is not installed by luvi package.

François

     <mailto:[email protected]>>
     Cc: Francois Perrad <[email protected] <mailto:[email protected]>>
     Cc: Jörg Krause <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#10 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

Hi Jörg;
Le 07/11/2021 à 21:08, Jörg Krause a écrit :

Quoted 2 lines

Hello,

Quoted 8 lines
Quoted 2 lines

just noticed I missed the second patch [2] of the series. I will re-run the test with the patch applied.

git bisect says that luvi doesn't work with luajit since this commit [1].

Adding -DLUAJIT_DISABLE_GC64 to luajit.mk allow to use luvi -v on the target but I get a strange behavior. The list returned by luvi -v is not always in the same order:

Funky. The commit says that this only applies to 64bit target, but the test uses armv7, so perhaps it is indeed something related to host/target confusion?

Quoted 1 line

I'm not sure if using luajit is really safe for the upcoming Buildroot release.

Hmm, no perhaps not. Still, if moonjit is unmaintained we will need to move away from it (E.G. before 2022.02) so it would be good to get to the bottom of this issue.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#11 lore raw
In reply to Romain Naour

Hi Romain,

Quoted 10 lines · Romain Naour

Hi Jörg;

Le 07/11/2021 à 21:08, Jörg Krause a écrit :

Quoted 4 lines

Hello,

just noticed I missed the second patch [2] of the series. I will re-run the test with the patch applied.

git bisect says that luvi doesn't work with luajit since this commit [1].

Thanks for digging into this!

The issue is that luvi is using the host-luajit binary to generate the target specific luajitted object files, like init.lua_luvi_generated.o, etc.

So, when host-luajit is build with GC64 enabled, luajit generates different bytecode compared to host-luajit being build with GC64 disabled.

Quoted 4 lines

Adding -DLUAJIT_DISABLE_GC64 to luajit.mk allow to use luvi -v on the target but I get a strange behavior. The list returned by luvi -v is not always in the same order:

Seems this is expected behavior. See LuaJIT FAQ:
https://luajit.org/faq.html

Q: Table iteration with pairs() does not result in the same order?

Quoted 29 lines
# luvi -v
                            luvi v2.12.0

                                                        rex: 8.45 2021-06-15
   libuv: 1.42.0

                               zlib: 1.2.11

                                                           ssl: OpenSSL 1.1.1l

24 Aug 2021, lua-openssl 0.7.8

# luvi -v
                            luvi v2.12.0

                                                        libuv: 1.42.0
   ssl: OpenSSL 1.1.1l  24 Aug 2021, lua-openssl 0.7.8

                               rex: 8.45 2021-06-15

                                                           zlib: 1.2.11

The current test is expecting having a reproducible result.

Quoted 10 lines

With moonjit we get the same result each time.

I'm not sure if using luajit is really safe for the upcoming Buildroot release.

[1] https://github.com/LuaJIT/LuaJIT/commit/bd00094c3b50e193fb32aad79b7ea8ea6b78ed25

Best regards,
Romain

Best regards
Jörg Krause

Quoted 295 lines
Quoted 295 lines

[2]
http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Best regards
Jörg Krause

Quoted 286 lines · Romain Naour

Hello Jörg, François,

Le 07/11/2021 à 12:04, Jörg Krause a écrit :

Quoted 9 lines

Hi François, Hi Romain,

the issue has nothing to do with static linking (the issue Romain cited was raised by in 2015 has been fixed long time ago) nor is it an issue about moonjit vs luajit as correctly stated by François. Also, it is not about setting LUAJIT_ENABLE_LUA52COMPAT.

After applying the patch [1] from Romain I am building and running luvi on my machine successfully:

To reproduce easily the issue you can use the

./support/testing/run-tests -o testsuite-master/ -d dl/ -k --timeout-multiplier 10 tests.package.test_luvi.TestLuvi

Indeed, even with LUAJIT_ENABLE_LUA52COMPAT enabled the test is failing.

Quoted 10 lines
```
LD_LIBRARY_PATH="./output/target/usr/lib/:./output/target/lib" ./output/target/usr/bin/luvi
./output/target/usr/bin/luvi v2.12.0
libuv: 1.42.0
```

The file init.lua is Luajitted into an object file:
```
Building $BR/output/host/share/luajit-2.1.0-beta3/?.lua Luajitted $BR/output/build/luvi-2.12.0/src/lua/init.lua: $BR/output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o

Sorry, I used "static linking" but I talked about what you call "luajitted". When building using luajit I can still see init.lua_luvi_generated.o being compiled and used to link luvi binary.

Do you remember this issue ? it seems similar:
https://github.com/luvit/luvi/commit/b8781653dcb8815a3019a77baf4f3b7f7a255ebe

Quoted 6 lines

```

My first guess is, that the byte code generated by luajit is generated for a different machine than luvi is actually running on. Is file output/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o printing the correct file type information?

This .o file seems ok

$ readelf -h
./TestLuvi/build/luvi-2.12.0/jitted_tmp/src/lua/init.lua_luvi_generated.o
En-tête ELF:
  Magique:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Classe:                            ELF32
  Données:                          complément à 2, système à octets de poids
faible d'abord (little endian)
  Version:                           1 (actuelle)
  OS/ABI:                            UNIX - System V
  Version ABI:                       0
  Type:                              REL (Fichier de réadressage)
  Machine:                           ARM

The luvi test has been added to buildroot before the switch to moonjit (was luajit 2.0.5). I just tested with luajit 2.0.5 and the test pass.

Best regards,
Romain

Quoted 218 lines

[1] http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Best regards
Jörg Krause

Quoted 211 lines · François Perrad

Le sam. 6 nov. 2021 à 23:02, Romain Naour <[email protected]> a écrit :

Quoted 185 lines

Le 06/11/2021 à 22:19, François Perrad a écrit :

Quoted 82 lines

https://github.com/LuaJIT/LuaJIT/commit/bd00094c3b50e193fb32aad79b7ea8ea6b78ed25
Le sam. 6 nov. 2021 à 20:01, Romain Naour <[email protected] <mailto:[email protected]>> a écrit :

     This reverts commit 9450b53c8e06f1b5a75840b82c0f4663a5d75c45 since it
     introcude a regretion to luvi package [1].

     luvi doesn't work since the luv static linking doesn't seems to
     work anymore.
     (see

 https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c0862
2d70f6b7067
<https://github.com/luvit/luvi/commit/a9dc8dae2eb69d4a754a0cf5c0862
2d70f6b7067>)

      # luvi -v

     [string "return require('init')(...)"]:1: module 'init' not found:

             no field package.preload['init']
             no file './init.lua'
             no file '/usr/share/luajit-2.1.0-beta3/init.lua' no file '/usr/local/share/lua/5.1/init.lua' no file '/usr/local/share/lua/5.1/init/init.lua' no file '/usr/share/lua/5.1/init.lua' no file '/usr/share/lua/5.1/init/init.lua' no file './init.so'
             no file '/usr/local/lib/lua/5.1/init.so' no file '/usr/lib/lua/5.1/init.so'
             no file '/usr/local/lib/lua/5.1/loadall.so'

     stack traceback:
             [C]: in function 'require'
             [string "return require('init')(...)"]:1: in main chunk

     luvi now try to load init.lua script:
     https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176
     <https://github.com/luvit/luvi/blob/v2.12.0/src/main.c#L176>

     Luvi seems to rely on some moonjit extentions [2] not available yet in
     luajit.

     [1] http://lists.busybox.net/pipermail/buildroot/2021-
October/627134.html
     <http://lists.busybox.net/pipermail/buildroot/2021-
October/627134.html>
     [2]
https://github.com/moonjit/moonjit/blob/master/doc/extensions.md

 <https://github.com/moonjit/moonjit/blob/master/doc/extensions.md>

the module init.lua is supplied by luvi (see
https://github.com/luvit/luvi/blob/master/src/lua/init.lua
<https://github.com/luvit/luvi/blob/master/src/lua/init.lua>)
and installed somewhere or not (I cannot find it).

moonjit 2.1.2 try to load a Lua module from these locations :
    './init.lua'
    '/usr/share/luajit-2.1.2/init.lua' (usually reserved to luajit itself)
    '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

luajit try to load a Lua module from these locations :
    './init.lua' '/usr/share/luajit-2.1.0-beta3/init.lua' (usually reserved to luajit itself)
    '/usr/local/share/lua/5.1/init.lua' '/usr/local/share/lua/5.1/init/init.lua' '/usr/share/lua/5.1/init.lua' '/usr/share/lua/5.1/init/init.lua'

Quoted 1 line

this issue is not about moonjit vs luajit,

The luajit vs moonjit traces are clearly not the same (using strace)

moonjit doesn't even try to open init.lua (init.lua is not installed in target):

open("/usr/bin/luvi", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 13 statx(13, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=401472, ...}) = 0 pread64(13, "\213\240\5\0h'\4\0\373\277\5\0X5\4\0\342\305\5\0t- \4\0G\260\5\0\34'\4\0"...,
4096, 397376) = 4096
pread64(13, "\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\351\232\5\0K\253\5\0\361\232\5\0\
367\232\5"...,
4096, 393283) = 4096
pread64(13, "\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\334N\1\0\
334N"...,
4096, 389190) = 4096
pread64(13, "ed\0lz.inflate.meta\0BEST_SPEED\0BE"..., 4096, 385097) = 4096
pread64(13, "Luvi/build/luvi-2.12.0/deps/lua-"..., 4096, 381004) = 4096
pread64(13, "ept fail\0#1 BIO must be memory t"..., 4096, 376911) = 4096
pread64(13, "scape_ca_dn_bug\0netscape_challen"..., 4096, 372818) = 4096
pread64(13, " to cert\0PKCS12_careate failed,p"..., 4096, 368725) = 4096
pread64(13,
"\200+\10\0\0- \t\0\08\t\7\t9\t\0\t\22\n\0\0B\t\2\3\22\3\n\0\22\10\t"..., 4096, 364632) = 4096
pread64(13, "'\7\2\0\22\10\2\0\22\t\3\0B\5\5\2&\4\5\4L\4\2\0K\0\1\0\6\\\6/"..., 4096, 360539) = 4096
pread64(13, "ve is too large\0validation faile"..., 4096, 356446) = 4096
pread64(13, "\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\21\2 1\21\21\21\21\21\21\21\21\21"...,
4096, 352353) = 4096
pread64(13, "TP\237\345\3p\300\343\200\1\240\341\30`\0\342H\200\237\345\25V\240\3 41\1\220\240\341\0\0\227\345"...,
4096, 348260) = 4096
pread64(13, "\1#\0\0:\1\0P\341\32\0\0\232\2\0\21\341\33\0\0\n\21?o\341\20/o\341\2 C"...,
4096, 344167) = 4096
pread64(13,
"\215\342\4\360\235\344\363G- \351\34\221\237\345\0`\240\341\0@\240\343\2p\240\341\f\0\220\345\4 "..., 4096, 340074) = 4096
pread64(13, "!\315\341\3\0\226\350\276\v\377\353\f\0p\343\0\0P\23\0p\240\341%\0\0 \272\0\0P\343\0"...,
4096, 335981) = 4096
pread64(13, "@\26\377\353\0\0P\343\n\0\0\32\4\0\235\345\326\f\0\353\0 \240\341\0010\240\341\4\0\240\341"..., 4096, 331888) = 4096 write(1, "luvi v2.12.0\n", 13luvi v2.12.0

luajit:

pipe2([6, 7], O_NONBLOCK|O_CLOEXEC)     = 0
eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK)   = 8 open("./init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/luajit-2.1.0-beta3/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/local/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory) open("/usr/local/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory) open("/usr/share/lua/5.1/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory) open("/usr/share/lua/5.1/init/init.lua", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("./init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("/usr/lib/lua/5.1/init.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file
or directory)
open("/usr/local/lib/lua/5.1/loadall.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
write(2, "[string \"return require('init')("..., 596[string "return require('init')(...)"]:1: module 'init' not found:

Quoted 6 lines

Something is strange here...

Best regards,
Romain

luvi requires a luajit built with the -DLUAJIT_ENABLE_LUA52COMPAT flag.
it was the default with moonjit.
the package luvi must :
       select BR2_PACKAGE_LUAJIT_COMPAT52

François

Quoted 6 lines
Quoted 6 lines

it is about init.lua is not installed by luvi package.

François

Quoted 11 lines
Quoted 10 lines
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

     <mailto:[email protected]>>
     Cc: Francois Perrad <[email protected] <mailto:[email protected]>>
     Cc: Jörg Krause <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#12 lore raw
In reply to Romain Naour
Quoted 47 lines · Romain Naour

Hi Jörg;

Quoted 4 lines · Jörg Krause

Hello,

just noticed I missed the second patch [2] of the series. I will re-run the test with the patch applied.

git bisect says that luvi doesn't work with luajit since this commit [1].

Adding -DLUAJIT_DISABLE_GC64 to luajit.mk allow to use luvi -v on the target but
I get a strange behavior. The list returned by luvi -v is not always in the same
order:

# luvi -v
                            luvi v2.12.0

                                                        rex: 8.45

2021-06-15

   libuv: 1.42.0

                               zlib: 1.2.11

                                                           ssl: OpenSSL

1.1.1l
24 Aug 2021, lua-openssl 0.7.8

# luvi -v
                            luvi v2.12.0

                                                        libuv: 1.42.0
   ssl: OpenSSL 1.1.1l  24 Aug 2021, lua-openssl 0.7.8

                               rex: 8.45 2021-06-15

                                                           zlib: 1.2.11

The current test is expecting having a reproducible result.

Quoted 9 lines

With moonjit we get the same result each time.

I'm not sure if using luajit is really safe for the upcoming Buildroot release.

[1]
https://github.com/LuaJIT/LuaJIT/commit/bd00094c3b50e193fb32aad79b7ea8ea6b78ed25

thanks Romain,

your bisect gives the fix,
see
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

François

Best regards,

Quoted 6 lines

Romain

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot