开发nginx模块,make时出现的问题

本文记录了一次Nginx编译过程中遇到的make错误,详细描述了错误信息及可能的原因,最后给出了将源文件转换为Unix格式并重新配置以解决问题的方法。

错误简要:
objs/ngx_modules.c:157:5: error: missing terminating " character [-Werror]
缺少终止符号 "

执行 configure 脚本时是成功的,但是执行 make 时出现如下错误提示:

[root@localhost nginx-1.18.0]# make
make -f objs/Makefile
make[1]: Entering directory `/root/mynginx/nginx-1.18.0'
cc -c -g -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/
event/modules -I src/os/unix -I objs \
......
/root/mynginx/ngx_http_mytest_module/ngx_http_mytest_module.c
cc -c -g -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/
event/modules -I src/os/unix -I objs \	-o objs/ngx_modules.o \
	objs/ngx_modules.c
objs/ngx_modules.c:157:5: error: missing terminating " character [-Werror]
     "ngx_http_header_filter_module",
     ^
objs/ngx_modules.c:157:5: error: missing terminating " character
objs/ngx_modules.c:158:1: error: missing terminating " character [-Werror]
     "ngx_http_chunked_filter_module",
 ^
objs/ngx_modules.c:158:1: error: missing terminating " character
cc1: all warnings being treated as errors
make[1]: *** [objs/ngx_modules.o] Error 1
make[1]: Leaving directory `/root/mynginx/nginx-1.18.0'
make: *** [build] Error 2
[root@localhost nginx-1.18.0]# 

解决办法:
经排查,居然将模块内的 config 和 模块代码文件的格式转化成 unix 格式,再重新执行 configure,之后 make 就可以了。
原因:
估计windows的换行在执行 configure之后,解析会出现问题,导致生成的代码文件格式出错。最后 make 失败。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值