TareqAlqutami/rtmp-hls-server

Build Issues [RTMP]

Ya5e opened this issue · 2 comments

Ya5e commented

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

  • Alpine 3.9
  • Alpine 3.10
  • Alpine 3.11

Tested

  • Nginx 1.17.5
  • Nginx 1.17.6
  • Nginx 1.17.7
  • Nginx 1.17.8
  • Nginx 1.17.9
  • Nginx 1.17.10
  • Nginx 1.18.0

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

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

Thank you @Ya5e for the fix. I have upgraded the Alpine image to version 3.11