minetest-mods / irc

IRC Mod for Minetest
BSD 2-Clause "Simplified" License
43 stars 31 forks source link

Can't find LuaSocket when using bundled Lua on Debian #21

Closed Calinou closed 8 years ago

Calinou commented 9 years ago

Debian jessie 64-bit. lua-socket-dev is installed. Both lua5.1 and liblua5.1-0-dev are installed.

08:06:53: WARNING: Undeclared global variable "jit" accessed at /home/hugo/.minetest/mods/irc/init.lua:16
2015-04-03 08:06:53: ERROR[main]: ========== ERROR FROM LUA ===========
2015-04-03 08:06:53: ERROR[main]: Failed to load and run script from 
2015-04-03 08:06:53: ERROR[main]: /home/hugo/.minetest/mods/irc/init.lua:
2015-04-03 08:06:53: ERROR[main]: /usr/share/lua/5.1/socket.lua:12: module 'socket.core' not found:
2015-04-03 08:06:53: ERROR[main]:       no field package.preload['socket.core']
2015-04-03 08:06:53: ERROR[main]:       no file '/home/hugo/.minetest/mods/irc/socket/core/init.lua'
2015-04-03 08:06:53: ERROR[main]:       no file '/home/hugo/.minetest/mods/irc/socket/core.lua'
2015-04-03 08:06:53: ERROR[main]:       no file './socket/core.lua'
2015-04-03 08:06:53: ERROR[main]:       no file '/usr/local/share/lua/5.1/socket/core.lua'
2015-04-03 08:06:53: ERROR[main]:       no file '/usr/local/share/lua/5.1/socket/core/init.lua'
2015-04-03 08:06:53: ERROR[main]:       no file '/usr/local/lib/lua/5.1/socket/core.lua'
2015-04-03 08:06:53: ERROR[main]:       no file '/usr/local/lib/lua/5.1/socket/core/init.lua'
2015-04-03 08:06:53: ERROR[main]:       no file '/usr/share/lua/5.1/socket/core.lua'
2015-04-03 08:06:53: ERROR[main]:       no file '/usr/share/lua/5.1/socket/core/init.lua'
2015-04-03 08:06:53: ERROR[main]:       no file './socket/core.so'
2015-04-03 08:06:53: ERROR[main]:       no file '/usr/local/lib/lua/5.1/socket/core.so'
2015-04-03 08:06:53: ERROR[main]:       no file '/usr/local/lib/lua/5.1/loadall.so'
2015-04-03 08:06:53: ERROR[main]:       no file '/usr/lib/lua/5.1/socket/core.so'
2015-04-03 08:06:53: ERROR[main]:       no file './socket.so'
2015-04-03 08:06:53: ERROR[main]:       no file '/usr/local/lib/lua/5.1/socket.so'
2015-04-03 08:06:53: ERROR[main]:       no file '/usr/local/lib/lua/5.1/loadall.so'
2015-04-03 08:06:53: ERROR[main]:       no file '/usr/lib/lua/5.1/socket.so'
2015-04-03 08:06:53: ERROR[main]: stack traceback:
2015-04-03 08:06:53: ERROR[main]:       [C]: in function 'require'
2015-04-03 08:06:53: ERROR[main]:       /usr/share/lua/5.1/socket.lua:12: in main chunk
2015-04-03 08:06:53: ERROR[main]:       [C]: in function 'require'
2015-04-03 08:06:53: ERROR[main]:       /home/hugo/.minetest/mods/irc/irc/init.lua:1: in main chunk
2015-04-03 08:06:53: ERROR[main]:       [C]: in function 'require'
2015-04-03 08:06:53: ERROR[main]:       /home/hugo/.minetest/mods/irc/init.lua:32: in main chunk
2015-04-03 08:06:53: ERROR[main]: ======= END OF ERROR FROM LUA ========
2015-04-03 08:06:53: ERROR[main]: Server: Failed to load and run /home/hugo/.minetest/mods/irc/init.lua
2015-04-03 08:06:53: ERROR[main]: ERROR: An unhandled exception occurred: ModError: Failed to load and run /home/hugo/.minetest/mods/irc/init.lua

Copying the LuaSocket library to ./socket.so creates the following error instead:

08:11:45: WARNING: Undeclared global variable "jit" accessed at /home/hugo/.minetest/mods/irc/init.lua:16
2015-04-03 08:11:45: ERROR[main]: ========== ERROR FROM LUA ===========
2015-04-03 08:11:45: ERROR[main]: Failed to load and run script from 
2015-04-03 08:11:45: ERROR[main]: /home/hugo/.minetest/mods/irc/init.lua:
2015-04-03 08:11:45: ERROR[main]: /usr/share/lua/5.1/mime.lua:12: module 'mime.core' not found:
2015-04-03 08:11:45: ERROR[main]:       no field package.preload['mime.core']
2015-04-03 08:11:45: ERROR[main]:       no file '/home/hugo/.minetest/mods/irc/mime/core/init.lua'
2015-04-03 08:11:45: ERROR[main]:       no file '/home/hugo/.minetest/mods/irc/mime/core.lua'
2015-04-03 08:11:45: ERROR[main]:       no file './mime/core.lua'
2015-04-03 08:11:45: ERROR[main]:       no file '/usr/local/share/lua/5.1/mime/core.lua'
2015-04-03 08:11:45: ERROR[main]:       no file '/usr/local/share/lua/5.1/mime/core/init.lua'
2015-04-03 08:11:45: ERROR[main]:       no file '/usr/local/lib/lua/5.1/mime/core.lua'
2015-04-03 08:11:45: ERROR[main]:       no file '/usr/local/lib/lua/5.1/mime/core/init.lua'
2015-04-03 08:11:45: ERROR[main]:       no file '/usr/share/lua/5.1/mime/core.lua'
2015-04-03 08:11:45: ERROR[main]:       no file '/usr/share/lua/5.1/mime/core/init.lua'
2015-04-03 08:11:45: ERROR[main]:       no file './mime/core.so'
2015-04-03 08:11:45: ERROR[main]:       no file '/usr/local/lib/lua/5.1/mime/core.so'
2015-04-03 08:11:45: ERROR[main]:       no file '/usr/local/lib/lua/5.1/loadall.so'
2015-04-03 08:11:45: ERROR[main]:       no file '/usr/lib/lua/5.1/mime/core.so'
2015-04-03 08:11:45: ERROR[main]:       no file './mime.so'
2015-04-03 08:11:45: ERROR[main]:       no file '/usr/local/lib/lua/5.1/mime.so'
2015-04-03 08:11:45: ERROR[main]:       no file '/usr/local/lib/lua/5.1/loadall.so'
2015-04-03 08:11:45: ERROR[main]:       no file '/usr/lib/lua/5.1/mime.so'
2015-04-03 08:11:45: ERROR[main]: stack traceback:
2015-04-03 08:11:45: ERROR[main]:       [C]: in function 'require'
2015-04-03 08:11:45: ERROR[main]:       /usr/share/lua/5.1/mime.lua:12: in main chunk
2015-04-03 08:11:45: ERROR[main]:       [C]: in function 'require'
2015-04-03 08:11:45: ERROR[main]:       /home/hugo/.minetest/mods/irc/hooks.lua:5: in main chunk
2015-04-03 08:11:45: ERROR[main]:       [C]: in function 'dofile'
2015-04-03 08:11:45: ERROR[main]:       /home/hugo/.minetest/mods/irc/init.lua:40: in main chunk
2015-04-03 08:11:45: ERROR[main]: ======= END OF ERROR FROM LUA ========
2015-04-03 08:11:45: ERROR[main]: Server: Failed to load and run /home/hugo/.minetest/mods/irc/init.lua
2015-04-03 08:11:45: ERROR[main]: ERROR: An unhandled exception occurred: ModError: Failed to load and run /home/hugo/.minetest/mods/irc/init.lua

Then, if you copy the mime.so library, it works.

ShadowNinja commented 9 years ago

This happens because Minetest uses a bundled version of Lua, which isn't configured with the distro's Lua paths. The IRC mod tries to lessen the occurrence of this problem by adding a few search paths, but it can't account for all distros. You'll have to either:

package.path = package.path..";/path/where/your/distro/keeps/lua/5.1/lua/files"
package.cpath = package.cpath..";/path/where/your/distro/keeps/lua/5.1/shared/objects"
kaeza commented 8 years ago

Closing this as it cannot be fixed here.