[记录点滴]编译安装luarocks、luacheck、luautf8

0x00 摘要

记录一次安装luarocks&第三方库的过程。

0x01 luarocks

如今每个语言体系中都有一个包管理工具,PHP的Composer,Ruby的gem,Python的pip,lua第三方包管理工具就是luarocks。

wget https://luarocks.org/releases/luarocks-2.4.1.tar.gz
tar zxpf luarocks-2.4.1.tar.gz
cd luarocks-2.4.1
./configure --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1/
sudo make bootstrap

编译安装

mkdir -p "/usr/local/share/lua/5.1//luarocks"
cp src/luarocks/site_config.lua "/usr/local/share/lua/5.1//luarocks"
mkdir -p "/usr/local" 查看
which luarocks
/usr/local/bin/luarocks

0x02 安装luacheck

luacheck 是google推出的一款针对lua静态检查的开源工具,其安装简单,操作容易,检查严格,参数可控,很适合项目的lua开发。

luarocks install luacheck --- 成功

下面是luacheck git网址,留作备份

https://github.com/mpeterv/luacheck/

0x03 安装utf8第三方库

从这里下载 https://github.com/starwing/luautf8

Note that to avoid conflict with the Lua5.3's buitin library 'utf8', this library produce a file like lua-utf8.dll or lua-utf8.so. so use it like this:

local utf8 = require 'lua-utf8'
in your codes :-( LuaRocks Installation luarocks install luautf8 It's now full-compatible with Lua5.3's utf8 library, so replace this file (and headers) with lua5.3 source's lutf8lib.c is also okay.

安装

luarocks install luautf8
Installing https://luarocks.org/luautf8-0.1.1-1.src.rock
gcc -O2 -fPIC -I/usr/local/openresty/luajit/include/luajit-2.1/ -c lutf8lib.c -o lutf8lib.o
gcc -shared -o lua-utf8.so -L/usr/lib lutf8lib.o
luautf8 0.1.1-1 is now installed in /usr/local (license: MIT)

最后发现位置是:

$ find . -name "lua-utf8.so"
./usr/local/lib/lua/5.1/lua-utf8.so
./srv/lua/xxxx/libs/unix/lua-utf8.so

在lua中测试:

local UTF8 = require "util.misc.utf8"
local u = UTF8.escape
ngx.say(RESPONSE.error(-1, u"%123%u123%{123}%u{123}%xABC%x{ABC}", 404))
ngx.say(RESPONSE.error(-1, u"%%123%?%d%%u", 404))
print(u"%123%u123%{123}%u{123}%xABC%x{ABC}")
print(u"%%123%?%d%%u") 得到response是:
{"code":-1,"data":{"status":404},"message":"{{{{઼઼"}
{"code":-1,"data":{"status":404},"message":"%123?d%u"}

[记录点滴]编译安装luarocks、luacheck、luautf8的更多相关文章

  1. Dockerfile 编译安装mysql5.7 千万不要执行.只是记录一下编译安装罢了

    开启所有核心make  20G 内存都不够玩,跑3-4个核心吧,还好. 最后的出来的镜像3G多,百思不得其解,看了官方的Dockerfile,也没什么特别,就是 apt 或者 yum.好吧,不知做了什 ...

  2. 【记录】编译安装 YAML 扩展

    转自:https://learnku.com/articles/30985 Yaml,专门用来写配置文件的语言   依赖安装 $ sudo apt-get install libyaml-dev   ...

  3. Nginx的平滑升级记录---适用于编译安装的Nginx

    一.查看自己的Nginx的版本号 [root@localhost sbin]# cd /usr/local/nginx/sbin/ [root@localhost sbin]# ls nginx [r ...

  4. Centos6.4_X64编译安装php-5.4.17、nginx-1.4.2、mysql-5.6.13

    安装参考: CentOS 6.3编译安装Nginx1.2.2+MySQL5.5.25a+PHP5.4.5 http://www.dedecms.com/knowledge/servers/linux- ...

  5. CentOS6.7编译安装mysql5.6

    可能因为有各种情况,无法通过yum安装mysql,这里记录一下编译安装的简单步骤 使用yum安装一些依赖 yum -y install make gcc-c++ cmake bison-devel  ...

  6. linux-i386(ubuntu)下编译安装gsoap_2.8.17过程记录

    过程记录 :  1.下载gsoap_2.8.17.zip 并 解压 : $unzip gsoap_2.8.17.zip     2.进入解压后的目录gsoap-2.8   3.自动配置编译环境:  $ ...

  7. 编译安装gimp插件之Mathmap(流水记录)

    本文为在Fedora 20下编译安装Mathmap1.3.5的编译过程,如果你仅仅需要快速的安装Mathmap,那么请拉至文末的"快速安装" 其实,过程还是很有趣的,充满Error ...

  8. 在CentOS6上编译安装实现LAMP(php-modules)+phpMyAdmin安装过程全记录

    php与apache协作有三种模式:CGI.modules.FastCGI. 在CGI模式下,用户请求php文件时,apache会启动响应进程,调用php处理器处理请求,然后将结果返回给客户端.用户响 ...

  9. Centos6.8下编译安装LAMP的操作记录梳理

    之前用的最多的web框架是LNMP,偶尔也会用到LAMP.接下来简单说下LAMP环境的部署记录,这里选择源码安装的方式: LAMP相关安装包下载地址:https://pan.baidu.com/s/1 ...

  10. mysql5.7.10 源码编译安装记录 (centos6.4)【转】

    一.准备工作 1.1 卸载系统自带mysql 查看系统是否自带MySQL, 如果有就卸载了, 卸载方式有两种yum, rpm, 这里通过yum卸载 rpm -qa | grep mysql //查看系 ...

随机推荐

  1. python socket检测端口及ping检测

    python根据socket模块检测端口及vip #!/usr/bin/env python # -*- coding: utf8 -*- from .ping_helper import Pinge ...

  2. (Python基础教程之十五)Python开箱Tuple–太多值无法解压

    Python示例,用于unpack元组或序列或可迭代,以便该元组可能长于N个元素,从而导致" 太多的值无法unpack "异常. 1.打开任意长度的元组 Python" ...

  3. Python消息队列之Huey

    缘起: 之前在Python中使用最多的就是Celery, 同样的在这次项目中使用了Celery+eventlet的方式,但是由于具体执行的逻辑是使用的异步编写的, 当时就出现了一个问题,当使用http ...

  4. cajviewer逆向分析-HN文件格式分析和010editor模板开发

    文章首发于 https://mp.weixin.qq.com/s/7STPL-2nCUKC3LHozN6-zg 概述 本文介绍对cajviewer中对HN文件格式的逆向分析并介绍如何编写相应的010e ...

  5. ASP.NET Core: ConfigurationBuilder

    在 ASP.NET Core 中,大量使用了建造模式 Builer,从类型的名称就可以看出来这一点,例如 HostBuilder.ConfigurationBuilder 等等. 建造模式是对象的创建 ...

  6. 体验.NET与文件存储服务MinIO

    对象文件存储服务(OSS)主要用于存储零散的文件,和直接存储到本地文件系统中相比,有以下的几个优势: 跨服务器可用 兼容Amazon S3 API 横向扩容 高可用 支持加密 MinIO就是一个高性能 ...

  7. 【Linux】当初的学习笔记

    目录 Linux 笔记 linux基本概念 linux终端四部分 linux的实质 linux系统操作命令 查询用户 who who -H whoami 修改密码 快速切换到用户目录 sshd sys ...

  8. 【MyBatis】学习笔记11:解决字段名和属性的映射关系

    [Mybatis]学习笔记01:连接数据库,实现增删改 [Mybatis]学习笔记02:实现简单的查 [MyBatis]学习笔记03:配置文件进一步解读(非常重要) [MyBatis]学习笔记04:配 ...

  9. k8s pod重启 deployment重启

    1.15版本之后可通过kubectl rollout restart deployment -n 命令来实现滚动重启POD 该命令会先创建待用POD,待新POD运行成功后,再关闭原有POD.因此需要保 ...

  10. Mac安装thrift因bison报错的解决办法

    安装thrift时,报错: Bison version 2.5 or higher must be installed on the system! 使用brew install bison 安装新版 ...