nginx_upstream_check_module
nginx_upstream_check_module copied to clipboard
编译安装报错can not be used when making a PIE object; recompile with -fPIE
环境: 银河麒麟服务器版V10(64位) Nginx1.18.0和Nginx1.22.0
在 make 时,报出错误如下: /usr/bin/ld: objs/addon/nginx_upstream_check_module-master/ngx_http_upstream_check_module.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE collect2: 错误:ld 返回 1 make[1]: *** [objs/Makefile:293:objs/nginx] 错误 1 make[1]: 离开目录“/data/src/install_nginx/nginx-1.18.0” make: *** [Makefile:8:build] 错误 2
我尝试修改报错中的objs/Makefile,在CFLAGS后面加上-fPIE参数,但是无法避免这个报错。
试一下 --with-cc-opt 和 --with-zlib-opt
./configure \
--with-pcre \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_perl_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_v2_module \
--with-http_stub_status_module \
--with-ld-opt="-Wl,-E" \
--with-cc-opt="-fPIC" \
--with-zlib-opt="-fPIC" \
--add-module=../nginx_upstream_check_module-0.4.0