Using a custom build of LuaJIT with Defold?

I’ve built LuaJIT on my machine and was wondering how I could use this version with Defold? Particularly, if I wanted to mess around with the code and change things :see_no_evil: Curiously, I note that the .exe produced is 29kb whereas the one I have in the built from source version of Defold is 804-818kb (depending on if 32 or 64 bit.) I tried a naive replacement but I see “Compilation failed: null”. So obviously the built-in version of LuaJIT must be doing something additional to function with Defold. Does anyone have experience here?

Which version? Which OS? Which instructions did you follow when building LuaJIT?

1 Like

Using Windows 10 and I built LuaJIT just by downloading it on luajit.org and running “make” from MSYS. This created the luajit.exe which works to process some example .lua files I pass to it. I’m using a (slightly) out of date version of Defold from git. It doesn’t show a version number but I have the SHA1 values:

Editor SHA1: 1673e26639d352d95b5387734686571681551061
Engine SHA1: dedf1ed10d96c92df6e361f5494531c79af4c1cf

I’m not familiar with the process either. I’m sure @JCash knows though. But if you look at the prebuilt luajit packages (https://github.com/defold/defold/blob/dev/packages/luajit-2.1.0-beta3-win32.tar.gz) what you actually want is not the exe but the libluajit-5.1.lib.

The luajit-64.exe from the prebuilt package is 696kB. Are there some shared libs along with the luajit.exe that you built?

1 Like

It should work as usual, replace the libraries and executables, and you should be good to go.

We use the build script (and version) from share/ext/luajit/build_luajit.sh

You need two executables (32 and 64 bit), to produce luajit bytecode for both 32 and 64 bit executables.

The executables are about ~600kb.

As @britzl mentioned, inspect the `packages/luajit-2.1.0-beta3-*.tar.gz" packages for info on what files are actually needed.

3 Likes