[Buildroot] [PATCH] Revert "package/luajit: back to mainline and bump to 05f1984e"

Romain Naour romain.naour at gmail.com
Sun Nov 7 14:01:43 UTC 2021


Hello Jörg, François,

Le 07/11/2021 à 12:04, Jörg Krause a écrit :
> 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.

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

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


> 
> [1] http://patchwork.ozlabs.org/project/buildroot/patch/20211031210258.654193-1-romain.naour@gmail.com/
> 
> Best regards
> Jörg Krause
> 
> On Sun, 2021-11-07 at 09:30 +0100, François Perrad wrote:
>>
>>
>> Le sam. 6 nov. 2021 à 23:02, Romain Naour <romain.naour at gmail.com> a
>> écrit :
>>> Le 06/11/2021 à 22:19, François Perrad a écrit :
>>>>
>>>>
>>>> Le sam. 6 nov. 2021 à 20:01, Romain Naour <romain.naour at gmail.com
>>>> <mailto:romain.naour at gmail.com>> 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'
>>>>
>>>> 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:
>>>
>>> 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
>>  
>>>
>>>> it is about `init.lua` is not installed by luvi package.
>>>>
>>>> François
>>>>  
>>>>
>>>>      Signed-off-by: Romain Naour <romain.naour at gmail.com
>>>>      <mailto:romain.naour at gmail.com>>
>>>>      Cc: Francois Perrad <francois.perrad at gadz.org
>>>> <mailto:francois.perrad at gadz.org>>
>>>>      Cc: Jörg Krause <joerg.krause at embedded.rocks>
>>>>
>>>
> 



More information about the buildroot mailing list