Installation scripts fails to configure luarocks due to missing `--with-lua-include' flag
When trying to install rocks.nvim through the install script, the installer fails to configure luarocks with the following error message:
Configuring LuaRocks version dev...
Lua interpreter found: /bin/lua5.1
Checking if /bin/lua5.1 is Lua version 5.1... yes
lua.h for Lua 5.1 not found (tried //include/lua/5.1/lua.h //include/lua5.1/lua.h //include/lua-5.1/lua.h //include/lua51/lua.h //include/lua.h)
If the development files for Lua (headers and libraries)
are installed in your system, you may need to use the
--with-lua or --with-lua-include flags to specify their location.
If those files are not yet installed, you need to install
them using the appropriate method for your operating system.
Run ./configure --help for details on flags.
configure failed.
A fix is to download the installation script and to modify the configuration command (line 192 of installer.lua) to add the --with-lua-include flag with a path containing the required includes (for instance /usr/include did the trick on Debian testing with the package liblua5.1-0-dev installed).
It would be nice to modify the installation script in a way that allows the user to set this flag through an environment variable instead of having to download, edit and run it locally.
Hey :wave:
thanks for reporting. I'll look into this. We've also thought of packaging a pre-built luarocks (perhaps bundled with Lua 5.1).
We are shifting our focus to developing rocks and using it instead of luarocks.
- #539
For ones who are still struggling with this issue, setting LUA_DIR and LUA_DIR_SET will fix the issue:
LUA_DIR=/path/where/lua/is/installed
LUA_DIR_SET=yes
For example (when installed via nix):
LUA_DIR=/nix/store/8438aynxm813i6ksassvgq8bb40f8fln-lua-5.1.5-env
LUA_DIR_SET=yes
You can check proper LUA_DIR for your case by running luarocks config.
For ones who are still struggling with this issue, setting
LUA_DIRandLUA_DIR_SETwill fix the issue:LUA_DIR=/path/where/lua/is/installed LUA_DIR_SET=yesFor example (when installed via nix):
LUA_DIR=/nix/store/8438aynxm813i6ksassvgq8bb40f8fln-lua-5.1.5-env LUA_DIR_SET=yesYou can check proper
LUA_DIRfor your case by runningluarocks config.
If you come from NixOS, you need these 2 packages: lua and luajitPackages.luarocks
Then as he said, run luarocks config, you'll see the correct path. Just add it to your /nix folder (or wherever you have your config) and that should work.
There might be an easier way to do this but this is the first thing that worked for me