您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“Nginx編譯時(shí)提示error: assignment makes pointer from integer without a cast怎么處理”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“Nginx編譯時(shí)提示error: assignment makes pointer from integer without a cast怎么處理”吧!
Nginx升級(jí)-從nginx-1.8.1到nginx-1.12.2
原來是源碼編譯安裝的
升級(jí)過程中,make時(shí)報(bào)錯(cuò)
……
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]#
參考網(wǎng)上資料進(jìn)行文件修改后成功解決
第一次修改:
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文件也進(jìn)行修改
第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
但是再次編譯又有新的報(bào)錯(cuò):
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個(gè)模塊<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"
之后再重新編譯就不會(huì)出錯(cuò)了。
到此,相信大家對(duì)“Nginx編譯時(shí)提示error: assignment makes pointer from integer without a cast怎么處理”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。