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

module 'socket.core' not found #29

Closed
YuGiOhJCJ opened this issue Oct 8, 2016 · 4 comments
Closed

module 'socket.core' not found #29

YuGiOhJCJ opened this issue Oct 8, 2016 · 4 comments

Comments

@YuGiOhJCJ
Copy link

@YuGiOhJCJ YuGiOhJCJ commented Oct 8, 2016

Hello,

On Slackware64 14.2, I am using:

  • lua-5.1.5
  • luasocket 316a9455b9cb4637fe6e62b20fbe05f5141fec54
  • irc 0c47e10
  • minetest-0.4.14

And here is what happens:

$ minetest 
2016-10-08 14:35:22: WARNING[Main]: Couldn't find a locale directory!
Loaded texture: /usr/share/minetest/games/minetest_game/menu/header.png
Loaded texture: /usr/share/minetest/games/minetest_game/menu/icon.png
Loaded texture: /usr/share/minetest/games/minimal/menu/icon.png
2016-10-08 14:35:25: WARNING[Main]: NodeDefManager: Ignoring CONTENT_IGNORE redefinition
2016-10-08 14:35:25: ERROR[Main]: ModError: Failed to load and run script from /home/yugiohjcj/.minetest/mods/minetestirc/init.lua:
2016-10-08 14:35:25: ERROR[Main]: /usr/share/lua/5.1/socket.lua:12: module 'socket.core' not found:
2016-10-08 14:35:25: ERROR[Main]:   no field package.preload['socket.core']
2016-10-08 14:35:25: ERROR[Main]:   no file '/home/yugiohjcj/.minetest/mods/minetestirc/socket/core/init.lua'
2016-10-08 14:35:25: ERROR[Main]:   no file '/home/yugiohjcj/.minetest/mods/minetestirc/socket/core.lua'
2016-10-08 14:35:25: ERROR[Main]:   no file './socket/core.lua'
2016-10-08 14:35:25: ERROR[Main]:   no file '/usr/local/share/lua/5.1/socket/core.lua'
2016-10-08 14:35:25: ERROR[Main]:   no file '/usr/local/share/lua/5.1/socket/core/init.lua'
2016-10-08 14:35:25: ERROR[Main]:   no file '/usr/local/lib/lua/5.1/socket/core.lua'
2016-10-08 14:35:25: ERROR[Main]:   no file '/usr/local/lib/lua/5.1/socket/core/init.lua'
2016-10-08 14:35:25: ERROR[Main]:   no file '/usr/share/lua/5.1/socket/core.lua'
2016-10-08 14:35:25: ERROR[Main]:   no file '/usr/share/lua/5.1/socket/core/init.lua'
2016-10-08 14:35:25: ERROR[Main]:   no file './socket/core.so'
2016-10-08 14:35:25: ERROR[Main]:   no file '/usr/local/lib/lua/5.1/socket/core.so'
2016-10-08 14:35:25: ERROR[Main]:   no file '/usr/local/lib/lua/5.1/loadall.so'
2016-10-08 14:35:25: ERROR[Main]:   no file '/usr/lib/lua/5.1/socket/core.so'
2016-10-08 14:35:25: ERROR[Main]:   no file './socket.so'
2016-10-08 14:35:25: ERROR[Main]:   no file '/usr/local/lib/lua/5.1/socket.so'
2016-10-08 14:35:25: ERROR[Main]:   no file '/usr/local/lib/lua/5.1/loadall.so'
2016-10-08 14:35:25: ERROR[Main]:   no file '/usr/lib/lua/5.1/socket.so'
2016-10-08 14:35:25: ERROR[Main]: stack traceback:
2016-10-08 14:35:25: ERROR[Main]:   [C]: in function 'require'
2016-10-08 14:35:25: ERROR[Main]:   /usr/share/lua/5.1/socket.lua:12: in main chunk
2016-10-08 14:35:25: ERROR[Main]:   [C]: in function 'require'
2016-10-08 14:35:25: ERROR[Main]:   ...home/yugiohjcj/.minetest/mods/minetestirc/irc/init.lua:1: in main chunk
2016-10-08 14:35:25: ERROR[Main]:   [C]: in function 'require'
2016-10-08 14:35:25: ERROR[Main]:   /home/yugiohjcj/.minetest/mods/minetestirc/init.lua:36: in main chunk
2016-10-08 14:35:25: ERROR[Main]: Check debug.txt for details.

What am I doing wrong please?

Thank you.
Best regards.

@ShadowNinja
Copy link
Member

@ShadowNinja ShadowNinja commented Oct 9, 2016

It looks like your luasocket installation is somehow broken, luasocket can't find a part of itself.
You'll have to find out where luasocket's socket.so or core.so file is (probably somewhere like /usr/lib/lua/5.1) and make sure that its added to Lua's native search path (package.cpath).

@YuGiOhJCJ
Copy link
Author

@YuGiOhJCJ YuGiOhJCJ commented Oct 10, 2016

OK, so here is the location of core.so:

$ find /usr/lib64/lua -name "core.so"
/usr/lib64/lua/5.1/mime/core.so
/usr/lib64/lua/5.1/socket/core.so

But there is no socket.so.
Is it normal?

And here is the current value of my Lua's native search path (package.cpath):

$ lua
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> return package.cpath
./?.so;/usr/lib64/lua/5.1/?.so;/usr/lib64/lua/5.1/loadall.so
> ^C

So, what I did is to edit the init.lua file of the irc mod to add this first line:

package.cpath = package.cpath .. ";/usr/lib64/lua/5.1/socket/?.so"

But it does not help.
I get the same error.
Is it the good way to change my Lua's native search path (package.cpath)?

@kaeza
Copy link
Member

@kaeza kaeza commented Oct 10, 2016

You should use /usr/lib64/lua/5.1/?.so instead of /usr/lib64/lua/5.1/socket/?.so (i.e. provide the path to the root of the Lua lib dir). LuaSocket requires the module socket.core, so it should resolve to /usr/lib64/lua/5.1/socket/core.so. Make those changes in the mod's init.lua.

From your examples, it seems Minetest is looking for /usr/lib/... while the standalone Lua interpreter is looking for /usr/lib64/...; it's possible Minetest is not using the system-wide Lua and is using the bundled one which is using the default paths (i.e. not ones specially configured for your system).

@YuGiOhJCJ
Copy link
Author

@YuGiOhJCJ YuGiOhJCJ commented Oct 11, 2016

The two things you said were correct.

  1. Editing the init.lua file of the irc mod to add this first line solves the problem:
package.cpath = package.cpath .. ";/usr/lib64/lua/5.1/?.so"
  1. My Minetest was built with the bundled Lua because LuaJIT was not installed on my system.
    Rebuilding Minetest after installing LuaJIT on my system solves the problem.
    Now, Minetest is installed with the system Lua instead of the bundled one.
    It means that I don't need anymore to edit the init.lua file of the irc mod now because the package.cpath value is correct :)

Problem solved.

@YuGiOhJCJ YuGiOhJCJ closed this Oct 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants