otclient icon indicating copy to clipboard operation
otclient copied to clipboard

Cannot load incompatible bytecode (compiling bytecode with luajit)

Open Source61 opened this issue 3 years ago • 1 comments

Steps to reproduce (include any configuration/script required to reproduce)

  1. Compile otclient
  2. Compile a lua module such as /modules/corelib/math.lua to bytecode using LATEST LuaJIT version
  3. Run otclient and check otclient.log

Expected behaviour

Should run without an issue

Actual behaviour

Complains about incompatible bytecode and exits.

Environment

Windows 10 with Debian 12 WSL. Modified OTClient version from 2-3 years ago. Never touched src/framework/luaengine/*. Should be the latest version, 0.6.6. The issue seems to have started happening after I upgraded all the software on the WSL one day about 6-9 months ago and likely LuaJIT was upgraded as well, never had this issue before and been using LuaJIT compilation for years. I've also tried upgrading to the most recent LuaJIT (and all other) vcpkg libraries to no avail.

This issue incidentally happened around the same time (9 months ago) https://github.com/neovim/neovim/issues/18169 https://stackoverflow.com/questions/72875661/i-got-this-error-after-upgrading-neovim-to-version-0-7-2-2

Source61 avatar Feb 27 '23 20:02 Source61

LuaJIT bytecode is not guaranteed to have compatibility between versions, even if it's just minor version differences, like for example LuaJIT 2.0.5 and 2.1.0. It should be generated & ran with identical versions or you are most likely going to get errors like this.

Your problem is probably here

Modified OTClient version from 2-3 years ago

might be linked with an older version, or your bytecode was generated with an older version

Erza avatar Feb 27 '23 22:02 Erza