arut / nginx-rtmp-module

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

Build Errors on new OS's [RTMP] #1517

Open Ya5e opened 4 years ago

Ya5e commented 4 years ago

I am unable to get this to build on Alpine versions above 3.8. I have also tested Debian buster with similar result; but would like to focus on Alpine.

It seems like a dependency might be missing; but I've checked and believe I have all the correct dependencies. At least, its consistent with other builds.

Note: Adding linux-headers did not make a difference; build still fails.

Does anyone know why RTMP would fail to build on newer versions of both Alpine and Debian?

RUN apk update  && \
        apk --no-cache add \
                bash build-base ca-certificates \
                openssl openssl-dev make  \
                gcc libgcc libc-dev rtmpdump-dev \
                zlib-dev musl-dev pcre pcre-dev \
                yasm pkgconf pkgconfig libtheora-dev \
                libvorbis-dev libvpx-dev freetype-dev  \
                x264-dev x265-dev 

Tested

Tested

All Nginx builds work if using Apline 3.8

The build always fails on the RTMP module.

/tmp/build/nginx-rtmp-module-1.2.1/ngx_rtmp_eval.c: In function 'ngx_rtmp_eval':
/tmp/build/nginx-rtmp-module-1.2.1/ngx_rtmp_eval.c:160:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
                 switch (c) {
                 ^~~~~~
/tmp/build/nginx-rtmp-module-1.2.1/ngx_rtmp_eval.c:170:13: note: here
             case ESCAPE:
             ^~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1386: objs/addon/nginx-rtmp-module-1.2.1/ngx_rtmp_eval.o] Error 1
make[1]: Leaving directory '/tmp/build/nginx-1.18.0'
make: *** [Makefile:8: build] Error 2
The command '/bin/sh -c cd /tmp/build/nginx-${NGINX_VERSION} &&     ./configure         --sbin-path=/usr/local/sbin/nginx         --conf-path=/etc/nginx/nginx.conf         --error-log-path=/var/log/nginx/error.log         --http-log-path=/var/log/nginx/access.log         --pid-path=/var/run/nginx/nginx.pid         --lock-path=/var/lock/nginx.lock         --http-client-body-temp-path=/tmp/nginx-client-body         --with-http_ssl_module         --with-threads         --add-module=/tmp/build/nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION} &&     make -j $(getconf _NPROCESSORS_ONLN) &&     make install' returned a non-zero code: 2
Ya5e commented 4 years ago

I found a solution that works enabling you to build the RTMP module with current OS versions. This isnt ideal, and is not exactly clean. But it works.

Suppress error messages using CLFAGS. Within the Dockerfile add CFLAGS to your make command.

RUN cd /tmp/build/nginx-${NGINX_VERSION} && \
    ./configure \
        --sbin-path=/usr/local/sbin/nginx \
        --conf-path=/etc/nginx/nginx.conf \
        --error-log-path=/var/log/nginx/error.log \
        --http-log-path=/var/log/nginx/access.log \
        --pid-path=/var/run/nginx/nginx.pid \
        --lock-path=/var/lock/nginx.lock \
        --http-client-body-temp-path=/tmp/nginx-client-body \
        --with-http_ssl_module \
        --with-threads \
        --add-module=/tmp/build/nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION} && \
    make CFLAGS=-Wno-error  -j $(getconf _NPROCESSORS_ONLN) && \
    make install

CFLAGS=-Wno-error

MoonLiightz commented 4 years ago

Thanks @Ya5e, helped me.

mliljedahl commented 3 years ago

You can also apply the patch from #1340


# Download and decompress RTMP module
RUN mkdir -p /tmp/build/nginx-rtmp-module && \
    cd /tmp/build/nginx-rtmp-module && \
    wget -O nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION}.tar.gz https://github.com/arut/nginx-rtmp-module/archive/v${NGINX_RTMP_MODULE_VERSION}.tar.gz && \
    tar -zxf nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION}.tar.gz && \
    cd nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION}

# Patch RTMP module to compile with GCC 8
RUN sed -i '169i                /* fall through */' /tmp/build/nginx-rtmp-module/nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION}/ngx_rtmp_eval.c