Building openresty1.7.10.1 with luajit on windows using Cygwin, 在windows下用Cygwin下编译带Luajit的openresty

(heeroz原创 )First install 32bit cygwin. 

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

openresty没有对Cygwin做兼容,我们需要自己来修改文件

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

bundle\lua-cjson的,lua-rds-parser的,lua-redis-parser的Makefile里,“## ***OSX (Macports)”上面加入:

ifeq ($(OS),Windows_NT)
  LDFLAGS2 += -L../luajit-root/usr/local/openresty/luajit -lcyglua51
endif

change 

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

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

to

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

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

Then run:

./configure --without-select_module --with-luajit
let ./configure can found your luajit:
mv ./build/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 /usr/local/include
cp ./build/LuaJIT-2.1-20150223/src/cyglua51.dll /lib/libluajit-5.1.a
./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换成正确的目录。

let make can link your luajit:
cp ./build/LuaJIT-2.1-20150223/src/cyglua51.dll ./build/luajit-root/usr/local/openresty/luajit
make -j8
make install DESTDIR=/usr2
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.heerozh.com

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装PostgresNginx模块需要以下步骤: 1. 安装PostgreSQL 首先需要安装PostgreSQL数据库,可以从官网下载安装包进行安装。 2. 安装OpenRestyWindows下安装OpenResty可以从官网下载安装包进行安装。 3. 安装PostgresNginx模块 可以从Github上下载PostgresNginx模块的源码,然后将其解压到任意目录下。 在OpenResty目录下创建一个名为“modules”的子目录,将解压后的PostgresNginx模块源码移动到该目录下。 打开OpenResty目录下的“bundle”子目录,找到“nginx-1.19.3”目录下的“configure”文件。 在该文件中添加以下内容: ``` --add-module=../modules/ngx_postgres ``` 保存文件并退出。 4. 编译OpenRestyOpenResty目录下打开命令行,输入以下命令进行编译: ``` ./configure make make install ``` 5. 配置PostgresNginx模块 在OpenResty安装目录下找到“nginx/conf/nginx.conf”文件,并添加以下内容: ``` location /postgres { postgres_pass <IP address or hostname of PostgreSQL server>:<port>; postgres_query <SQL query to execute>; postgres_query_prepared on; postgres_output <output format>; } ``` 其中,<IP address or hostname of PostgreSQL server>:<port>为PostgreSQL服务器的IP地址和端口号,<SQL query to execute>为要执行的SQL查询语句,<output format>为输出格式(例如“json”)。 6. 启动OpenResty 在命令行中输入以下命令启动OpenResty: ``` nginx ``` 7. 测试PostgresNginx模块 在浏览器中输入以下URL进行测试: ``` http://localhost/postgres ``` 如果一切正常,应该能够看到PostgreSQL数据库返回的查询结果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值