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编译并不是 ...
随机推荐
- debian9.6修改系统语言
(中文改英文) 在VM虚拟机中安装debian9.6(查看版本命令 cat /etc/debian_version ),安装时选择语言为中文:在控制台登录操作时,大部分提示信息显示为乱码,修改中文语言 ...
- IBM developer:Setting up the Kafka plugin for Ranger
Follow these steps to enable and configure the Kafka plugin for Ranger. Before you begin The default ...
- vue项目报错webpackJsonp is not defined
在vue单页面应用中,我们大概都会使用CommonsChunkPlugin这个插件. 传送门 CommonsChunkPlugin 但是在项目经过本地测试没有任何问题,打包上线后却会报错 webpac ...
- vue源码分析—Vue.js 源码目录设计
Vue.js 的源码都在 src 目录下,其目录结构如下 src ├── compiler # 编译相关 ├── core # 核心代码 ├── platforms # 不同平台的支持 ├── ser ...
- asyncio 基础用法
asyncio 基础用法 python也是在python 3.4中引入了协程的概念.也通过这次整理更加深刻理解这个模块的使用 asyncio 是干什么的? asyncio是Python 3.4版本引入 ...
- day正则表达式补充
# 2.正则 # 方法:findall | match | split | sub# a = 10# print(a.__hash__())# def fn():# pass# print(fn.__ ...
- 2013年山东省赛F题 Mountain Subsequences
2013年山东省赛F题 Mountain Subsequences先说n^2做法,从第1个,(假设当前是第i个)到第i-1个位置上哪些比第i位的小,那也就意味着a[i]可以接在它后面,f1[i]表示从 ...
- Windows Server 2008 R2提示api-ms-win-crt-runtime-l1-1-0.dll 丢失解决方法
在一台服务器的全新windows Server 2008 R2 服务器上配置php运行环境, 在启动Apache之后,显示下图错误: 解决方法: 1.安装VC redit.exe程序解决 是VC的一个 ...
- vue.js实战——props单向数据流
Vue2.x通过props传递数据是单向的了,也就是父组件数据变化时会传递给子组件,但是反过来不行. 业务中会经常遇到两种需要改变prop的情况, 一种是父组件传递初始值进来,子组件将它作为初始值保存 ...
- JS学习笔记:(一)浏览器页面渲染机制
浏览器的内核主要分为渲染引擎和JS引擎.目前市面上常见的浏览器内核可以分为这四种:Trident(IE).Gecko(火狐).Blink(Chrome.Opera).Webkit(Safari).这里 ...