-
Notifications
You must be signed in to change notification settings - Fork 33
Luafilesystem installing guide
FijianJacobs edited this page Jan 1, 2020
·
1 revision
- 方法1:采用luarocks方式安装(优先推荐)
Luarocks is lua package management tool just like maven for java.
- Download luarocks 2.4.4(version < 3.0.0) 下载地址: https://github.com/luarocks/luarocks/wiki/Release-history
wget https://luarocks.org/releases/luarocks-2.4.4.tar.gz
- 解压并进入luarocks目录
tar -zxvf luarocks-2.4.4.tar.gz
cd luarocks-2.4.4/
- configuration
./configure --prefix="/usr/local/openresty/luajit" \
--with-lua="/usr/local/openresty/luajit" \
--lua-suffix=jit \
--with-lua-include="/usr/local/openresty/luajit/include/luajit-2.1" \
--with-lua-lib="/usr/local/openresty/luajit/lib/"
- build and install
make build
make install
5.设置soft link
ln -s /usr/local/openresty/luajit/bin/luarocks /usr/local/bin/luarocks
- 测试Luarocks安装
luarocks
- 通过luarocks安装 luafilesystem
luarocks install luafilesystem
- 测试luafilesystem安装
resty -e "require 'lfs' "
- 方法2: 源码编译安装
- 下载luafilesystem发布版本源码luafilesystem发布版本列表
- 修改config文件中lua目录为openresty luajit相关目录,即下面中的PREFIX变量值
# Installation directories
# Default installation prefix
PREFIX=/usr/local
# System's libraries directory (where binary libraries are installed)
LUA_LIBDIR= $(PREFIX)/lib/lua/5.1
# Lua includes directory
LUA_INC += -I$(PREFIX)/include
LUA_INC += -I/usr/include/lua5.1
# OS dependent
LIB_OPTION= -shared #for Linux
#LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X
LIBNAME= $T.so.$V
# Compilation directives
WARN= -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic
INCS= $(LUA_INC)
CFLAGS= $(WARN) $(INCS)
CC= gcc
# $Id: config,v 1.21 2007/10/27 22:42:32 carregal Exp $
- make && make install
- 测试是否安装成功
resty -e "require 'lfs' "
Copyright @ 2019-2020 Go Go Easy Team