can not require socket.so in lua

1.1k views Asked by At

I use Lua-5.1.3 and luasocket-2.0.2.It is all right when I make the socket.so. When I require socket.so,it failed and give me this error:

./socket.so:undefined symbol:luaopen_socket. 

Because of my pool knowledge, I don't know how to handle the problem. Do you have some suggestions?

1

There are 1 answers

0
siffiejoe On

You can use nm socket.so to check which symbols are actually there. I suspect you will find a symbol luaopen_socket_core (and/or luaopen_mime_core), because luasocket consists of multiple Lua modules (e.g. socket.lua, socket/http.lua, ...) and two C modules (socket/core.so and mime/core.so). For require("socket") to work you will need at least socket.lua somewhere in your package.path.