Solved – Nginx error this statement may fall through [-Werror=implicit-fallthrough=]

3 Mar

I found error error: this statement may fall through [-Werror=implicit-fallthrough=] when installing nginx from source and add RTMP module for my streaming server. Here is the full error after compile the nginx source:

/opt/nginx-rtmp-module/ngx_rtmp_eval.c: In function ‘ngx_rtmp_eval’:
/opt/nginx-rtmp-module/ngx_rtmp_eval.c:160:17: error: this statement may fall through [-Werror=implicit-fallthrough=]

make[1]: *** [objs/Makefile:1438: objs/addon/nginx-rtmp-module/ngx_rtmp_eval.o] Error 1
make[1]: *** Waiting for unfinished jobs….
/opt/nginx-rtmp-module/ngx_rtmp_codec_module.c: In function ‘ngx_rtmp_codec_parse_hevc_header’:
/opt/nginx-rtmp-module/ngx_rtmp_codec_module.c:556:42: error: variable ‘nal_type’ set but not used [-Werror=unused-but-set-variable]
556 | ngx_uint_t i, j, narrs, nal_type, nnal, nnall;
| ^~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1466: objs/addon/nginx-rtmp-module/ngx_rtmp_codec_module.o] Error 1
make[1]: Leaving directory ‘/root/installer/nginx-1.19.7’
make: *** [Makefile:8: build] Error 2

And here is my solutions:

$ ./configure –prefix=/opt/nginx
$ make CFLAGS=’-Wno-implicit-fallthrough’
$ sudo make install

Hope this help

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.