shengyu
shengyu

Reputation: 11

can not require socket.so in lua

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?

Upvotes: 1

Views: 1209

Answers (1)

siffiejoe
siffiejoe

Reputation: 4271

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.

Upvotes: 3

Related Questions