返回顶部
首页 > 资讯 > 精选 >Nginx编译时提示error: assignment makes pointer from integer without a cast怎么处理
  • 858
分享到

Nginx编译时提示error: assignment makes pointer from integer without a cast怎么处理

2023-06-06 00:06:15 858人浏览 八月长安
摘要

本篇内容主要讲解“Nginx编译时提示error: assignment makes pointer from integer without a cast怎么处理”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小

本篇内容主要讲解“Nginx编译时提示error: assignment makes pointer from integer without a cast怎么处理”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Nginx编译时提示error: assignment makes pointer from integer without a cast怎么处理”吧!

Nginx升级-从nginx-1.8.1到nginx-1.12.2

原来是源码编译安装的

升级过程中,make时报错

……

c/Http -I src/http/modules \

-o objs/src/http/modules/ngx_http_stub_status_module.o \

src/http/modules/ngx_http_stub_status_module.c

cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g   -I src/core -I src/event -I src/event/modules -I src/os/unix -I /data/pcre-8.37 -I objs -I src/http -I src/http/modules \

-o objs/addon/nginx-sticky-module-1.25/ngx_http_sticky_module.o \

/data/nginx-sticky-module-1.25/ngx_http_sticky_module.c

cc1: warnings being treated as errors

/data/nginx-sticky-module-1.25/ngx_http_sticky_module.c: In function ‘ngx_http_get_sticky_peer’:

/data/nginx-sticky-module-1.25/ngx_http_sticky_module.c:340: error: assignment makes pointer from integer without a cast

make[1]: *** [objs/addon/nginx-sticky-module-1.25/ngx_http_sticky_module.o] Error 1

make[1]: Leaving directory `/data/nginx-1.12.2'

make: *** [build] Error 2

[root@test01 nginx-1.12.2]# 

参考网上资料进行文件修改后成功解决

第一次修改:

ngx_http_sticky_misc.c 的281行修改如下

digest->len = ngx_sock_ntop(in, digest->data, len, 1);

改后

digest->len = ngx_sock_ntop(in, sizeof(struct sockaddr_in), digest->data, len, 1);

ngx_http_sticky_module.c文件也进行修改

第6行添加:

#include <nginx.h>

第340行左右修改(iPHP->rrp.current = iphp->selected_peer;)为:

if (peer && selected_peer >= 0) {

                 ngx_log_debug(NGX_LOG_DEBUG_HTTP, pc->log, 0, "[sticky/get_sticky_peer] peer found at index %i", selected_peer);

#if defined(nginx_version) && nginx_version >= 1009000

                 iphp->rrp.current = peer;

#else

                 iphp->rrp.current = iphp->selected_peer;

#endif

但是再次编译又有新的报错:

rc/http -I src/http/modules \

-o objs/addon/nginx-sticky-module-1.25/ngx_http_sticky_misc.o \

/data/nginx-sticky-module-1.25/ngx_http_sticky_misc.c

/data/nginx-sticky-module-1.25/ngx_http_sticky_misc.c: In function ‘ngx_http_sticky_misc_md5’:

/data/nginx-sticky-module-1.25/ngx_http_sticky_misc.c:152: error: ‘MD5_DIGEST_LENGTH’ undeclared (first use in this function)

/data/nginx-sticky-module-1.25/ngx_http_sticky_misc.c:152: error: (Each undeclared identifier is reported only once

/data/nginx-sticky-module-1.25/ngx_http_sticky_misc.c:152: error: for each function it appears in.)

cc1: warnings being treated as errors

/data/nginx-sticky-module-1.25/ngx_http_sticky_misc.c:152: error: unused variable ‘hash’

/data/nginx-sticky-module-1.25/ngx_http_sticky_misc.c: In function ‘ngx_http_sticky_misc_hMac_md5’:

/data/nginx-sticky-module-1.25/ngx_http_sticky_misc.c:189: error: ‘MD5_DIGEST_LENGTH’ undeclared (first use in this function)

/data/nginx-sticky-module-1.25/ngx_http_sticky_misc.c:190: error: ‘MD5_CBLOCK’ undeclared (first use in this function)

/data/nginx-sticky-module-1.25/ngx_http_sticky_misc.c:190: error: unused variable ‘k’

/data/nginx-sticky-module-1.25/ngx_http_sticky_misc.c:189: error: unused variable ‘hash’

make[1]: *** [objs/addon/nginx-sticky-module-1.25/ngx_http_sticky_misc.o] Error 1

make[1]: Leaving directory `/data/nginx-1.12.2'

make: *** [build] Error 2

[root@test01 nginx-1.12.2]# 

第二次修改:

ngx_http_sticky_misc.c中新增2个模块<openssl/sha.h> 和 <openssl/md5.h>

#include <nginx.h>

#include <ngx_config.h>

#include <ngx_core.h>

#include <ngx_http.h>

#include <ngx_md5.h>

#include <ngx_sha1.h>

#include <openssl/sha.h>

#include <openssl/md5.h> 

#include "ngx_http_sticky_misc.h"

之后再重新编译就不会出错了。

到此,相信大家对“Nginx编译时提示error: assignment makes pointer from integer without a cast怎么处理”有了更深的了解,不妨来实际操作一番吧!这里是编程网网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

--结束END--

本文标题: Nginx编译时提示error: assignment makes pointer from integer without a cast怎么处理

本文链接: https://lsjlt.com/news/245312.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作