Lua Error Loading Limlib2 Library even though it's already installed? - lua

I have install limlib2 and everything and I've checked the directories to see if it's existent, and limlib2 is there. I compile some lua code that uses
require("limlib2")
I receive this error:
lua: error loading module 'limlib2' from file '/usr/local/lib/lua/5.3/limlib2.so':
dlopen(/usr/local/lib/lua/5.3/limlib2.so, 6): Symbol not found: _luaL_checkint
Referenced from: /usr/local/lib/lua/5.3/limlib2.so
Expected in: flat namespace
in /usr/local/lib/lua/5.3/limlib2.so
stack traceback:
[C]: in ?
[C]: in function 'require'
imgpxl.lua:1: in main chunk
[C]: in ?
Any help? I don't understand what's going on.

limlib2 is referencing _luaL_checkint which fails in Lua 5.3 as _luaL_checkint has been replaced by _luaL_checkinteger in Lua 5.2
_luaL_checkint is deprecated. Just google for _luaL_checkint to find plenty of workarounds.
Checkout this: Cannot make gunplot on osx yosemite. Undefined symbols
imlib2 seems to haven't been updated in over 8 years. So no wonder you're facing problems

Related

Requiring luasnip to neovim causes errors

I am trying to use luasnip.
The configuration I am using is AstroNvim.
The modifications I made to this configuration are :
require("luasnip.loaders.from_snipmate").lazy_load() at the end of init.lua
Made a directory snippets in the same directory of init.lua, and added some basic snipmate styled snippets inside.
Commands Like :LuaSnipListAvailable works well, and snippets from friendly-snippets works well too.
However the following error message pops up when opening neovim.
Error detected while processing /Users/myusername/.config/nvim/init.lua:
E5113: Error while calling lua chunk: ...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:171: Vim(echomsg):E121: Undefined variable: Error
stack traceback:
[C]: in function 'cmd'
...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:171: in function <...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:16
7>
/Users/myusername/.local/share/nvim/packer_compiled.lua:496: in function </Users/myusername/.local/share/nvim/packer_compiled.lua:485>
[C]: in function 'require'
/Users/myusername/.config/nvim/init.lua:23: in main chunk
I tried other methods of adding snippets, but any sort of require("luasnip") seems to break all.

neovim init.lua module "lua.plguins" not found

I'm in the configuration neovim
I added the configuration file in C:\Users\wupan\AppData\Local\nvim\init.lua
require("lua.plugins")
and C:\Users\wupan\AppData\Local\nvim\lua\plugins.lua
return require('packer').startup(function()
use "wbthomason/packer.nvim"
end)
After the start-up neovim
Error detected while processing C:\Users\wupan\AppData\Local\nvim\init.lua:
E5113: Error while calling lua chunk: C:\Users\wupan\AppData\Local\nvim\init.lua:1: module 'lua.plugins' not found:
no field package.preload['lua.plugins']
no file '.\lua\plugins.lua'
no file 'C:\Users\wupan\scoop\apps\neovim\current\bin\lua\lua\plugins.lua'
no file 'C:\Users\wupan\scoop\apps\neovim\current\bin\lua\lua\plugins\init.lua'
no file '.\lua\plugins.dll'
no file 'C:\Users\wupan\scoop\apps\neovim\current\bin\lua\plugins.dll'
no file 'C:\Users\wupan\scoop\apps\neovim\current\bin\loadall.dll'
no file '.\lua.dll'
no file 'C:\Users\wupan\scoop\apps\neovim\current\bin\lua.dll'
no file 'C:\Users\wupan\scoop\apps\neovim\current\bin\loadall.dll'
stack traceback:
[C]: in function 'require'
C:\Users\wupan\AppData\Local\nvim\init.lua:1: in main chunk
Press ENTER or type command to continue
May I ask why
I tried to install Lua test the require
scoop install lua
C:\Users\wupan\code\lua\test.lua
require("hello")
C:\Users\wupan\code\lua\hello.lua
print("hello world")
There are also problems
C:\Users\wupan\scoop\apps\lua\current\lua54.exe: .\test.lua:1: module 'hello' not found:
no field package.preload['hello']
no file 'C:\Users\wupan\scoop\apps\lua\current'
no file 'C:\Users\wupan\scoop\apps\lua\current'
stack traceback:
[C]: in function 'require'
.\test.lua:1: in main chunk
[C]: in ?
Problem analysis
Let's use the following example which you gave us:
C:\Users\wupan\AppData\Local\nvim\init.lua
require("lua.plugins")
C:\Users\wupan\AppData\Local\nvim\lua\plugins.lua
return require('packer').startup(function()
use "wbthomason/packer.nvim"
end)
And now let's take a look into your error message:
no file 'C:\Users\wupan\scoop\apps\neovim\current\bin\lua\lua\plugins.lua'
The important part is the bin\lua\lua thing here. It's because your
require("lua.plugins") starts to look up a directory in one of your runtime
path (see :h rtp for more information).
Solution
You just need to fix your content in
C:\Users\wupan\AppData\Local\nvim\init.lua to:
require("plugins")
because then neovim will look up a directory which is named plugins in
C:\Users\wupan\scoop\apps\neovim\current\bin\lua for example, since its in
your runtime path.
Little note
You can change your content from
C:\Users\wupan\AppData\Local\nvim\lua\plugins.lua to:
require('packer').startup(function()
use "wbthomason/packer.nvim"
end)
or how I did it:
local packer = require('packer')
packer.startup(function(use)
use 'wbthomason/packer.nvim'
end)
That makes it a little bit more readable in my opinion :)

Error in running Torch/Lua, maybe an installation error

I installed Torch following http://torch.ch/docs/getting-started.html.
However, when I run things like "th" or any simple code, I got the following error message:
/Users/JianxuChen/torch/install/bin/luajit: ...rs/JianxuChen/torch/install/share/lua/5.1/trepl/init.lua:692: attempt to call field 'setheaptracking' (a nil value)
stack traceback:
...rs/JianxuChen/torch/install/share/lua/5.1/trepl/init.lua:692: in main chunk
[C]: in function 'require'
...Chen/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:104: in main chunk
[C]: at 0x01089f8bc0
Does anyone have ever encountered similar issue, or have any idea about how to solve it?
Thanks!
I met the same problem and solved it in this way. Your torch is not the latest version. What I do is NOT follow this http://torch.ch/docs/getting-started.html. Instead download https://github.com/torch/distro and run ./install. Then it works!

Pubnub Lua (Corona) Library not working

I am developing with Corona SDK, the most recent public release (v3.0, build 2015.2646), on OS X 10.10.
I have downloaded the pubnub corona repo from here: https://github.com/pubnub/lua/
When I try to run the pubnub examples, multiple examples are failing with a run-time error in the core pubnub.lua library.
For instance, example-channel-information, example-mathmania, example-multi-drum.
They all result in a console runtime error of:
Oct 20 10:46:51.328: Runtime error
.../pubnub/corona/examples/example-channel-information/pubnub.lua:534: attempt to call upvalue 'callback' (a table value)
stack traceback:
[C]: in function 'callback'
.../pubnub/corona/examples/example-channel-information/pubnub.lua:534: in function <.../pubnub/corona/examples/example-channel-information/pubnub.lua:532>
(tail call): ?
Is this a problem with my environment, or is there a more recent pubnub.lua release, or is this a bug?
thanks

Sublime Text FormatLua Error

I'm trying to format code with a package I installed for Sublime Text 3 - FormatLua.
However, I'm getting this error when I try to use it...
/usr/local/bin/lua: ./metalua/compiler.lua:119:
./metalua/compiler/bytecode/lopcodes.lua:284: attempt to call field
'gfind' (a nil value) stack traceback:
[C]: in function 'error'
./metalua/compiler.lua:119: in function 'get_bytecode_compiler'
./metalua/compiler.lua:125: in function 'f'
./metalua/compiler.lua:153: in function <./metalua/compiler.lua:150>
(...tail calls...)
[C]: in function 'require'
formatter.lua:24: in main chunk
[C]: in ?
Does anyone know what I must do to fix this issue? I must be missing some files - I see that gfind is nil (this was taken out after 5.0), but I don't want to mess with anything unless I'm sure I know what I'm doing. Thanks!
Yes, gfind was deprecated. You can replace string.gfind with string.gmatch. I applied a similar change for the same reason; here is the commit.
Works well after downgrading lua version to 5.1.4
Compiling from source code:
Lua 5.1.4 here: http://www.lua.org/ftp/lua-5.1.4.tar.gz:
Open your Terminal.app
wget http://www.lua.org/ftp/lua-5.1.4.tar.gz
tar xvzf lua-5.1.4.tar.gz
cd lua-5.1.4
make macosx
make install

Resources