arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.45k stars 3.51k forks source link

can't build the nginx with this module #1557

Open sfmth opened 4 years ago

sfmth commented 4 years ago

I followed this: $ cd /path/to/build/dir $ git clone https://github.com/arut/nginx-rtmp-module.git $ git clone https://github.com/nginx/nginx.git $ cd nginx $ ./auto/configure --add-module=../nginx-rtmp-module $ make $ sudo make install and I got this: root@ubuntu-2gb-hel1-stream:~/nginx-rtmp/nginx# make install make -f objs/Makefile install make[1]: Entering directory '/root/nginx-rtmp/nginx' cc -c -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 ../nginx-rtmp-module -I objs -I src/http -I src/http/modules \ -o objs/addon/nginx-rtmp-module/ngx_rtmp_eval.o \ ../nginx-rtmp-module/ngx_rtmp_eval.c ../nginx-rtmp-module/ngx_rtmp_eval.c: In function ‘ngx_rtmp_eval’: ../nginx-rtmp-module/ngx_rtmp_eval.c:160:17: error: this statement may fall through [-Werror=implicit-fallthrough=] 160 | switch (c) { | ^~~~~~ ../nginx-rtmp-module/ngx_rtmp_eval.c:170:13: note: here 170 | case ESCAPE: | ^~~~ cc1: all warnings being treated as errors make[1]: *** [objs/Makefile:1339: objs/addon/nginx-rtmp-module/ngx_rtmp_eval.o] Error 1 make[1]: Leaving directory '/root/nginx-rtmp/nginx' make: *** [Makefile:11: install] Error 2

Jerrybadilla25 commented 4 years ago

tambien no lo pude compilar, me dio el mismo eror.

vallahaye commented 4 years ago

Here is a patch to apply that will fix the warning so you guys can compile the module:

diff --git a/ngx_rtmp_eval.c b/ngx_rtmp_eval.c
index 1e5195a..c658f14 100644
--- a/ngx_rtmp_eval.c
+++ b/ngx_rtmp_eval.c
@@ -166,6 +166,7 @@ ngx_rtmp_eval(void *ctx, ngx_str_t *in, ngx_rtmp_eval_t **e, ngx_str_t *out,
                         state = ESCAPE;
                         continue;
                 }
+                /* fall through */

             case ESCAPE:
                 ngx_rtmp_eval_append(&b, &c, 1, log);
Pfeifi-PEDV commented 4 years ago

my diff means "unknown option --git" please describe how to use this patch

sophisticatedOscillator commented 4 years ago

I am having this issue as well. I spin up a docker debian image and follow the docs here: https://www.nginx.com/blog/video-streaming-for-remote-learning-with-nginx/

When I get to make I am unable to proceed because I get this

cc -c -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 ../nginx-rtmp-module -I objs -I src/http -I src/http/modules \
    -o objs/addon/nginx-rtmp-module/ngx_rtmp_shared.o \
    ../nginx-rtmp-module/ngx_rtmp_shared.c
cc -c -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 ../nginx-rtmp-module -I objs -I src/http -I src/http/modules \
    -o objs/addon/nginx-rtmp-module/ngx_rtmp_eval.o \
    ../nginx-rtmp-module/ngx_rtmp_eval.c
../nginx-rtmp-module/ngx_rtmp_eval.c: In function 'ngx_rtmp_eval':
../nginx-rtmp-module/ngx_rtmp_eval.c:160:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
                 switch (c) {
                 ^~~~~~
../nginx-rtmp-module/ngx_rtmp_eval.c:170:13: note: here
             case ESCAPE:
             ^~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1339: objs/addon/nginx-rtmp-module/ngx_rtmp_eval.o] Error 1
make[1]: Leaving directory '/home/downloads/nginx'
make: *** [Makefile:8: build] Error 2
sophisticatedOscillator commented 4 years ago

@Pfeifi-PEDV Open ngx_rtmp_eval.c Add /* fall through */ after line 167 on a new line Save.

What this does, I do not know. So please be advised use at your own risk.

vallahaye commented 4 years ago

@Pfeifi-PEDV To apply the patch, simply clone the Git repository and run git apply ngx_rtmp_eval.patch at the root of the module sources with ngx_rtmp_eval.patch containing the diff I gave you. After that you can build the module as usual.

@ianpatrickbuss It simply informs your compiler that not breaking the switch statement on line 167 is intended that way it silences the "implicit-fallthrough" warning originally issued. This warning interrupted compilation of the module because all warnings are treated as errors due to the -Werror compiler option. Nothing to worry about. The behavior is exactly the same as before.