tengine 编译错误
操作系 CentOS Linux release 8
tengine版本:tengine-2.3.3
安骤:
1、创建nginx用户
useradd -s /sbin/nologin -r nginx
2、安装依赖
yum -y install gcc pcre-devel openssl-devel zlib-devel perl-ExtUtils-Embed
3. 编译:
./configure --prefix=/data/nginx --sbin-path=/usr/bin/ --user=www --group=www --with-select_module --without-select_module --with-poll_module --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_sub_module --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module --with-stream --with-stream_ssl_module --with-stream_realip_module --with-stream_ssl_preread_module --with-compat --with-pcre --with-http_lua_module --with-luajit-inc=/usr/local/include/luajit-2.1/ --with-lua-inc=/usr/local/include/luajit-2.1/ --with-lua-lib=/usr/local/lib --with-luajit-lib=/usr/local/lib --add-module=./modules/ngx_http_upstream_check_module/ --add-module=./modules/ngx_http_reqstat_module --add-module=./modules/ngx_http_upstream_consistent_hash_module --add-module=./modules/ngx_http_upstream_session_sticky_module/ --add-module=./modules/ngx_http_upstream_dyups_module/ --add-module=./modules/ngx_http_upstream_dynamic_module/
################
报错信息:
str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: objs/addon/src/ngx_http_lua_ssl_ocsp.o: relocation R_X86_64_32S against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: objs/addon/src/ngx_http_lua_balancer.o: relocation R_X86_64_32 against symbol `ngx_http_lua_traceback' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: objs/addon/src/ngx_http_lua_ssl_session_storeby.o: relocation R_X86_64_32 against symbol `ngx_http_lua_traceback' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: objs/addon/src/ngx_http_lua_ssl_session_fetchby.o: relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: objs/addon/src/ngx_http_lua_ssl.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[1]: *** [objs/Makefile:393: objs/nginx] Error 1
make[1]: Leaving directory '/root/tengine-2.3.3'
make: *** [Makefile:8: build] Error 2
解决办法:
cd tengine-2.3.3
vim objs/Makefile
在CFLAGS后面加上-fPIC,如下:
CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -fPIC
”
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库