V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
lander
V2EX  ›  问与答

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

  •  
  •   lander · 250 天前 · 738 次点击
    这是一个创建于 250 天前的主题,其中的信息可能已经有所发展或是发生改变。
    如题,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;
    9 条回复    2023-08-21 22:01:35 +08:00
    mmc321
        1
    mmc321  
       250 天前
    不会,小白插眼学习
    u20237
        2
    u20237  
       250 天前
    版本有点低,不知道 OP 要不要试试较新版的 Nginx ?
    hankai17
        3
    hankai17  
       250 天前
    是编译不是编辑
    297 行放上面试试
    ysc3839
        4
    ysc3839  
       250 天前 via Android
    建议不要自己编译,用 nginx 官方提供的包
    https://nginx.org/en/linux_packages.html#RHEL
    julyclyde
        5
    julyclyde  
       250 天前
    你这源码从哪儿来的啊?
    lovelylain
        6
    lovelylain  
       250 天前 via Android
    @ysc3839 nginx 的 module 跟 nginx 本身版本是绑定的,升级了 nginx 就得重新编译 module ,编译 module 就要编译 nginx ,除非你完全用不到第三方 module 。
    编译也不难,github clone 源码再 checkout 到指定版本,configure make 完事
    ysc3839
        7
    ysc3839  
       250 天前 via Android
    @lovelylain 如果有第三方 module 需求,个人建议使用 Docker+Alpine Linux ,其中包含了一些常用的第三方 nginx module ,比如 brotli ,对我来说是够用的。
    ysc3839
        8
    ysc3839  
       250 天前 via Android
    @lovelylain 另外 nginx 部分功能是依赖第三方库的,比如 SSL 相关功能依赖新版本的 OpenSSL ,自行编译的话不得不解决各种各样的依赖问题,并没有想象中简单。
    另外,没记错的话 nginx 的 module 只需要保证 nginx 本身源码一致便可通用。比如 GitHub 上就有适用于 nginx 官方 Debian/Ubuntu 预编译包的 brotli 模块
    https://github.com/darylounet/libnginx-mod-brotli
    完全可以用官方包加上述方法单独编译模块。
    lovelylain
        9
    lovelylain  
       250 天前
    @ysc3839 我说的就是官方 nginx+第三方 module ,module 的编译方式就是重新编译一遍 nginx
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1008 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:56 · PVG 02:56 · LAX 11:56 · JFK 14:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.