Skip to contentSkip to conversation

package/luvi: don't use LUAJIT_VERSION for the luajit installation path

PATCH In review Romain Naour 3 participants 4 messages Oct 31, 2021 – Nov 7, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/luvi: don't use LUAJIT_VERSION for the luajit installation path

Luajit package has been recently updated to the latest commit in the master branch [1]. Since then LUAJIT_VERSION doesn't contain the luajit version anymore but a commit hash:

LUAJIT_VERSION = 05f1984e1a862e4b3d3c3b370c773492e2edf84a

Use pkg-config --variable=version luajit in luvi package to set LUA_PATH correctly.

Fixes:
luajit: unknown luaJIT command or jit.* modules not installed

https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552605

[1] 9450b53c8e06f1b5a75840b82c0f4663a5d75c45

---
The TestLuvi doesn't work yet due to missing rng support on Qemu armv7 target used to run the test. luvi -v is stuck due to getrandom().

---
 package/luvi/luvi.mk | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
package/luvi/luvi.mk +6 -2
index 386daafc31..ef5777cac8 100644
@@ -9,7 +9,7 @@ LUVI_SOURCE = luvi-src-v$(LUVI_VERSION).tar.gz
 LUVI_SITE = https://github.com/luvit/luvi/releases/download/v$(LUVI_VERSION)
 LUVI_LICENSE = Apache-2.0
 LUVI_LICENSE_FILES = LICENSE.txt
-LUVI_DEPENDENCIES = libuv luajit luv host-luajit
+LUVI_DEPENDENCIES = libuv luajit luv host-luajit host-pkgconf
 
 # Dispatch all architectures of LuaJIT
 ifeq ($(BR2_i386),y)
@@ -30,12 +30,16 @@ else
 LUVI_TARGET_ARCH = $(BR2_ARCH)
 endif
 
+# LUAJIT_VERSION and the luajit installation path may not use the
+# same value. Use the value from luajit.pc file.
+LUVI_LUAJIT_VERSION = $(shell $(PKG_CONFIG_HOST_BINARY) --variable=version luajit)
+
 # Bundled lua bindings have to be linked statically into the luvi executable
 LUVI_CONF_OPTS = \
 	-DBUILD_SHARED_LIBS=OFF \
 	-DWithSharedLibluv=ON \
 	-DTARGET_ARCH=$(LUVI_TARGET_ARCH) \
-	-DLUA_PATH=$(HOST_DIR)/share/luajit-$(LUAJIT_VERSION)/?.lua
+	-DLUA_PATH=$(HOST_DIR)/share/luajit-$(LUVI_LUAJIT_VERSION)/?.lua
 
 # Add "rex" module (PCRE via bundled lrexlib)
 ifeq ($(BR2_PACKAGE_PCRE),y)
Signature · 6 lines
2.31.1

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

PATCH 2/2 support/testing: test_luvi: switch to armv5 to boot with rng support enabled

Since the commit replacing moonjit by luajit [1] luvi doesn't work without rng support enabled.

Switch to armv5 to use virtio-rng-pci on the qemu command line [2].

[1] 9450b53c8e06f1b5a75840b82c0f4663a5d75c45
[2] https://git.buildroot.net/buildroot/tree/support/testing/infra/emulator.py?h=2021.08.1

---
luvi still 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

Reverting to moonjit fixes the issue.

---
 support/testing/tests/package/test_luvi.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
support/testing/tests/package/test_luvi.py +1 -1
index a85a6f4d27..eb15ad31b5 100644
@@ -17,7 +17,7 @@ class TestLuvi(infra.basetest.BRTest):
 
     def login(self):
         cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
-        self.emulator.boot(arch="armv7",
+        self.emulator.boot(arch="armv5",
                            kernel="builtin",
                            options=["-initrd", cpio_file])
         self.emulator.login()
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Tested-by on v1 1/2
#2 lore raw
In reply to Romain Naour

Hi Romain,

I can confirm that this fixes the following build error:

```
PATH="$BR/output/host/bin:$BR/output/host/sbin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl"  /usr/bin/make -j9  -C $BR/output/build/luvi-2.12.0/
make[1]: Entering directory '$BR/output/build/luvi-2.12.0'
make[2]: Entering directory '$BR/output/build/luvi-2.12.0'
make[3]: Entering directory '$BR/output/build/luvi-2.12.0'
[ 50%] Building Luajitted $BR/output/build/luvi-2.12.0/src/lua/luvibundle.lua: $BR/output/build/luvi-2.12.0/jitted_tmp/src/lua/luvibundle.lua_luvi_generated.o
[ 50%] Building Luajitted $BR/output/build/luvi-2.12.0/src/lua/luvipath.lua: $BR/output/build/luvi-2.12.0/jitted_tmp/src/lua/luvipath.lua_luvi_generated.o
[ 50%] Building 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
luajit: unknown luaJIT command or jit.* modules not installed
luajit: unknown luaJIT command or jit.* modules not installed
make[3]: *** [CMakeFiles/luvi.dir/build.make:78: jitted_tmp/src/lua/luvipath.lua_luvi_generated.o] Error 1
```

The issue is, that LUA_PATH is set to $BR/output/host/share/luajit-05f1984e1a862e4b3d3c3b370c773492e2edf84a/?.lua, which is wrong, as the installation path of luajit is $BR/output/host/share/luajit-2.1.0-beta3/.

So, the fix proposed by Romain is correct.

Best regards
Jörg Krause

Quoted 46 lines · Romain Naour

Luajit package has been recently updated to the latest commit in the master branch [1]. Since then LUAJIT_VERSION doesn't contain the luajit version anymore but a commit hash:

LUAJIT_VERSION = 05f1984e1a862e4b3d3c3b370c773492e2edf84a

Use pkg-config --variable=version luajit in luvi package to set LUA_PATH correctly.

Fixes:
luajit: unknown luaJIT command or jit.* modules not installed

https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552605

[1] 9450b53c8e06f1b5a75840b82c0f4663a5d75c45

---
The TestLuvi doesn't work yet due to missing rng support on Qemu armv7 target used to run the test. luvi -v is stuck due to getrandom().

---
 package/luvi/luvi.mk | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
package/luvi/luvi.mk +5 -1
index 386daafc31..ef5777cac8 100644
@@ -9,7 +9,7 @@ LUVI_SOURCE = luvi-src-v$(LUVI_VERSION).tar.gz
 LUVI_SITE = https://github.com/luvit/luvi/releases/download/v$(LUVI_VERSION)
 LUVI_LICENSE = Apache-2.0
 LUVI_LICENSE_FILES = LICENSE.txt
-LUVI_DEPENDENCIES = libuv luajit luv host-luajit
+LUVI_DEPENDENCIES = libuv luajit luv host-luajit host-pkgconf
 
 # Dispatch all architectures of LuaJIT
 ifeq ($(BR2_i386),y)
@@ -30,12 +30,16 @@ else
 LUVI_TARGET_ARCH = $(BR2_ARCH)
 endif
 
+# LUAJIT_VERSION and the luajit installation path may not use the
+# same value. Use the value from luajit.pc file.
+LUVI_LUAJIT_VERSION = $(shell $(PKG_CONFIG_HOST_BINARY) --variable=version luajit)
+

package/luvi/luvi.mk else · line 45

Quoted 10 lines
package/luvi/luvi.mk +1 -1
 # Bundled lua bindings have to be linked statically into the luvi executable
 LUVI_CONF_OPTS = \
 	-DBUILD_SHARED_LIBS=OFF \
 	-DWithSharedLibluv=ON \
 	-DTARGET_ARCH=$(LUVI_TARGET_ARCH) \
-	-DLUA_PATH=$(HOST_DIR)/share/luajit-$(LUAJIT_VERSION)/?.lua
+	-DLUA_PATH=$(HOST_DIR)/share/luajit-$(LUVI_LUAJIT_VERSION)/?.lua
 
 # Add "rex" module (PCRE via bundled lrexlib)
 ifeq ($(BR2_PACKAGE_PCRE),y)

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

#3 lore raw

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

Quoted 24 lines

Hi Romain,

I can confirm that this fixes the following build error:

```
PATH="$BR/output/host/bin:$BR/output/host/sbin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl"
/usr/bin/make -j9  -C $BR/output/build/luvi-2.12.0/
make[1]: Entering directory '$BR/output/build/luvi-2.12.0'
make[2]: Entering directory '$BR/output/build/luvi-2.12.0'
make[3]: Entering directory '$BR/output/build/luvi-2.12.0'
[ 50%] Building Luajitted
$BR/output/build/luvi-2.12.0/src/lua/luvibundle.lua:
$BR/output/build/luvi-2.12.0/jitted_tmp/src/lua/luvibundle.lua_luvi_generated.o
[ 50%] Building Luajitted
$BR/output/build/luvi-2.12.0/src/lua/luvipath.lua:
$BR/output/build/luvi-2.12.0/jitted_tmp/src/lua/luvipath.lua_luvi_generated.o
[ 50%] Building 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
luajit: unknown luaJIT command or jit.* modules not installed
luajit: unknown luaJIT command or jit.* modules not installed
make[3]: *** [CMakeFiles/luvi.dir/build.make:78:
jitted_tmp/src/lua/luvipath.lua_luvi_generated.o] Error 1
```
Quoted 10 lines

The issue is, that LUA_PATH is set to $BR/output/host/share/luajit-05f1984e1a862e4b3d3c3b370c773492e2edf84a/?.lua, which is wrong, as the installation path of luajit is $BR/output/host/share/luajit-2.1.0-beta3/.

So, the fix proposed by Romain is correct.

I agree.

François

Quoted 62 lines

Best regards
Jörg Krause

Quoted 12 lines · Romain Naour

Luajit package has been recently updated to the latest commit in the master branch [1]. Since then LUAJIT_VERSION doesn't contain the luajit version anymore but a commit hash:

LUAJIT_VERSION = 05f1984e1a862e4b3d3c3b370c773492e2edf84a

Use pkg-config --variable=version luajit in luvi package to set LUA_PATH correctly.

Fixes:
luajit: unknown luaJIT command or jit.* modules not installed

Quoted 8 lines

https://gitlab.com/buildroot.org/buildroot/-/jobs/1710552605

[1] 9450b53c8e06f1b5a75840b82c0f4663a5d75c45

---
The TestLuvi doesn't work yet due to missing rng support on Qemu armv7

target

package/luvi/luvi.mk LUVI_SOURCE = luvi-src-v$(LUVI_VERSION).tar.gz · line 9

Quoted 11 lines

used to run the test. luvi -v is stuck due to getrandom().

---
 package/luvi/luvi.mk | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
package/luvi/luvi.mk +0 -0
index 386daafc31..ef5777cac8 100644
@@ -9,7 +9,7 @@ LUVI_SOURCE = luvi-src-v$(LUVI_VERSION).tar.gz
 LUVI_SITE =

https://github.com/luvit/luvi/releases/download/v$(LUVI_VERSION)

Quoted 8 lines
package/luvi/luvi.mk +1 -1
 LUVI_LICENSE = Apache-2.0
 LUVI_LICENSE_FILES = LICENSE.txt
-LUVI_DEPENDENCIES = libuv luajit luv host-luajit
+LUVI_DEPENDENCIES = libuv luajit luv host-luajit host-pkgconf
 
 # Dispatch all architectures of LuaJIT
 ifeq ($(BR2_i386),y)

package/luvi/luvi.mk else · line 35

Quoted 6 lines
package/luvi/luvi.mk +3 -0
@@ -30,12 +30,16 @@ else
 LUVI_TARGET_ARCH = $(BR2_ARCH)
 endif
 
+# LUAJIT_VERSION and the luajit installation path may not use the
+# same value. Use the value from luajit.pc file.
+LUVI_LUAJIT_VERSION = $(shell $(PKG_CONFIG_HOST_BINARY)

--variable=version luajit)

package/luvi/luvi.mk else · line 37

Quoted 2 lines
package/luvi/luvi.mk +1 -0
+
 # Bundled lua bindings have to be linked statically into the luvi

executable

Quoted 7 lines
package/luvi/luvi.mk +1 -1
 LUVI_CONF_OPTS = \
      -DBUILD_SHARED_LIBS=OFF \
      -DWithSharedLibluv=ON \
      -DTARGET_ARCH=$(LUVI_TARGET_ARCH) \
-     -DLUA_PATH=$(HOST_DIR)/share/luajit-$(LUAJIT_VERSION)/?.lua
+     -DLUA_PATH=$(HOST_DIR)/share/luajit-$(LUVI_LUAJIT_VERSION)/?.lua
 
Quoted 8 lines

package/luvi/luvi.mk else · line 45

Quoted 2 lines
package/luvi/luvi.mk +0 -0
 # Add "rex" module (PCRE via bundled lrexlib)
 ifeq ($(BR2_PACKAGE_PCRE),y)

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

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