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?
lua53 binary that comes with ZeroBrane Studio is i386 executable (32bit), but the library you are using is probably 64bit, hence the message about the wrong architecture.
path.lua = "/usr/local/bin/lua"
but this had no effect.
If you are using it with Lua 5.3 interpreter, you'll need to set path.lua53
instead; try path.lua53 = "/usr/local/bin/lua"
(assuming /usr/local/bin/lua
is Lua 5.3 interpreter). See Interpreter Path section in the documentation for details/examples.
Also, this filename (/usr/local/lib/lua/5.3/lgi/corelgilua51.so
) looks suspicious, as it mixes 5.3 and 51, but if it works from the command line, it should work from the IDE as well when you set path.lua53
.