Luarocks 安裝艱難過程


1.最好新建一個你自己的目錄,然后把lua + Luarocks 都安裝在這個文件夾下面,方便以后維護

2.安裝lua環境

$ wget http://www.lua.org/ftp/lua-5.3.0.tar.gz 
$ tar zxvf lua-5.3.0.tar.gz 
$ cd lua-5.3.0 
$ vi Makefile 
INSTALL_TOP= /usr/local/lua-5.3.0 --指定安裝的目錄

$ make linux 
$ make install

3. 安裝luarocks 環境

$ wget http://keplerproject.github.io/luarocks/releases/luarocks-2.2.2.tar.gz  

$ tar -xzvf luarocks-2.2.2.tar.gz  

$ cd luarocks-2.2.2  

$ ./configure --prefix=/usr/local/luarocks-2.2.2 --with-lua=/usr/local/lua-5.3.0 (luarocks-2.2.2 所在目錄,lua-5.3.0配置的安裝目錄INSTALL_TOP= /usr/local/lua-5.3.0 --指定安裝的目錄

$ make build  

$ make install 

4.重點來了,我執行 ./configure  --prefix=/usr/local/luarocks-2.2.2 --with-lua=/usr/local/lua-5.3.0 一直報下面的錯誤

報錯信息:[root@test-l27-15-165 luarocks-2.2.2]# ./configure --prefix=/usr/fxj/luarocks-2.2.2 --with-lua=/usr/local/include/

Checking Lua interpreter... lua not found (looked in /usr/local/include//bin)

You may want to use the flag --with-lua or --with-lua-bin. See --help.

configure failed.

那么這個路徑具體該怎么設置呢?

luarocks-2.2.2這會是這個解壓包所在的路徑,/usr/local/lua-5.3.0這個是INSTALL_TOP= /usr/local/lua-5.3.0 

[root@test-l27-15-165 luarocks-2.2.2]# ./configure --prefix=/usr/fxj/luarocks-2.2.2 --with-lua=/usr/local/lua-5.3.0
Lua interpreter found: /usr/local/lua-5.3.0/bin/lua...
Lua version detected: 5.3
Checking Lua includes... lua.h found in /usr/local/lua-5.3.0/include/lua.h
curl found at /usr/bin
md5sum found at /usr/bin
Configuring for system... Linux
Configuring for architecture... x86_64
Using unversioned rocks dir: /usr/fxj/luarocks-2.2.2/lib/luarocks/rocks
Writing configuration...

Installation prefix: /usr/fxj/luarocks-2.2.2
LuaRocks configuration directory: /usr/fxj/luarocks-2.2.2/etc/luarocks
Using Lua from: /usr/local/lua-5.3.0

Done configuring.
- Type 'make build' and 'make install':
to install to /usr/fxj/luarocks-2.2.2 as usual.
- Type 'make bootstrap':
to install LuaRocks in /usr/fxj/luarocks-2.2.2 as a rock.

 藍色為結果

提示找不到lua.h,默認情況下會從/usr下尋找

再次執行:

[root@test-l27-15-165 luarocks-2.2.2]# find / -name = lua.h
find: paths must precede expression: lua.h
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
[root@test-l27-15-165 luarocks-2.2.2]# find / -name lua.h
/usr/fxj/lua-5.3.0/src/lua.h
/usr/local/include/lua.h
/usr/local/lua-5.3.0/include/lua.h

再次執行下面這個命令:

./configure --with-lua=/usr/local --with-lua-include=/usr/local/include

$ make build  

$ make install 

5.輸入下面驗證是否安裝成功:

[root@test-l27-15-165 luarocks-2.2.2]# luarocks

LuaRocks 2.2.2, a module deployment system for Lua

NAME
/usr/local/bin/luarocks - LuaRocks main command-line interface

SYNOPSIS
/usr/local/bin/luarocks [--from=<server> | --only-from=<server>] [--to=<tree>] [VAR=VALUE]... <command> [<argument>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM