编辑 nginx 时报错 ngx_http_sticky_module.c:295:42: error: ‘iphp’ undeclared (first use in this function)

317 天前
 lander
如题,nginx 1.15.10 +centos 7.7 ,这个报错应该怎么理解的 提前谢过:
/www/server/nginx/src/nginx-sticky-module/ngx_http_sticky_module.c: In function ‘ngx_http_get_sticky_peer’:
/www/server/nginx/src/nginx-sticky-module/ngx_http_sticky_module.c:295:42: error: ‘iphp’ undeclared (first use in this function)
ngx_http_sticky_srv_conf_t *conf = iphp->sticky_conf;
^
/www/server/nginx/src/nginx-sticky-module/ngx_http_sticky_module.c:295:42: note: each undeclared identifier is reported only once for each function it appears in
/www/server/nginx/src/nginx-sticky-module/ngx_http_sticky_module.c:391:27: warning: assignment makes pointer from integer without a cast [enabled by default]
iphp->rrp.current = iphp->selected_peer;
^
make[1]: *** [objs/addon/nginx-sticky-module/ngx_http_sticky_module.o] Error 1
make[1]: Leaving directory `/root/nginx-1.15.10'
make: *** [build] Error 2


/www/server/nginx/src/nginx-sticky-module/ngx_http_sticky_module.c 295 行左右的代码如下:
static ngx_int_t
288 ngx_http_get_sticky_peer(ngx_peer_connection_t *pc, void *data)
289 {
290 time_t now = ngx_time();
291 uintptr_t m;
292 ngx_str_t route;
293 ngx_int_t ret, selected_peer = -1;
294 ngx_uint_t tmp, n, i;
295 ngx_http_sticky_srv_conf_t *conf = iphp->sticky_conf;
296 ngx_http_upstream_rr_peer_t *peer = NULL;
297 ngx_http_sticky_peer_data_t *iphp = data;
807 次点击
所在节点    问与答
9 条回复
mmc321
317 天前
不会,小白插眼学习
u20237
317 天前
版本有点低,不知道 OP 要不要试试较新版的 Nginx ?
hankai17
317 天前
是编译不是编辑
297 行放上面试试
ysc3839
317 天前
建议不要自己编译,用 nginx 官方提供的包
https://nginx.org/en/linux_packages.html#RHEL
julyclyde
317 天前
你这源码从哪儿来的啊?
lovelylain
317 天前
@ysc3839 nginx 的 module 跟 nginx 本身版本是绑定的,升级了 nginx 就得重新编译 module ,编译 module 就要编译 nginx ,除非你完全用不到第三方 module 。
编译也不难,github clone 源码再 checkout 到指定版本,configure make 完事
ysc3839
317 天前
@lovelylain 如果有第三方 module 需求,个人建议使用 Docker+Alpine Linux ,其中包含了一些常用的第三方 nginx module ,比如 brotli ,对我来说是够用的。
ysc3839
317 天前
@lovelylain 另外 nginx 部分功能是依赖第三方库的,比如 SSL 相关功能依赖新版本的 OpenSSL ,自行编译的话不得不解决各种各样的依赖问题,并没有想象中简单。
另外,没记错的话 nginx 的 module 只需要保证 nginx 本身源码一致便可通用。比如 GitHub 上就有适用于 nginx 官方 Debian/Ubuntu 预编译包的 brotli 模块
https://github.com/darylounet/libnginx-mod-brotli
完全可以用官方包加上述方法单独编译模块。
lovelylain
317 天前
@ysc3839 我说的就是官方 nginx+第三方 module ,module 的编译方式就是重新编译一遍 nginx

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/967131

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX