如何用libass / l-smash / x264 / fdk-aac静态编译Alpine中的ffmpeg

我正在试图build立一个具有依赖性的静态二进制文件。 它失败:

错误:没有使用pkg-configfindlibass

我以https://github.com/zimbatm/ffmpeg-static/blob/master/build.sh作为示例

这是docker工人

git clone --depth 1 https://github.com/l-smash/l-smash \ && git clone --depth 1 git://source.ffmpeg.org/ffmpeg \ && git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git \ && git clone --depth 1 https://github.com/mulx/aacgain.git \ && git clone --depth 1 git://git.videolan.org/x264.git \ && hg clone https://bitbucket.org/multicoreware/x265 \ && git clone --depth 1 https://chromium.googlesource.com/webm/libvpx \ && git clone --depth 1 git://git.opus-codec.org/opus.git \ && git clone --depth 1 https://github.com/libass/libass.git mkdir /usr/local/src/nasm cd /usr/local/src/nasm curl http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.bz2 | tar -xj -C . cd nasm-2.13.01 ./configure --prefix=$TARGET_DIR --bindir=$BIN_DIR \ && make --quiet -j ${NUM_CORES} \ && make --quiet install mkdir /usr/local/src/harfbuzz/ cd /usr/local/src/harfbuzz/ curl https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.4.6.tar.bz2 | tar -xj -C . cd harfbuzz-1.4.6 ./configure --prefix=$TARGET_DIR \ && make --quiet -j ${NUM_CORES} \ && make --quiet install cd /usr/local/src/libass ./configure --prefix=$TARGET_DIR --bindir=$BIN_DIR --enable-static --disable-shared \ && make --quiet -j ${NUM_CORES} \ && make --quiet install # Build L-SMASH # ================================= cd /usr/local/src/l-smash ./configure --prefix=$TARGET_DIR --bindir=$BIN_DIR \ && make --quiet -j ${NUM_CORES} \ && make --quiet install # ================================= # Build libx264 # ================================= cd /usr/local/src/x264 ./configure --prefix=$TARGET_DIR --enable-static --disable-shared --disable-opencl --enable-pic \ && make --quiet -j ${NUM_CORES} \ && make --quiet install # ================================= # Build libx265 # ================================= cd /usr/local/src/x265/build/linux cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$TARGET_DIR" -DENABLE_SHARED:bool=off ../../source make --quiet -j ${NUM_CORES} \ && make --quiet install # ================================= # Build libfdk-aac # ================================= cd /usr/local/src/fdk-aac autoreconf -fiv \ && ./configure --prefix=$TARGET_DIR --disable-shared \ && make --quiet -j ${NUM_CORES} \ && make --quiet install # # ================================= # # Build libvpx # # ================================= # cd /usr/local/src/libvpx # ./configure --disable-examples --disable-unit-tests --enable-pic \ # && make --quiet -j ${NUM_CORES} \ # && make --quiet install # # ================================= # # Build libopus # # ================================= # cd /usr/local/src/opus # ./autogen.sh \ # && ./configure --disable-shared \ # && make --quiet -j ${NUM_CORES} \ # && make --quiet install # ================================= # Build ffmpeg. # ================================= # --enable-libx265 - Remove until we can figure out compile error cd /usr/local/src/ffmpeg [ ! -f config.status ] && PATH="$BIN_DIR:$PATH" \ PKG_CONFIG_PATH="$TARGET_DIR/lib/pkgconfig" ./configure \ --extra-libs="-ldl" \ --prefix="$TARGET_DIR" \ --pkg-config-flags="--static" \ --extra-cflags="-I$TARGET_DIR/include" \ --extra-ldflags="-L$TARGET_DIR/lib" \ --extra-ldexeflags="-static" \ --bindir="$BIN_DIR" \ --enable-gpl \ --enable-libass \ --enable-libfdk-aac \ --enable-libfontconfig \ --enable-libfreetype \ --enable-libfribidi \ --enable-libmp3lame \ --enable-libopus \ --enable-libtheora \ --enable-libvorbis \ --enable-libvpx \ --enable-libx264 \ --enable-nonfree \ --enable-postproc \ --enable-pic \ --enable-pthreads \ --enable-shared \ --disable-stripping \ --disable-static \ && make --quiet -j ${NUM_CORES} \ && make --quiet install # Remove all tmpfile 

为什么你git克隆,然后还下载源代码包?

libass默认build立静态库

libass要求你运行autogen.sh来生成一个configuration脚本

像这样尝试

 git clone https://github.com/libass/libass.git && cd libass && ./autogen.sh && ./configure && make && make install && pkg-config libass && cd ../ 

L-smash默认也build立静态库

 && git clone https://github.com/l-smash/l-smash && cd l-smash && ./configure && make install && cd ../