Francis Moy
Francis Moy

Reputation: 195

LuaJIT on Windows 10: unknown luaJIT command or jit.*

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.

Upvotes: 2

Views: 1750

Answers (2)

DarkMaster
DarkMaster

Reputation: 19

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\

Upvotes: 0

siffiejoe
siffiejoe

Reputation: 4271

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.

Upvotes: 4

Related Questions