luasocket编译安装遇到的坑
由于需要获得本机的IP地址,所以需要 :
local socket = require('socket')
local server_hostname = socket.dns.gethostname()
local server_ip = socket.dns.toip(server_hostname)
需要下载源码编译:luasocket-2.0.2.tar.gz
- 解压好之后首先修改config文件来制定安装的路径,修改涉及的三个地方:
# 由于是先安装的openresty-1.13.6.1:/opt/soft/openresty/
LUAINC=-I/opt/soft/openresty/luajit/include/luajit-2.1/
INSTALL_TOP_SHARE=/opt/soft/openresty/luajit/share/lua/5.1
INSTALL_TOP_LIB=/opt/soft/openresty/luajit/lib/lua/5.1
- 编译安装
make
make install
cd src; make all
make[1]: Entering directory `/data/tools/luasocket-2.0.2/src'
gcc -I/opt/soft/openresty/luajit/include/luajit-2.1/ -DLUASOCKET_DEBUG -pedantic -Wall -O2 -fpic -c -o luasocket.o luasocket.c
In file included from luasocket.c:31:0:
auxiliar.h:38:61: error: unknown type name ‘luaL_reg’
void auxiliar_newclass(lua_State *L, const char *classname, luaL_reg *func);
^
luasocket.c:50:1: error: unknown type name ‘luaL_reg’
static const luaL_reg mod[] = {
^
luasocket.c:51:5: warning: braces around scalar initializer [enabled by default]
{"auxiliar", auxiliar_open},
^
luasocket.c:51:5: warning: (near initialization for ‘mod[0]’) [enabled by default]
luasocket.c:51:5: warning: initialization makes integer from pointer without a cast [enabled by default]
luasocket.c:51:5: warning: (near initialization for ‘mod[0]’) [enabled by default]
luasocket.c:51:5: error: initializer element is not computable at load time
luasocket.c:51:5: error: (near initialization for ‘mod[0]’)
luasocket.c:51:5: warning: excess elements in scalar initializer [enabled by default]
luasocket.c:51:5: warning: (near initialization for ‘mod[0]’) [enabled by default]
luasocket.c:52:5: warning: braces around scalar initializer [enabled by default]
{"except", except_open},
^
luasocket.c:52:5: warning: (near initialization for ‘mod[1]’) [enabled by default]
luasocket.c:52:5: warning: initialization makes integer from pointer without a cast [enabled by default]
luasocket.c:52:5: warning: (near initialization for ‘mod[1]’) [enabled by default]
luasocket.c:52:5: error: initializer element is not computable at load time
luasocket.c:52:5: error: (near initialization for ‘mod[1]’)
luasocket.c:52:5: warning: excess elements in scalar initializer [enabled by default]
luasocket.c:52:5: warning: (near initialization for ‘mod[1]’) [enabled by default]
luasocket.c:53:5: warning: braces around scalar initializer [enabled by default]
{"timeout", timeout_open},
^
luasocket.c:53:5: warning: (near initialization for ‘mod[2]’) [enabled by default]
luasocket.c:53:5: warning: initialization makes integer from pointer without a cast [enabled by default]
luasocket.c:53:5: warning: (near initialization for ‘mod[2]’) [enabled by default]
luasocket.c:53:5: error: initializer element is not computable at load time
luasocket.c:53:5: error: (near initialization for ‘mod[2]’)
luasocket.c:53:5: warning: excess elements in scalar initializer [enabled by default]
luasocket.c:53:5: warning: (near initialization for ‘mod[2]’) [enabled by default]
luasocket.c:54:5: warning: braces around scalar initializer [enabled by default]
{"buffer", buffer_open},
^
luasocket.c:54:5: warning: (near initialization for ‘mod[3]’) [enabled by default]
luasocket.c:54:5: warning: initialization makes integer from pointer without a cast [enabled by default]
luasocket.c:54:5: warning: (near initialization for ‘mod[3]’) [enabled by default]
luasocket.c:54:5: error: initializer element is not computable at load time
luasocket.c:54:5: error: (near initialization for ‘mod[3]’)
luasocket.c:54:5: warning: excess elements in scalar initializer [enabled by default]
luasocket.c:54:5: warning: (near initialization for ‘mod[3]’) [enabled by default]
luasocket.c:55:5: warning: braces around scalar initializer [enabled by default]
{"inet", inet_open},
^
luasocket.c:55:5: warning: (near initialization for ‘mod[4]’) [enabled by default]
luasocket.c:55:5: warning: initialization makes integer from pointer without a cast [enabled by default]
luasocket.c:55:5: warning: (near initialization for ‘mod[4]’) [enabled by default]
luasocket.c:55:5: error: initializer element is not computable at load time
luasocket.c:55:5: error: (near initialization for ‘mod[4]’)
luasocket.c:55:5: warning: excess elements in scalar initializer [enabled by default]
luasocket.c:55:5: warning: (near initialization for ‘mod[4]’) [enabled by default]
luasocket.c:56:5: warning: braces around scalar initializer [enabled by default]
{"tcp", tcp_open},
^
luasocket.c:56:5: warning: (near initialization for ‘mod[5]’) [enabled by default]
luasocket.c:56:5: warning: initialization makes integer from pointer without a cast [enabled by default]
luasocket.c:56:5: warning: (near initialization for ‘mod[5]’) [enabled by default]
luasocket.c:56:5: error: initializer element is not computable at load time
luasocket.c:56:5: error: (near initialization for ‘mod[5]’)
luasocket.c:56:5: warning: excess elements in scalar initializer [enabled by default]
luasocket.c:56:5: warning: (near initialization for ‘mod[5]’) [enabled by default]
luasocket.c:57:5: warning: braces around scalar initializer [enabled by default]
{"udp", udp_open},
^
luasocket.c:57:5: warning: (near initialization for ‘mod[6]’) [enabled by default]
luasocket.c:57:5: warning: initialization makes integer from pointer without a cast [enabled by default]
luasocket.c:57:5: warning: (near initialization for ‘mod[6]’) [enabled by default]
luasocket.c:57:5: error: initializer element is not computable at load time
luasocket.c:57:5: error: (near initialization for ‘mod[6]’)
luasocket.c:57:5: warning: excess elements in scalar initializer [enabled by default]
luasocket.c:57:5: warning: (near initialization for ‘mod[6]’) [enabled by default]
luasocket.c:58:5: warning: braces around scalar initializer [enabled by default]
{"select", select_open},
^
luasocket.c:58:5: warning: (near initialization for ‘mod[7]’) [enabled by default]
luasocket.c:58:5: warning: initialization makes integer from pointer without a cast [enabled by default]
luasocket.c:58:5: warning: (near initialization for ‘mod[7]’) [enabled by default]
luasocket.c:58:5: error: initializer element is not computable at load time
luasocket.c:58:5: error: (near initialization for ‘mod[7]’)
luasocket.c:58:5: warning: excess elements in scalar initializer [enabled by default]
luasocket.c:58:5: warning: (near initialization for ‘mod[7]’) [enabled by default]
luasocket.c:59:5: warning: braces around scalar initializer [enabled by default]
{NULL, NULL}
^
luasocket.c:59:5: warning: (near initialization for ‘mod[8]’) [enabled by default]
luasocket.c:59:5: warning: initialization makes integer from pointer without a cast [enabled by default]
luasocket.c:59:5: warning: (near initialization for ‘mod[8]’) [enabled by default]
luasocket.c:59:5: warning: excess elements in scalar initializer [enabled by default]
luasocket.c:59:5: warning: (near initialization for ‘mod[8]’) [enabled by default]
luasocket.c:62:1: error: unknown type name ‘luaL_reg’
static luaL_reg func[] = {
^
luasocket.c:63:5: warning: braces around scalar initializer [enabled by default]
{"skip", global_skip},
^
luasocket.c:63:5: warning: (near initialization for ‘func[0]’) [enabled by default]
luasocket.c:63:5: warning: initialization makes integer from pointer without a cast [enabled by default]
luasocket.c:63:5: warning: (near initialization for ‘func[0]’) [enabled by default]
luasocket.c:63:5: error: initializer element is not computable at load time
luasocket.c:63:5: error: (near initialization for ‘func[0]’)
luasocket.c:63:5: warning: excess elements in scalar initializer [enabled by default]
luasocket.c:63:5: warning: (near initialization for ‘func[0]’) [enabled by default]
luasocket.c:64:5: warning: braces around scalar initializer [enabled by default]
{"__unload", global_unload},
^
luasocket.c:64:5: warning: (near initialization for ‘func[1]’) [enabled by default]
luasocket.c:64:5: warning: initialization makes integer from pointer without a cast [enabled by default]
luasocket.c:64:5: warning: (near initialization for ‘func[1]’) [enabled by default]
luasocket.c:64:5: error: initializer element is not computable at load time
luasocket.c:64:5: error: (near initialization for ‘func[1]’)
luasocket.c:64:5: warning: excess elements in scalar initializer [enabled by default]
luasocket.c:64:5: warning: (near initialization for ‘func[1]’) [enabled by default]
luasocket.c:65:5: warning: braces around scalar initializer [enabled by default]
{NULL, NULL}
^
luasocket.c:65:5: warning: (near initialization for ‘func[2]’) [enabled by default]
luasocket.c:65:5: warning: initialization makes integer from pointer without a cast [enabled by default]
luasocket.c:65:5: warning: (near initialization for ‘func[2]’) [enabled by default]
luasocket.c:65:5: warning: excess elements in scalar initializer [enabled by default]
luasocket.c:65:5: warning: (near initialization for ‘func[2]’) [enabled by default]
luasocket.c: In function ‘base_open’:
luasocket.c:92:9: warning: passing argument 3 of ‘luaL_openlib’ from incompatible pointer type [enabled by default]
luaL_openlib(L, "socket", func, 0);
^
In file included from luasocket.c:21:0:
/opt/soft/openresty/luajit/include/luajit-2.1/lauxlib.h:26:18: note: expected ‘const struct luaL_Reg *’ but argument is of type ‘int *’
LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname,
^
luasocket.c: In function ‘luaopen_socket_core’:
luasocket.c:116:23: error: request for member ‘name’ in something not a structure or union
for (i = 0; mod[i].name; i++) mod[i].func(L);
^
luasocket.c:116:41: error: request for member ‘func’ in something not a structure or union
for (i = 0; mod[i].name; i++) mod[i].func(L);
^
luasocket.c:116:46: error: called object is not a function or function pointer
for (i = 0; mod[i].name; i++) mod[i].func(L);
^
luasocket.c:116:35: warning: statement with no effect [-Wunused-value]
for (i = 0; mod[i].name; i++) mod[i].func(L);
^
make[1]: *** [luasocket.o] Error 1
make[1]: Leaving directory `/data/tools/luasocket-2.0.2/src'
make: *** [all] Error 2
make时候报错
root@fbprophet-10.153.169.67[17:29:32]$ grep -r -i luaL_reg /opt/soft/openresty/ |grep -v Binary
/opt/soft/openresty/resty.index: section 127415 127764 lual_reg
/opt/soft/openresty/resty.index: section 127764 128541 lual_register
/opt/soft/openresty/resty.index: section 195477 195545 function lual_openlib was replaced by lual_register.
/opt/soft/openresty/pod/lua-5.1.5/lua-5.1.5.pod:=head2 C<luaL_Reg>
/opt/soft/openresty/pod/lua-5.1.5/lua-5.1.5.pod: typedef struct luaL_Reg {
/opt/soft/openresty/pod/lua-5.1.5/lua-5.1.5.pod: } luaL_Reg;
/opt/soft/openresty/pod/lua-5.1.5/lua-5.1.5.pod:Type for arrays of functions to be registered by C<luaL_register>.
/opt/soft/openresty/pod/lua-5.1.5/lua-5.1.5.pod:Any array of C<luaL_Reg> must end with an sentinel entry in which both
/opt/soft/openresty/pod/lua-5.1.5/lua-5.1.5.pod:=head2 C<luaL_register>
/opt/soft/openresty/pod/lua-5.1.5/lua-5.1.5.pod: void luaL_register (lua_State *L,
/opt/soft/openresty/pod/lua-5.1.5/lua-5.1.5.pod: const luaL_Reg *l);
/opt/soft/openresty/pod/lua-5.1.5/lua-5.1.5.pod:functions in the list C<l> (see C<luaL_Reg>) into the table on the top
/opt/soft/openresty/pod/lua-5.1.5/lua-5.1.5.pod:When called with a non-null C<libname>, C<luaL_register> creates a new
/opt/soft/openresty/pod/lua-5.1.5/lua-5.1.5.pod:=item * Function C<luaL_openlib> was replaced by C<luaL_register>.
/opt/soft/openresty/luajit/include/luajit-2.1/lauxlib.h:typedef struct luaL_Reg {
/opt/soft/openresty/luajit/include/luajit-2.1/lauxlib.h:} luaL_Reg;
/opt/soft/openresty/luajit/include/luajit-2.1/lauxlib.h: const luaL_Reg *l, int nup);
/opt/soft/openresty/luajit/include/luajit-2.1/lauxlib.h:LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
/opt/soft/openresty/luajit/include/luajit-2.1/lauxlib.h: const luaL_Reg *l);
/opt/soft/openresty/luajit/include/luajit-2.1/lauxlib.h:LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
root@fbprophet-10.153.169.67[17:29:36]$
查找luaL_reg
/opt/soft/openresty/luajit/include/luajit-2.1/lauxlib.h 里定义的结构体名字和 luaL_reg 不一致
typedef struct luaL_Reg {
const char *name;
lua_CFunction func;
} luaL_Reg;
然后把 luasocket-2.0.2/src 下所有luaL_reg 替换成 luaL_Reg ,
然后重新编译就可以了。
luasocket编译安装遇到的坑的更多相关文章
- openssl1.0在mac下的编译安装(踩坑精华)
之前做了一次brew版本升级,然后用pip3安装的一个python命令就无法执行了(涉及到openssl库),执行就会报一个错误. ImportError: dlopen(/usr/local/Cel ...
- centos7编译安装redis遇坑
编译redis时:make cc Command not found 原因分析:没有安装gcc,执行: yum install gcc 编译redis时:error: jemalloc/jemallo ...
- 源码编译安装 ganesha
源码编译安装 ganesha 简介 系统环境:CentOS 7.5 ceph:luminous nfs-ganesha:v2.6 stable 安装步骤 安装依赖 首先需要安装编译会用到的公共库 1 ...
- Ubuntu16.04编译安装tensorflow,2018最新血泪踩坑之后的全面总结!绝对成功!【转】
本文转载自:https://blog.csdn.net/pzh11001/article/details/79683133 大家好,我是 (深度学习硬件DIY总群)(719577294)群主: ...
- mac M1 php扩展 xlswriter 编译安装爬坑记录
电脑配置 MacBook Pro(14英寸,2021年) 系统版本 macOS Monterey 12.4 芯片 Apple M1 Pro PHP环境 MAMP Pro Version 6.6.1 ( ...
- 源码编译安装lnmp环境(nginx-1.14.2 + mysql-5.6.43 + php-5.6.30 )------踩了无数坑,重装了十几次服务器才会的,不容易啊!
和LAMP不同的是,LNMP中的N指的是Nginx(类似于Apache的一种web服务软件),并且php是作为一个独立服务存在的,这个服务叫做php-fpm,Nginx直接处理静态请求,动态请求会转发 ...
- 源码编译安装MySQL-5.6/mysql-5.6.39------踩了无数坑,重装了十几次服务器才会的,不容易啊!
1.切换到src目录 cd /usr/local/src/ 2. 下载mysql免编译二进制包 免编译的mysql二进制包5.6源码包: wget http://mirrors.163.com/mys ...
- 源码编译安装Apache/2.4.37-------踩了无数坑,重装了十几次服务器才会的,不容易啊!
1.先进入/usr/local/中创建三个文件夹 apr apr-util apache cd /usr/local目录 mkdir apr mkdir apr-util mkdir apache 2 ...
- Opencv3.3(Linux)编译安装至python的坑
编译安装OpenCV绝对是一件让人发狂的事情,CMake繁多的选项,国内蛋疼的网速,实在让人无力吐槽,然而为了使用contrib包,我不得不重新编译他. OpenCV的编译 其实OpenCV编译并不是 ...
随机推荐
- spark als scala实现(二)
Vi t1.txt1,101,5.01,102,3.01,103,2.52,101,2.02,102,2.52,103,5.02,104,2.03,101,2.53,104,4.03,105,4.5 ...
- c#核心基础 - 浅谈 c# 中的特性 Attribute)
特性(Attribute)是用于在运行时传递程序中各种元素(比如类.方法.结构.枚举.组件等)的行为信息的声明性标签.可以通过使用特性向程序添加声明性信息.一个声明性标签是通过放置在它所应用的元素前面 ...
- [SQL Server] 时间处理:获取今天的00:00:00/获取今天的23:59:59
获取今天的00:00:00 SELECT CONVERT(DATETIME,CONVERT(VARCHAR(10),GETDATE(),120)) 获取今天的23:59:59 1.SELECT DAT ...
- SSH服务与tcp wrappers实验
SSH服务与tcp wrappers实验 实验环境: 一台linux(ssh client) 一台linux(ssh server) 实验步骤: 1.配置IP,测试连通性 2.在客户端创建用户yuzl ...
- react this的作用域问题,麻烦大佬们帮我解决一下
element里面有个Table组件,我想在编辑和删除那里加上点击事件,但是发现点击方法没有效果 这里面的this看起来好像只针对这个作用域里面的,这里没有办法设置状态,也不能调用方法 设置状态会出现 ...
- 查看redis连接数
在redis-cli命令行使用:info clients可以查看当前的redis连接数. 如下图: config get maxclients 可以查询redis允许的最大连接数. 如下图:
- spring boot 自定义sql分页查询
1.自定义sql查询分页 @Override public <T> Page<T> pageSQL(@Nonnull String sql, @Nonnull Pageable ...
- 类 Calendar
简介 Java.util.Calendar是日历类,在Date后出现,替换掉了许多Date的方法.该类将所有可能用到的时间信息封装为静态成员变量,方便获取.日历类就是方便获取各个时间属性的.注意Cal ...
- OpenStack之Fuel架构及其工作原理
一.Fuel架构 Fuel是一个开源的OpenStack部署和管理的工具,它允许用户通过Web UI进行OpenStack的部署和管理,并可以通过插件来扩展. Fuel的目标:加快和简化不同配置的 ...
- 关于 sip
1.html页面 添加拨打按键 拨打按键 下面 添加 音频流/视频流 2 引入 sip.js 和 **.js **.js页面 获取各个元素 创建 simple实例 3. addEventL ...