0

I want to use luasec package to construct a SSL call. I am doing this under Alpine 3.9. I have Lua 5.1, openssl-1.1.1k-r0 and openssl-dev-1.1.1k-r0. I install luasec by using "luarocks install luasec". The installation passed without error. But when I tried to use do "require ('ssl') in Lua, there's error:

> require('ssl')
error loading module 'ssl.core' from file '/usr/local/openresty/luajit/lib/lua/5.1/ssl.so':
        Error relocating /usr/local/openresty/luajit/lib/lua/5.1/ssl.so: luaL_setfuncs: symbol not found
stack traceback:
        [C]: ?
        [C]: in function 'require'
        /usr/local/openresty/luajit/share/lua/5.1/ssl.lua:8: in main chunk
        [C]: in function 'require'
        stdin:1: in main chunk
        [C]: ?

I expected to see the require method pass successfully but it didn't.

  • It looks like a Lua version mismatch – ESkri May 21 '23 at 22:19
  • @ESkri I also did "RUN luarocks install --lua-version=5.1 --lua-dir=/usr/local/openresty/luajit luasec" to specify the Lua version and place of Lua interpreter but it seems not solve the error. – Jackthesuper May 22 '23 at 18:09

1 Answers1

0

It turns out that I should run Luajit environment to require the LuaSec package. Previously I thought Luajit and Lua 5.1 are the same thing. I have Luajit interpreter so I should use Luajit to compile my Lua files.