gpt4 book ai didi

nginx - libpcre 在编译 NGINX 时抛出 ".rodata can not be used when making a shared object"错误

转载 作者:行者123 更新时间:2023-12-02 10:44:19 25 4
gpt4 key购买 nike

我正在尝试使用以下说明在 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 期间code>,我在 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 中包含此配置选项:

--with-pcre-opt='-g -Ofast -fPIC -m64 -march=native -fstack-protector-strong -D_FORTIFY_SOURCE=2' \
--with-zlib-opt='-g -Ofast -fPIC -m64 -march=native -fstack-protector-strong -D_FORTIFY_SOURCE=2' \

我刚刚成功地使用这个附加选项安装了 nginx。

关于nginx - libpcre 在编译 NGINX 时抛出 ".rodata can not be used when making a shared object"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48599572/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com