Building openresty1.7.10.1 with luajit on windows

Building openresty1.7.10.1 with luajit on windows using Cygwin, 在windows下用Cygwin下編譯帶Luajit的openresty

2013-11-27 15:39 815人閱讀 評論(0) 收藏 舉報nginx

(heeroz原創 )First install 32bit cygwin. redis

Install packet: openssl zlib-dev pcre gcc-core perl readlinejson


openresty沒有對Cygwin作兼容,咱們須要本身來修改文件windows


Open bundle\lua-cjson and lua-rds-parser and  lua-redis-parser three folder's Makefile for edit, Add those lines before 「## ..... (Macports)」
api

bundle\lua-cjson的,lua-rds-parser的,lua-redis-parser的Makefile裏,「## ***OSX (Macports)」上面加入:函數

[plain] view plaincopy在CODE上查看代碼片派生到個人代碼片ui

  1. ifeq ($(OS),Windows_NT)  this

  2.   LDFLAGS2 += -L../luajit-root/usr/local/openresty/luajit -lcyglua51  lua

  3. endif  spa


change 

[plain] view plaincopy在CODE上查看代碼片派生到個人代碼片

  1. $(CC) $(LDFLAGS) -o $@ $^  

(cjson may be "$(CC) $(LDFLAGS) $(CJSON_LDFLAGS) -o $@ $(OBJS)")

to

[plain] view plaincopy在CODE上查看代碼片派生到個人代碼片

  1. $(CC) $(LDFLAGS) -o $@ $^ $(LDFLAGS2)  


(cjson may be "$(CC) $(LDFLAGS) $(CJSON_LDFLAGS) -o $@ $(OBJS) $(LDFLAGS2)")


Then run:

[plain] view plaincopy在CODE上查看代碼片派生到個人代碼片

  1. ./configure --without-select_module --with-luajit  

  2. let ./configure can found your luajit:  

  3. mv ./build/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 /usr/local/include  

  4. cp ./build/LuaJIT-2.1-20150223/src/cyglua51.dll /lib/libluajit-5.1.a  

  5. ./configure --without-select_module --with-luajit (must do this again)  


LuaJIT-2.1-20150223 my be wrong dir name, you need press tab after LuaJIT-2.1-

LuaJIT-2.1-20150223目錄名不必定同樣,你須要在LuaJIT-2.1-文字後直接按Tab換成正確的目錄。


[plain] view plaincopy在CODE上查看代碼片派生到個人代碼片

  1. let make can link your luajit:  

  2. cp ./build/LuaJIT-2.1-20150223/src/cyglua51.dll ./build/luajit-root/usr/local/openresty/luajit  

  3. make -j8  

  4. make install DESTDIR=/usr2  

  5. cp ./build/LuaJIT-2.1-20150223/src/cyglua51.dll /usr2/usr/local/openresty/nginx/sbin/  






All will be ok. You can find openresty in /usr2/usr/local/ folder.



Also the ffi may be a problem, because under cygwin, -E can not be exported function symbols, i have discussed this issue with the author Agentzh, may be next version can solve this problem (Already fixed in 1.4.3.9).

另外Cygwin編譯的使用jit的ffi可能有問題,由於cygwin下-E沒法導出函數符號,春哥已生成補丁,預估之後版本能夠解決(1.4.3.9已解決)。


個人主頁:

http://www.fullautocapitalism.com/

相關文章
相關標籤/搜索