chaoshu的个人博客分享 http://blog.sciencenet.cn/u/chaoshu

博文

Ubuntu编译nginx错误

已有 4263 次阅读 2020-9-3 17:26 |个人分类:IoT|系统分类:科研笔记

nginx

The HTTP front-end runs on `nginx`_. Either install nginx or OpenResty with the following additional modules:

需要的依赖库:

LuaJIT 2.1安装:https://www.bnskd.com/2729.html

pcre/zlib/openssl:https://my.oschina.net/u/4390768/blog/4075222


完整的按照上面的模块编译过程:

./configure \

--with-http_ssl_module \

--with-http_realip_module \

--with-ld-opt="-Wl,-rpath,/usr/local/luajit/lib" \

--add-dynamic-module=./ngx_devel_kit \

--add-dynamic-module=./form-input-nginx-module \

--add-dynamic-module=./headers-more-nginx-module  \

--add-dynamic-module=./ngx_devel_kit \

--add-dynamic-module=./lua-nginx-module \

--add-module=./ngx_postgres \

--add-module=./set-misc-nginx-module


make -j2

make install


一、lua错误

make[1]: *** No rule to make target 'lua-nginx-module/src/ngx_http_lua_autoconf.h', needed by 'objs/addon/src/ndk.o'.  Stop.

打开编译相关模块的makefile文件,找到.o文件的依赖关系,找到.h文件的路径,查看是否出错并改正。

分析:

objs/Makefile中

ADDON_DEPS = $(CORE_DEPS)  ./ngx_devel_kit/src/ndk.h              ./lua-nginx-module/src/ddebug.h             ./lua-nginx-module/src/ngx_http_lua_autoconf.h

但是经过查找发现,lua-nginx-module/src/中不存在ngx_http_lua_autoconf.h文件

利用grep命令查找目录下所有文件:

grep "ngx_http_lua_autoconf.h" ./ -nr

以下文件中包含:

./lua-nginx-module/.gitignore:174:src/ngx_http_lua_autoconf.h

./lua-nginx-module/config:303:            $ngx_addon_dir/src/ngx_http_lua_autoconf.h \

./lua-nginx-module/config:565:echo "/* DO NOT EDIT! This file was automatically generated by config */" > "$ngx_addon_dir/src/ngx_http_lua_autoconf.h"

./lua-nginx-module/src/ngx_http_lua_common.h:12:#include "ngx_http_lua_autoconf.h"

发现,可以自动生成这个文件,但是没有生成,测试一下,发现权限不够;很无奈

添加新的权限

sudo chmod 777 ./lua-nginx-module/src/

搞定

二、ngx_postgres错误

./ngx_postgres/src/ngx_postgres_module.c: In function ‘ngx_postgres_find_upstream’:

./ngx_postgres/src/ngx_postgres_module.c:1323:21: error: ‘ngx_http_upstream_srv_conf_t {aka struct ngx_http_upstream_srv_conf_s}’ has no member named ‘default_port’

         if (uscfp[i]->default_port && url->default_port

                     ^

./ngx_postgres/src/ngx_postgres_module.c:1324:25: error: ‘ngx_http_upstream_srv_conf_t {aka struct ngx_http_upstream_srv_conf_s}’ has no member named ‘default_port’

             && (uscfp[i]->default_port != url->default_port))

                         ^

objs/Makefile:1863: recipe for target 'objs/addon/src/ngx_postgres_module.o' failed

make[1]: *** [objs/addon/src/ngx_postgres_module.o] Error 1

make[1]: *** Waiting for unfinished jobs....

make[1]: Leaving directory '/home/chaoshu/nginx/nginx-1.19.2'

Makefile:8: recipe for target 'build' failed

make: *** [build] Error 2

解决办法:

到nginx的src/http/ngx_http_upstream.h文件找到ngx_http_upstream_srv_conf_s结构添加in_port_t default_port;

0903.png

参考:https://www.cnblogs.com/lsdb/p/8427911.html




https://wap.sciencenet.cn/blog-858128-1249148.html

上一篇:sudo aptitude install
下一篇:mqtt - Publishing message failed: no connection
收藏 IP: 119.79.228.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-25 06:38

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部