Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Romain Naour <romain.naour@gmail.com>
Cc: buildroot@busybox.net, Francois Perrad <fperrad@gmail.com>
Subject: Re: [Buildroot] [PATCH] package/luajit: fix luvi
Date: Wed, 10 Nov 2021 09:06:07 +0100	[thread overview]
Message-ID: <20211110080607.GC2084998@scaer> (raw)
In-Reply-To: <67ba0cba-8d57-5349-4f53-7c621350b835@gmail.com>

François, Romain, All,

Thanks for the cross-investigations! 👍

On 2021-11-09 23:51 +0100, Romain Naour spake thusly:
> 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.

We already have a luajit test in:
    support/testing/tests/package/test_lua.py

> > Signed-off-by: Francois Perrad <francois.perrad@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 ?

From https://luajit.org/extensions.html#string_dump (and the same file
in git still has the same wording):

    The generated bytecode is portable and can be loaded on any
    architecture that LuaJIT supports, independent of word size
    or endianess.

However, from https://luajit.org/install.html#cross

    The GNU Makefile-based build system allows cross-compiling on any
    host for any supported target, as long as both architectures have
    the same pointer size.

In git, the file reads differently, but the requirement remains:

    The GNU Makefile-based build system allows cross-compiling on any
    host for any supported target:

    * Yes, you need a toolchain for both your host and your target!

    * Both host and target architectures must have the same pointer
      size.

    * E.g. if you want to cross-compile to a 32 bit target on a 64
      bit host, you need to install the multilib development package
      (e.g. libc6-dev-i386 on Debian/Ubuntu) and build a 32 bit host
      part (HOST_CC="gcc -m32").

    * 64 bit targets always require compilation on a 64 bit host.

Gah... So, on a 32-bit host, we can't build for a 64-bit target, while
the opposite will require BR2_HOSTARCH_NEEDS_IA32_LIBS.

Meh, meh, meh...

> 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

Yes, but this is a separate topic, which can be addressed in parallel.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      reply	other threads:[~2021-11-10  8:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 20:10 [Buildroot] [PATCH] package/luajit: fix luvi Francois Perrad
2021-11-09 22:51 ` Romain Naour
2021-11-10  8:06   ` Yann E. MORIN [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211110080607.GC2084998@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    --cc=fperrad@gmail.com \
    --cc=romain.naour@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox