From abdf3a8128b78fb98ee944bc5d3086c680d779ed Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Sat, 18 Dec 2021 20:59:02 -0700 Subject: [PATCH] fix(build): check that LuaJIT has required modules for compilation (#16714) Apparently some installations of LuaJIT do not have the "jit.bcsave" module which is required for pre-compilation. Check that this module exists before using LuaJIT as luac and if it doesn't, skip compiling bytecode. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c2587ec0b..2ca2385d8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -553,7 +553,10 @@ if(NOT WIN32) endif() endforeach() elseif(LUA_PRG MATCHES "luajit") - set(LUAC_PRG "${LUA_PRG} -b -s %s -" CACHE STRING "Format for compiling to Lua bytecode") + check_lua_module(${LUA_PRG} "jit.bcsave" LUAJIT_HAS_JIT_BCSAVE) + if(LUAJIT_HAS_JIT_BCSAVE) + set(LUAC_PRG "${LUA_PRG} -b -s %s -" CACHE STRING "Format for compiling to Lua bytecode") + endif() endif() endif()