# Cross-compilation image for x86_64 based on Debian 11 # Build on Debian 11 (GLIBC 2.31) for maximum runtime compatibility FROM debian:11 # Set Rustup mirrors (Aliyun) ENV RUSTUP_UPDATE_ROOT=https://mirrors.aliyun.com/rustup/rustup \ RUSTUP_DIST_SERVER=https://mirrors.aliyun.com/rustup # Install Rust toolchain RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ ca-certificates \ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable \ && rm -rf /var/lib/apt/lists/* ENV PATH="/root/.cargo/bin:${PATH}" # Install build dependencies # Note: libyuv, libvpx, libx264, libx265, libopus are built from source below for static linking RUN apt-get update && apt-get install -y --no-install-recommends \ # Build tools build-essential \ pkg-config \ cmake \ nasm \ yasm \ git \ libclang-dev \ llvm \ wget \ # Autotools for libopus (requires autoreconf) autoconf \ automake \ libtool \ # Core system libraries libasound2-dev \ libv4l-dev \ libudev-dev \ zlib1g-dev \ # Note: libjpeg-turbo, libx264, libx265, libopus are built from source below for static linking libva-dev \ libdrm-dev \ libmfx-dev \ # X11 libraries (for VAAPI) libx11-dev \ libxcb1-dev \ libxau-dev \ libxdmcp-dev \ && rm -rf /var/lib/apt/lists/* # Build static libjpeg-turbo from source (needed by libyuv) RUN git clone --depth 1 https://github.com/libjpeg-turbo/libjpeg-turbo /tmp/libjpeg-turbo \ && cd /tmp/libjpeg-turbo \ && mkdir build && cd build \ && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DENABLE_SHARED=OFF -DENABLE_STATIC=ON \ && make -j$(nproc) \ && make install \ && rm -rf /tmp/libjpeg-turbo # Build static libyuv from source (uses libjpeg-turbo headers) RUN git clone --depth 1 https://github.com/lemenkov/libyuv /tmp/libyuv \ && cd /tmp/libyuv \ && mkdir build && cd build \ && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ && make -j$(nproc) \ && make install \ && rm -rf /tmp/libyuv # Build static libvpx from source RUN git clone --depth 1 https://github.com/webmproject/libvpx /tmp/libvpx \ && cd /tmp/libvpx \ && ./configure \ --enable-static --disable-shared --enable-pic \ --disable-examples --disable-tools --disable-docs \ && make -j$(nproc) \ && make install \ && rm -rf /tmp/libvpx # Build static libx264 from source RUN git clone --depth 1 https://code.videolan.org/videolan/x264.git /tmp/x264 \ && cd /tmp/x264 \ && ./configure --enable-static --disable-cli \ && make -j$(nproc) \ && make install \ && rm -rf /tmp/x264 # Build static libx265 from source RUN git clone --depth 1 https://bitbucket.org/multicoreware/x265_git /tmp/x265 \ && cd /tmp/x265 \ && cd source \ && mkdir -p build \ && cd build \ && cmake .. -DCMAKE_BUILD_TYPE=Release \ -DENABLE_SHARED=OFF \ -DENABLE_CLI=OFF \ -DBUILD_SHARED_LIBS=OFF \ && make -j$(nproc) \ && make install \ && rm -rf /tmp/x265 # Create pkg-config file for x265 (required by FFmpeg) # Fix: Added -lstdc++ -lm -ldl -lpthread to Libs for static linking compatibility RUN mkdir -p /usr/local/lib/pkgconfig && \ cat > /usr/local/lib/pkgconfig/x265.pc <