日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

opentesty--luasocket 安装

發(fā)布時間:2024/10/12 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 opentesty--luasocket 安装 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

轉載請注明原文地址: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生的不行造成的~~~~~

?

?

?

?

轉載于:https://www.cnblogs.com/dongxiao-yang/p/4878323.html

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的opentesty--luasocket 安装的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。