Luci lua_handler从文件'/usr/lib/lua/nixio.so'加载模块'nixio'时出错:

时间:2018-07-24 08:24:04

标签: lua openwrt luci

当我尝试通过uhttpd将它添加为lua_handler来运行lua程序(www1文件夹中的index.lua)时。我不断收到此错误

nixio错误:

error loading module 'nixio' from file '/usr/lib/lua/nixio.so':

所有数学模块相关的错误

/usr/sbin/uhttpd: symbol 'log': can't resolve symbol
/usr/sbin/uhttpd: symbol 'sqrt': can't resolve symbol
etc...

但是当我运行测试程序时,它们是从命令行运行的

$ lua test.lua

这是test.lua的代码

local m = require "math"
local j = require "luci.json"

function perror(obj)
    return io.stderr:write(tostring(obj) .. "\n")
end

function dumptable(t, maxdepth, i, seen)
    i = i or 0
    seen = seen or setmetatable({}, {__mode="k"})

    for k,v in pairs(t) do
            perror(string.rep("\t", i) .. tostring(k) .. "\t" .. tostring(v))
            if type(v) == "table" and (not maxdepth or i < maxdepth) then
                    if not seen[v] then
                            seen[v] = true
                            dumptable(v, maxdepth, i+1, seen)
                    else
                            perror(string.rep("\t", i) .. "*** RECURSION ***")
                    end
            end
    end
end

dumptable(m, 10)

这是我的uhttpd配置条目

config uhttpd 'main'
list listen_https '0.0.0.0:8081'
list listen_https '[::]:8081'
option redirect_https '1'
option rfc1918_filter '1'
option cert '/etc/uhttpd.crt'
option key '/etc/uhttpd.key'
option lua_prefix '/luci'
option lua_handler '/www1/index.lua'
option http_keepalive '0'
option tcp_keepalive '1'
option ubus_prefix '/ubus'

但是当我使用以下配置运行时,它不会抛出任何与nixio或数学相关的错误

config uhttpd 'main'
list listen_http '0.0.0.0:80'
list listen_http '[::]:80'
option home '/www'
option rfc1918_filter '1'
option cert '/etc/uhttpd.crt'
option key '/etc/uhttpd.key'
option cgi_prefix '/cgi-bin'
option http_keepalive '0'
option tcp_keepalive '1'
option ubus_prefix '/ubus'

我不知道这个问题。任何意见/建议都将帮助我进一步发展。

0 个答案:

没有答案