lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Mon, Apr 1, 2019 at 7:03 AM Matthias <> wrote:

in search of an example on how to cross-compile Lua byte code for a specific target architecture, I came across this post: We use Lua 5.3.4 in a project which relies on Yocto in order to build a customized Linux operating system image for our target hardware – an ARM Cortex A7 32bit processor. On that hardware, we run some applications that are implemented in Lua. During the build process, we want to compile our Lua application script files into byte code for the mentioned target machine. That is, luac shall generate byte code which can run on the Cortex A7 processor. The whole build process, especially luac, is automatically executed on a 64bit-Ubuntu-based build server backend in which we cannot integrate the target hardware for compilation. This is why we need to have a cross-compilation capable version of luac in our Yocto build system.

In order to realize that, I would like to patch the Lua sources accordingly. Unfortunately, I was not able to find any concrete example which demonstrates on how to change the existing code base for a specific target architecture. I already had a look at the ldump.c file as mentioned in the post above. As far as I understand I (only) have to adapt DumpBlock() since any data produced by the higher-layer functions finally go through this function. However, I am not sure how to exactly do that. Is there any concrete example available that demonstrates the required steps?

Thank you very much in advance.

With kind regards,


Take a look at That was made for Lua 5.1 with the intent of cross-compiling Lua code to different architectures. Most of that commit is not my code, but I can't find the original Lua patch anymore. It shouldn't be too difficult to make that work for Lua 5.3.