Tiny Core Linux
Tiny Core Extensions => TCE Corepure64 => Topic started by: cueless on October 04, 2025, 01:19:36 PM
-
I'm building and installing luasocket on a system running corepure64.
This works fine with lua 5.4.
The extensions there are very convenient, big thanks to their authors and maintainers!
What do I do if I want to install luasocket for luajit instead?
Specifically, which of the 5 luajit extensions do I get? And then, what do I need to pass to luarocks to do a local install of luasocket for luajit?
tia
-
Hi cueless. Welcome to the TCL forum.
What do I do if I want to install luasocket for luajit instead?
The x86_64 repo contains luarocks and lua-5.4-dev, allowing you to compile luasocket against lua-5.4-lib.
LuaJIT is binary-compatible with lua-5.1-lib but not with lua-5.4-lib, so in a standard TCL16 x86_64 environment your idea is not going to work:
$ tce-load -wi luarocks luajit compiletc
$ luarocks --local install luasocket
$ eval $(luarocks path)
$ luajit
LuaJIT 2.0.5 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
JIT: ON CMOV SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
> require "socket"
error loading module 'socket.core' from file '/home/bruno/.luarocks/lib/lua/5.4/socket/core.so':
/home/bruno/.luarocks/lib/lua/5.4/socket/core.so: undefined symbol: luaL_setfuncs
...
Not that I recommend it, but I think for this to work you'd have to create a hacky environment where you'd be compiling luasocket against lua-5.1-lib.
-
Thanks for the tip, GNUser!
For posterity: If you pass --lua-version 5.1 to Luarocks, it will find LuaJIT just fine. You need to pass this option while configuring LuaRocks and installing the module (luasocket in this case), because LuaRocks has a separate configuration for each Lua version.
Where I stumbled: in addition to luajit, compiletc, and luarocks, you need to tce-load luajit-dev, which will put Lua's header files (lua.h, lauxlib.h, etc.) at /usr/local/include/luajit-2.0. No hacks required, once that's done it should just work.
-
If you pass --lua-version 5.1 to Luarocks
...
you need to tce-load luajit-dev
Hi cueless. I stand corrected. Those were, indeed, the two missing pieces. Strong work! I tested this on TCL16 x86_64 and it works, so you should be all set :)
$ tce-load -wi luarocks compiletc luajit-dev
$ luarocks --lua-version 5.1 --local install luasocket
$ export LUA_PATH="$HOME/.luarocks/share/lua/5.1/?.lua;$HOME/.luarocks/share/lua/5.1/?/init.lua;;"
$ export LUA_CPATH="$HOME/.luarocks/lib/lua/5.1/?.so;;"
$ export PATH="$HOME/.luarocks/bin:$PATH"
$ luajit
LuaJIT 2.0.5 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
JIT: ON CMOV SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
> require "socket"
>
Thanks for teaching me something new.