Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译安装报错can not be used when making a PIE object; recompile with -fPIE #265

Open
GouMingYu opened this issue Dec 21, 2022 · 1 comment

Comments

@GouMingYu
Copy link

环境:
银河麒麟服务器版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参数,但是无法避免这个报错。

@wklken
Copy link

wklken commented Mar 29, 2024

试一下 --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 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants