Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luasocket broken #3

Open
Simon-L opened this issue Sep 8, 2022 · 1 comment
Open

luasocket broken #3

Simon-L opened this issue Sep 8, 2022 · 1 comment
Labels
wontfix This will not be worked on

Comments

@Simon-L
Copy link
Owner

Simon-L commented Sep 8, 2022

[51.296 debug src/Lune.cpp:266 setScript] Loading /home/user/.Rack2/plugins/ModScript/scripts/myosc.lua
[51.296 debug src/Lune.cpp:285 setScript] Content:
config.frameDivider = 1
config.bufferSize = 8

buttonTrig = BooleanTrigger.new()

local socket = require("socket")
local udp = assert(socket.udp())
local data

udp:settimeout(1)

function process(block)
	if buttonTrig:process(block.button) then
		display(package.path)
		display(package.cpath)
	end
end

[51.300 warn src/LuaJITEngine.cpp:186 run] LuaJIT: error loading module 'socket.core' from file '/usr/local/lib/lua/5.1/socket/core.so':
	/usr/local/lib/lua/5.1/socket/core.so: undefined symbol: lua_gettop
[51.300 debug src/LuaJITEngine.cpp:187 run] error loading module 'socket.core' from file '/usr/local/lib/lua/5.1/socket/core.so':
	/usr/local/lib/lua/5.1/socket/core.so: undefined symbol: lua_gettop

Probably related: apache/trafficserver#5158

This calls for a more thorough build setup of LuaJIT and special care about the search paths as the Lua environment used in ModScript should be completely independent from the system. This is will be fixed along with upgrading the LuaJIT version used, including considering to switch to openresty's LuaJIT.

package.path: /home/user/.Rack2/plugins/ModScript/scripts/lib/?.lua;/home/user/.Rack2/plugins/ModScript/scripts/?.lua;/home/user/.Rack2/plugins/ModScript/scripts/lib/?/init.lua;./?.lua;/home/user/dev/ModScript/dep/share/luajit-2.0.5/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/home/user/dev/ModScript/dep/share/lua/5.1/?.lua;/home/user/dev/ModScript/dep/share/lua/5.1/?/init.lua
package.cpath: ./?.so;/usr/local/lib/lua/5.1/?.so;/home/user/dev/ModScript/dep/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so

@Simon-L
Copy link
Owner Author

Simon-L commented Sep 15, 2022

The upgrade to openresty/luajit2 is done but the path are not fixed yet.

The cause of this issue is this: because we're building and bundling LuaJIT statically, C modules like luasocket need to be linked against our static LuaJIT library. Doing that works fine on linux but sadly on Windows it is harder or impossible (?) or would require more changes to the build system. This issue will be left as is but once the paths are fixed it will just fail to load the module because it's simply not here.
Here is a minimal example of this setup, works on Linux only : mkdir dep && make dep && make
minimalcppluajit.zip

@Simon-L Simon-L added the wontfix This will not be worked on label Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant