1
votes

I've been trying to install LuaJIT on Windows 10 for some time following the official guide, and I actually get to install it. For example, if I execute luajit I get into the prompt. Also, luajit -v returns the version of luajit (2.0.4). And I can also execute code with luajit -e <lua code>. However, whenever I try to save bytecode with luajit -b, I get the following message:

luajit: unknown luaJIT command or jit.* modules not installed

I tried to make all sort of installations: using Cygwin, luajit-rocks, MinGW, ... However, no matter what I try, I always get the same result, and I have no clue of what to do.

Could you point me to some potential problems I might be overlooking?

I have on my system Lua 5.1 and Luarocks.

2
Please show the actual command you use that fails. -b requires input and output files. - Nicol Bolas
LuaJIT apparently can't find jit\bcsave.lua. Either it's not installed in the correct location, or it's not in package.path. Do you maybe overwrite the default package.path using the LUA_PATH environment variable? - siffiejoe
Thanks for your answer. Yes, I was overriding the LUA_PATH (and LUA_CPATH) environment variables, and bcsave.lua was not in the directory where they were pointing to. I think I did this long time ago, when I first installed Lua and Luarocks, and I'd totally forgotten about it. Thanks so much, you saved my day! Can you post the answer so I can accept it? - Francis Moy

2 Answers

3
votes

Some extra LuaJIT features are implemented as separate Lua modules (e.g. jit.bcsave for bytecode saving), and LuaJIT depends on package.path to find those modules. The suggested install location for those modules is in the default package.path, but if you override it via the LUA_PATH environment variable, you have to make sure to include that location there. One easy way to do that is to put two consecutive semicolons into LUA_PATH: Double semicolons are replaced by the compile-time default value of package.path.

0
votes

You need place modules to "jit" folder near with juajit.exe. That folder include some system modules (bcsave too). package.path can dont work, becouse it hardlinked, how i understand. That folders distributed with source code. Download lua from official sice: https://luajit.org/download.html You can see "jit" folder inside archive: LuaJIT-2.0.5.zip\LuaJIT-2.0.5\src\jit\