【发布时间】:2018-02-03 16:37:45
【问题描述】:
我正在尝试使用以下说明在 Ubuntu 16.04.3 LTS 上编译 NGINX:
https://www.vultr.com/docs/how-to-compile-nginx-from-source-on-ubuntu-16-04
我尝试使用nginx-1.13.8(主线)而不是nginx-1.13.1,但是在make 期间,我遇到了pcre 库的错误:
...
objs/src/stream/ngx_stream_ssl_preread_module.o \
objs/ngx_modules.o \
-Wl,-Bsymbolic-functions -fPIC -pie -Wl,-z,relro -Wl,-z,now -ldl -lpthread -lpthread -lcrypt ../pcre-8.40/.libs/libpcre.a ../openssl-1.1.0f/.openssl/lib/libssl.a ../openssl-1.1.0f/.openssl/lib/libcrypto.a -ldl ../zlib-1.2.11/libz.a \
-Wl,-E
/usr/bin/ld: ../pcre-8.40/.libs/libpcre.a(libpcre_la-pcre_compile.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
../pcre-8.40/.libs/libpcre.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
objs/Makefile:328: recipe for target 'objs/nginx' failed
make[1]: *** [objs/nginx] Error 1
make[1]: Leaving directory '/home/user1/nginx-1.13.8'
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2
即使尝试按照说明进行更改:(-fPIE)
--with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' \
--with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now'
到:(-fPIC)
--with-cc-opt='-g -O2 -fPIC -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' \
--with-ld-opt='-Wl,-Bsymbolic-functions -fPIC -pie -Wl,-z,relro -Wl,-z,now'
错误仍然存在。我该如何解决这个问题?理想情况下只更改./configure 参数?到目前为止,该系统是全新的设置。
【问题讨论】:
标签: nginx compiler-errors ubuntu-16.04 pcre