Luarocks Installation

2019-06-11 22:14发布

问题:

I am trying to install the latest version of Luarocks, obtained from luarocks's official site. Firstly, I used the Lua binaries obtained from LuaForge Lua Binaries project referred from Official Lua site. But the install script returns the following error (trailed output because of stack overflow restrictions) :

LuaRocks 2.4.x installer.

========================
== Checking system... ==
========================

Admin privileges available for installing
Looking for Lua interpreter
    checking C:\Programs\Lua
       Found lua.exe, testing it...
Interpreter found, now looking for link libraries...
    checking for C:\Programs\Lua\lua5.3.lib
    checking for C:\Programs\Lua\lua53.lib
    checking for C:\Programs\Lua\lua5.3.dll
    checking for C:\Programs\Lua\lua53.dll
       Found lua53.dll
....................................................
Could not find Lua. See /? for options for specifying the location of Lua, or installing a bundled copy of Lua 5.1.

Failed installing LuaRocks. Run with /? for help.

Then I used another Lua binaries obtained from Lua - joedf's Builds referred from Official Lua site. But the install script returns the following error (trailed output because of stack overflow restrictions) :

LuaRocks 2.4.x installer.

========================
== Checking system... ==
========================

Admin privileges available for installing
Looking for Lua interpreter
    checking C:\Programs\Lua
       Found lua53.exe, testing it...
Interpreter found, now looking for link libraries...
    checking for C:\Programs\Lua\lua5.3.lib
    checking for C:\Programs\Lua\lua53.lib
    checking for C:\Programs\Lua\lua5.3.dll
    checking for C:\Programs\Lua\lua53.dll
       Found lua53.dll
Link library found, now looking for headers...
    checking for C:\Programs\Lua\include\lua\5.3\lua.h
    checking for C:\Programs\Lua\include\lua53\lua.h
    checking for C:\Programs\Lua\include\lua5.3\lua.h
    checking for C:\Programs\Lua\include\lua.h
    checking for C:\Programs\Lua\lua.h
    checking C:\Windows\system32\inetsrv
       Found lua53.exe, testing it...
Interpreter found, now looking for link libraries...
    checking for C:\Programs\Lua\lua5.3.lib
    checking for C:\Programs\Lua\lua53.lib
    checking for C:\Programs\Lua\lua5.3.dll
    checking for C:\Programs\Lua\lua53.dll
       Found lua53.dll
......................................................
Could not find Lua. See /? for options for specifying the location of Lua, or installing a bundled copy of Lua 5.1.

Failed installing LuaRocks. Run with /? for help.

Then I used another Lua binaries obtained from LuaDist referred from official Lua site. It already includes luarocks, but an older version. Using this version results the following error : Orbit Installation Using Luarocks in Windows. So, tried install script of luarocks. The installation is successful, and I configured the following variables according to the installer instruction (trailed output because of stack overflow restrictions) :

............................................................ 
============================
== LuaRocks is installed! ==
============================

You may want to add the following elements to your paths;
Lua interpreter;
  PATH     :   C:\Programs\Binaries-LuaDist-batteries-0.9.8-Windows-x86\bin
  PATHEXT  :   .LUA
LuaRocks;
  PATH     :   C:\Program Files (x86)\LuaRocks
  LUA_PATH :   C:\Program Files (x86)\LuaRocks\lua\?.lua;C:\Program Files (x86)\LuaRocks\lua\?\init.lua
Local user rocktree (Note: %APPDATA% is user dependent);
  PATH     :   %APPDATA%\LuaRocks\bin
  LUA_PATH :   %APPDATA%\LuaRocks\share\lua\5.1\?.lua;%APPDATA%\LuaRocks\share\lua\5.1\?\init.lua
  LUA_CPATH:   %APPDATA%\LuaRocks\lib\lua\5.1\?.dll
System rocktree
  PATH     :   c:\programs\binaries-luadist-batteries-0.9.8-windows-x86\\bin
  LUA_PATH :   c:\programs\binaries-luadist-batteries-0.9.8-windows-x86\\share\lua\5.1\?.lua;c:\programs\binaries-luadist-batteries-0.9.8-windows-x86\\share\lua\5.1\?\init.lua
  LUA_CPATH:   c:\programs\binaries-luadist-batteries-0.9.8-windows-x86\\lib\lua\5.1\?.dll

Note that the %APPDATA% element in the paths above is user specific and it MUST
be replaced by its actual value.
For the current user that value is: C:\Users\Banee-Ishaque-K\AppData\Roaming.

But luarocks command now returns

windows can't open this file

error, what will do? I am working on Windows 7 64 bit and there is no compilation method for Windows for manual compilation of Lua instead of using binaries.

回答1:

The Solution is, just specify the Lua installation directory to Luarocks Installation script(INSTALL.bat) file using CMD line argument /LUA. In the above case,

C:\Programs\luarocks-2.4.2-win32>install.bat /LUA C:\Programs\Binaries-LuaDist-batteries-0.9.8-Windows-x86 

will install Luarocks successfully. Tested & Verified on Win 7 64 bit with Lua 5.1 64 bit along with Luarocks 2.4.2 win32 package.

To Install Luarocks; Lua interpreter,link libraries,headers & runtime must be present in the system. The binaries from LuaForge Lua Binaries project & Lua - joedf's Builds only contains Lua interpreter & link libraries. That's why the first two methods failed with errors.

Lua binaries obtained from LuaDist contains Lua interpreter,link libraries & headers; The runtime will be available in most windows systems used for development purpose (if not, we can install matching ( version that is used to compile Lua source to binary) Microsoft Visual C++ Redistributables from Microsoft website). But, the problem is ..\Binaries-LuaDist-batteries-0.9.8-Windows-x86\bin is in path. the folder contains only Lua interpreter. link libraries & headers are in ..\Binaries-LuaDist-batteries-0.9.8-Windows-x86 folder.



标签: lua luarocks