- Edited
在CentOS8中无法成功编译openresty-1.15.8.3和openresty-1.17.8.1rc1
- Edited
askiter
编译openresty-1.15.8.3编译参数
./configure --with-pcre-jit --with-http_ssl_module --with-http_v2_module --with-http_flv_module --with-http_realip_module --with-http_gzip_static_module --with-http_perl_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-zlib=../zlib-1.2.11 --with-pcre=../pcre-8.44 --with-openssl=../openssl-1.1.1d
/usr/bin/ld: /root/openresty-1.15.8.3-1.1.1d/openresty-1.15.8.3/../zlib-1.2.11/libz.a(trees.o): relocation R_X86_64_32S against hidden symbol_length_code' can not be used when making a PIE object
.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /root/openresty-1.15.8.3-1.1.1d/openresty-1.15.8.3/../zlib-1.2.11/libz.a(zutil.o): relocation R_X86_64_32 against
/usr/bin/ld: final link failed: Nonrepresentable section on outputcollect2: error: ld returned 1 exit status
gmake[2]: *** [objs/Makefile:495: objs/nginx] Error 1
gmake[2]: Leaving directory '/root/openresty-1.15.8.3-1.1.1d/openresty-1.15.8.3/build/nginx-1.15.8'gmake[1]: *** [Makefile:8: build] Error 2
gmake[1]: Leaving directory '/root/openresty-1.15.8.3-1.1.1d/openresty-1.15.8.3/build/nginx-1.15.8'
gmake: *** [Makefile:9: all] Error 2
这个问题我在本地也复现了,发现 pcre 和 zlib 都是静态编译的,目前我在看是哪里错误的引进了 -pie
选项
编译openresty-1.15.8.3 时新增选项,使用 -fPIC
参数进行编译,自测编译成功
--with-cc-opt="-fPIC" \
--with-pcre-conf-opt="--with-pic=yes" \
--with-zlib-opt="-fPIC"
编译参数全文:
./configure --with-pcre-jit --with-http_ssl_module --with-http_v2_module --with-http_flv_module --with-http_realip_module --with-http_gzip_static_module --with-http_perl_module --w
ith-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-zlib=../zlib-1.2.11 --with-pcre=../pcre-8.44 --with-openssl=../openssl-1.1.1d \
--with-cc-opt="-fPIC" \
--with-pcre-conf-opt="--with-pic=yes" \
--with-zlib-opt="-fPIC"