2

I have Lua 5.3 installed on my Mac Sierra OS with Luarocks and it seems to be working fine. In fact, I have lgi installed and this file works without error from the terminal when I run it:

local lgi = require'lgi'

However, in ZeroBrane with the 5.3 interpreter selected, the same file produces the following error:

/ZeroBraneStudio/bin/lua.app/Contents/MacOS/lua53: error loading module 'lgi.corelgilua51' from file '/usr/local/lib/lua/5.3/lgi/corelgilua51.so':
dlopen(/usr/local/lib/lua/5.3/lgi/corelgilua51.so, 6): no suitable image found.  Did find:
/usr/local/lib/lua/5.3/lgi/corelgilua51.so: mach-o, but wrong architecture
/usr/local/lib/lua/5.3/lgi/corelgilua51.so: mach-o, but wrong architecture
stack traceback:
    [C]: in ?
    [C]: in function 'require'
    /usr/local/share/lua/5.3/lgi/core.lua:14: in main chunk
    [C]: in function 'require'
    /usr/local/share/lua/5.3/lgi/init.lua:19: in main chunk
    [C]: in function 'require'
    /usr/local/share/lua/5.3/lgi.lua:19: in main chunk
    [C]: in function 'require'
    /Users/andrew/src/gstreamer/fun.lua:1: in main chunk
    [C]: in ?

I also tried using the installed interpreter:

path.lua = "/usr/local/bin/lua"

but this had no effect.

SO... does anyone have any pointers? Why does the terminal work but ZeroBrane complain about the wrong architecture?

4

1 回答 1

1

ZeroBrane Studio 附带的 lua53 二进制文件是 i386 可执行文件(32 位),但您使用的库可能是 64 位,因此有关错误架构的消息。

path.lua = "/usr/local/bin/lua"

但这没有效果。

如果您将它与 Lua 5.3 解释器一起使用,则需要设置path.lua53;尝试path.lua53 = "/usr/local/bin/lua"(假设/usr/local/bin/lua是 Lua 5.3 解释器)。有关详细信息/示例,请参阅文档中的解释器路径部分。

此外,这个文件/usr/local/lib/lua/5.3/lgi/corelgilua51.sopath.lua53

于 2017-11-16T02:42:16.677 回答