• opentesty--luasocket 安装


    转载请注明原文地址:http://www.cnblogs.com/dongxiao-yang/p/4878323.html

    luasocket安装过程中遇到不少坑,之前采用的是从公司以前服务器的里面找一个其他同学下好的rpm安装包直接安装,安装的路径以及产生的库文件在什么位置都不知道怎么控制,今天抽时间一通google,终于跑通了源码安装的过程。

    官方下载地址:http://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2

     tar -zxvf  luasocket-2.0.2.tar.gz

    cd luasocket-2.0.2

    修改配置文件config

    由于是在安装openresty后再安装luasocket,修改配置文件为,这样将制定luasocket生成的库文件放到openresty默认会寻找的路径下

    INSTALL_TOP_SHARE=/opt/openresty/luajit/share/lua/5.1

    INSTALL_TOP_LIB=/opt/openresty/luajit/lib/lua/5.1

     

    参考http://blog.csdn.net/wzzfeitian/article/details/8866390教程介绍

    make

    这种情况下会报错

    cd src; make all

    make[1]: Entering directory `/opt/luasocket-2.0.2/src'

    gcc -I/usr/share/lua/5.1 -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o luasocket.o luasocket.c

    luasocket.c:20:17: error: lua.h: No such file or directory

    luasocket.c:21:21: error: lauxlib.h: No such file or directory

    luasocket.c:24:24: error: compat-5.1.h: No such file or directory

    In file included from luasocket.c:30:

    luasocket.h:30: error: expected ')' before '*' token

    In file included from luasocket.c:31:

    auxiliar.h:37: error: expected ')' before '*' token

    auxiliar.h:38: error: expected ')' before '*' token

    auxiliar.h:39: error: expected ')' before '*' token

    auxiliar.h:40: error: expected ')' before '*' token

    auxiliar.h:41: error: expected ')' before '*' token

    auxiliar.h:42: error: expected ')' before '*' token

    auxiliar.h:43: error: expected ')' before '*' token

    auxiliar.h:44: error: expected ')' before '*' token

    auxiliar.h:45: error: expected ')' before '*' token

    auxiliar.h:46: error: expected ')' before '*' token

    In file included from luasocket.c:32:

    except.h:33: error: expected ')' before '*' token

    In file included from luasocket.c:33:

    timeout.h:19: error: expected ')' before '*' token

    timeout.h:26: error: expected ')' before '*' token

    In file included from luasocket.c:34:

    buffer.h:39: error: expected ')' before '*' token

    buffer.h:41: error: expected ')' before '*' token

    buffer.h:42: error: expected ')' before '*' token

    buffer.h:43: error: expected ')' before '*' token

    buffer.h:44: error: expected ')' before '*' token

    In file included from luasocket.c:35:

    inet.h:27: error: expected ')' before '*' token

    inet.h:35: error: expected ')' before '*' token

    inet.h:36: error: expected ')' before '*' token

    In file included from luasocket.c:36:

    tcp.h:34: error: expected ')' before '*' token

    In file included from luasocket.c:37:

    udp.h:31: error: expected ')' before '*' token

    In file included from luasocket.c:38:

    select.h:15: error: expected ')' before '*' token

    luasocket.c:43: error: expected ')' before '*' token

    luasocket.c:44: error: expected ')' before '*' token

    luasocket.c:45: error: expected ')' before '*' token

    luasocket.c:50: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'mod'

    luasocket.c:60: warning: ISO C does not allow extra ';' outside of a function

    luasocket.c:62: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'func'

    luasocket.c:66: warning: ISO C does not allow extra ';' outside of a function

    luasocket.c:71: error: expected ')' before '*' token

    luasocket.c:80: error: expected ')' before '*' token

    luasocket.c:89: error: expected ')' before '*' token

    luasocket.c:113: error: expected ')' before '*' token

    make[1]: *** [luasocket.o] Error 1

    make[1]: Leaving directory `/opt/luasocket-2.0.2/src'

    make: *** [all] Error 2

     

    这个问题之前查了几次没有结果,看错误输出也一直以为是下的源码包有问题,下了好几个版本都不行,后来偶然看到了http://stackoverflow.com/questions/20490854/luasocket-c2017-error-lua-h-no-such-file-or-directory

    有人遇到了同样的问题,生硬照搬答案里make LUAINC=-I/usr/include/lua5.1/的方法也没有解决,反而是看到问题的comment小字有人回复了一句话搞明白了问题的真正原因:

    lua.h is the main header file for the Lua C source code. Either you don't have the lua source installed, or you haven't told the compiler where to find it. – Roddy Dec 10 '13 at 9:46 

    所以说其实是gcc编译命令找不到本机lua的源码到底在什么地方,自然无法编译。正好错误里提示lua.h这个文件找不到,find一下其实就在openresty的build/lua-5.1.5/src下。

    修改config文件

    LUAINC=-I/opt/ngx_openresty-1.9.3.1/build/lua-5.1.5/src

    重新运行make&&make install 成功

     

    再去检查下

    INSTALL_TOP_SHARE=/opt/openresty/luajit/share/lua/5.1

    INSTALL_TOP_LIB=/opt/openresty/luajit/lib/lua/5.1

    这两个路径下socket库文件都已经存在了。

     

    其实之前看http://www.linuxidc.com/Linux/2013-12/93516.htm的过程也提到了要修改LUAINC属性,只不过当时完全不知道这个是干嘛的就滑过去了,其实还是lua生的不行造成的~~~~~

     

     

     

  • 相关阅读:
    xcode常用的快捷键
    属性字符串(NSAttributedString)的简单应用
    ARC下OC对象和CF对象之间的桥接(bridge)
    oracle字符集相关问题
    oracle 利用flashback将备库激活为read wirte(10g 及上)
    dataguard 归档丢失(主库中无此丢失归档处理),备库基于SCN恢复
    DATAGUARD 在线重建备库
    DATAGUARD 添加修改REDOLOG大小
    ORACLE 10G 闪回建议
    10G R2 参数文件相关
  • 原文地址:https://www.cnblogs.com/dongxiao-yang/p/4878323.html
Copyright © 2020-2023  润新知