[Buildroot] [PATCH] package/luajit: fix luvi

Romain Naour romain.naour at gmail.com
Tue Nov 9 22:51:31 UTC 2021


Hello François,

Le 08/11/2021 à 21:10, Francois Perrad a écrit :
> luvi uses the cross bytecode generation of host-luajit
> the bytecode format has 2 flavors, depending of GC64 option.
> 
> since the commit https://github.com/LuaJIT/LuaJIT/commit/bd00094c3b50e193fb32aad79b7ea8ea6b78ed25
> GC64 mode is enable by default on all 64bits platform.
> 
> with this patch, luajit and host-luajit are built with the same option,
> so the bytecode generated by host-luajit is valid on luajit.

I believe it would be great to add a new test to test bytecode generated by
host-luajit. It's only by "chance" that we noticed this issue.

> 
> Signed-off-by: Francois Perrad <francois.perrad at gadz.org>
> ---
>  package/luajit/luajit.mk | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/package/luajit/luajit.mk b/package/luajit/luajit.mk
> index fbbd8ebc7..ba5d85434 100644
> --- a/package/luajit/luajit.mk
> +++ b/package/luajit/luajit.mk
> @@ -15,6 +15,7 @@ LUAJIT_PROVIDES = luainterpreter
>  
>  ifeq ($(BR2_PACKAGE_LUAJIT_COMPAT52),y)
>  LUAJIT_XCFLAGS += -DLUAJIT_ENABLE_LUA52COMPAT
> +HOST_LUAJIT_XCFLAGS += -DLUAJIT_ENABLE_LUA52COMPAT
>  endif
>  
>  # The luajit build procedure requires the host compiler to have the
> @@ -26,8 +27,10 @@ endif
>  # libraries are installed.
>  ifeq ($(BR2_ARCH_IS_64),y)
>  LUAJIT_HOST_CC = $(HOSTCC)
> +HOST_LUAJIT_XCFLAGS += -DLUAJIT_ENABLE_GC64

What if the host is an 32bits machine ?

The luvi test needs another change since luvi -v doesn't always return a list in
the same order:

See LuaJIT FAQ:
https://luajit.org/faq.html

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

http://lists.busybox.net/pipermail/buildroot/2021-November/627938.html


Best regards,
Romain


>  else
>  LUAJIT_HOST_CC = $(HOSTCC) -m32
> +HOST_LUAJIT_XCFLAGS += -DLUAJIT_DISABLE_GC64
>  endif
>  
>  # We unfortunately can't use TARGET_CONFIGURE_OPTS, because the luajit
> @@ -66,7 +69,7 @@ LUAJIT_POST_INSTALL_TARGET_HOOKS += LUAJIT_INSTALL_SYMLINK
>  define HOST_LUAJIT_BUILD_CMDS
>  	$(HOST_MAKE_ENV) $(MAKE) PREFIX="$(HOST_DIR)" BUILDMODE=dynamic \
>  		TARGET_LDFLAGS="$(HOST_LDFLAGS)" \
> -		XCFLAGS=$(LUAJIT_XCFLAGS) \
> +		XCFLAGS=$(HOST_LUAJIT_XCFLAGS) \
>  		-C $(@D) amalg
>  endef
>  
> 




More information about the buildroot mailing list