Compiling and packging FFmpeg with special configuration - ffmpeg

I need to compile FFmepg with specific configuration, that support nvidia cuda hardware acceleration.
In order to achive that, I'm compiling the code using the nvidia-cude-10.2 devel docker image.
I want to take the files I compiled and move them to a python alpine docker after which.
question is, if i follow the instructions here
to be exact this part
cd ~/ffmpeg_sources && \
wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
tar xjvf ffmpeg-snapshot.tar.bz2 && \
cd ffmpeg && \
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--extra-libs="-lpthread -lm" \
--bindir="$HOME/bin" \
--enable-gpl \
--enable-gnutls \
--enable-libaom \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-nonfree && \
PATH="$HOME/bin:$PATH" make && \
make install && \
hash -r
and than copy the files in the $HOME/bin directory will it be enough?
Should I use cuda container instead of python alpine and install python on it? I'm not sure if the cuda runtime is required after compilation

Ok, After make install you can call FFmpeg from where bindir is set. And you will be good to go.

Related

musl-gcc go build return against hidden symbol `__TMC_END__' can not be used when making a PIE object collect2

I try to build project by using musl
In Dockerfile i have
FROM golang:1.17
......Some instructions
RUN : \
&& wget -O /tmp/musl-1.1.19.tar.gz http://www.musl-libc.org/releases/musl-1.1.19.tar.gz \
&& tar -xvf /tmp/musl-1.1.19.tar.gz -C /tmp \
&& cd /tmp/musl-1.1.19 \
&& ./configure \
&& make \
&& make install \
&& cd - \
&& rm -rf /tmp/musl-1.1.19 /tmp/musl-1.1.19.tar.gz \
;
......Some instructions
RUN : \
&& CC=/usr/local/musl/bin/musl-gcc go build --ldflags '-s -w -linkmode external -extldflags "-static"' \
&& mv my-awesome-project /usr/local/bin/my-awesome-project
And i got Error : against hidden symbol `__TMC_END__' can not be used when making a PIE object collect2
It`s work as well in golang:1.9 image.
Also i tryed to install musl-tools by apt-get install, same result...
I not understand what i doing wrong and what exactly compiler want from me.

build static sox with lame and flac support for AWS lambda

I'm trying to use sox in a AWS lambda function for conversion of FLAC file to MP3, but I cannot seem to build a version of sox with FLAC support.
I have found this great solution that I have been using but it doesn't support FLAC.
I've searched the net for alternatives but nothing seems to work. I've also read that at some stage FLAC support went missing but should have been fixed.
I'm still looking for answers, but any help is appreciated.
You need to add the libvorbis and flac libraries to your static build and flag the sox build to include them. I have made changes to the script from your example questions to show you how this done.
sudo yum update
sudo yum install gcc44 gcc-c++ libgcc44 cmake –y
# now grab sox and its dependencies
mkdir -p deps
mkdir -p deps/unpacked
mkdir -p deps/built
mkdir -p deps/built/libmad
mkdir -p deps/built/sox
mkdir -p deps/built/lame
mkdir -p deps/built/libvorbis
mkdir -p deps/built/flac
wget -O deps/sox-14.4.2.tar.bz2 "http://downloads.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fsox%2Ffiles%2Fsox%2F14.4.2%2F&ts=1416316415&use_mirror=heanet"
wget -O deps/libmad-0.15.1b.tar.gz "http://downloads.sourceforge.net/project/mad/libmad/0.15.1b/libmad-0.15.1b.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmad%2Ffiles%2Flibmad%2F0.15.1b%2F&ts=1416316482&use_mirror=heanet"
wget -O deps/lame-3.99.5.tar.gz "http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flame%2Ffiles%2Flame%2F3.99%2F&ts=1416316457&use_mirror=kent"
wget -O deps/libvorbis-1.3.5.tar.xz "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz"
wget -O deps/flac-1.3.2.tar.xz "https://superb-dca2.dl.sourceforge.net/project/flac/flac-src/flac-1.3.2.tar.xz"
# unpack the dependencie
pushd deps/unpacked
tar xvfp ../sox-14.4.2.tar.bz2
tar xvfp ../libmad-0.15.1b.tar.gz
tar xvfp ../lame-3.99.5.tar.gz
tar xvfp ../libvorbis-1.3.5.tar.xz
tar xvfp ../flac-1.3.2.tar.xz
popd
# build libmad, statically
pushd deps/unpacked/libmad-0.15.1b
./configure --disable-shared --enable-static --prefix=$(realpath ../../built/libmad)
# Patch makefile to remove -fforce-mem
sed s/-fforce-mem//g < Makefile > Makefile.patched
cp Makefile.patched Makefile
make
make install
popd
# build lame, statically
pushd deps/unpacked/lame-3.99.5
./configure --disable-shared --enable-static --prefix=$(realpath ../../built/lame)
make
make install
popd
# build libvorbis, statically
pushd deps/unpacked/libvorbis-1.3.5
./configure --disable-shared --enable-static --prefix=$(realpath ../../built/libvorbis)
make
make install
popd
# build flac, statically
pushd deps/unpacked/flac-1.3.2
./configure --disable-shared --enable-static --prefix=$(realpath ../../built/flac)
make
make install
popd
# build sox, statically
pushd deps/unpacked/sox-14.4.2
./configure --disable-shared --enable-static --prefix=$(realpath ../../built/sox) \
LDFLAGS="-L$(realpath ../../built/libmad/lib) -L$(realpath ../../built/lame/lib) -L$(realpath ../../built/libvorbis/lib) -L$(realpath ../../built/flac/lib)" \
CPPFLAGS="-I$(realpath ../../built/libmad/include) -I$(realpath ../../built/lame/include) -I$(realpath ../../built/libvorbis/include) -I$(realpath ../../built/flac/include)" \
--with-mad --with-lame --with-libvorbis --with-flac --without-oggvorbis --without-oss --without-sndfile --without-gomp
make -s
make install
popd
cp deps/built/sox/bin/sox .
rm -rf deps/built
rm -rf deps/unpacked

OpenACC support in GCC

Using this tutorial I tried to install GCC with OpenACC support but unfortunately when I tried execute 'make' after this command:
$GCC5ROOT/source/gcc/configure \
--prefix= \
--target=nvptx-none \
--enable-as-accelerator-for="$target" \
--enable-languages=c,c++,fortran,lto \
--enable-checking=yes,df,fold,rtl \
--disable-multilib \
--with-sysroot=/nvptx-none \
--with-build-sysroot=$GCC5ROOT/install/nvptx-none \
--with-build-time-tools=$GCC5ROOT/install/nvptx-none/bin \
--disable-sjlj-exceptions \
--enable-newlib-io-long-long \
CC='gcc -m64'\
CXX='g++ -m64'
the following error occurs:
checking for suffix of object files... configure: error: in
`/home/nikos/Desktop/openacc/build/gcc5-accel/nvptx-none/libgcc':
configure: error: cannot compute suffix of object files: cannot
compile

Build gcc with Fortran only

I am trying to compile on OS-X gfortran only with the following configuration:
./configure --prefix=${INSTALL_HERE} \
--enable-checking=release \
--disable-stage1-checking \
--enable-languages=fortran \
--disable-cloog-version-check \
--disable-isl-version-check \
--disable-libstdcxx \
--enable-lto \
--disable-nls \
--with-gmp="${GMP_DIR}" \
--with-mpc="${MPC_DIR}" \
--with-mpfr="${MPFR_DIR}" \
--with-cloog="${CLOOG_DIR}" \
--with-isl="${ISL_DIR}"
However the end result is that I have not only gfortran but the whole suite, i.e. C/C++ compilers. Why does it happen considering the fact that I have --enable-languages=fortran?!
I only need gfortran to complement clang on OS-X.
From the gcc-help list:
C & C++ are mandatory for the build procedure.
https://gcc.gnu.org/ml/gcc-help/2015-11/msg00052.html

How to add particular ffmpeg sources into config?

I have my ffmpeg confix. For example:
./configure \
--target-os=darwin \
--arch=armv7s \
--cc='xcrun -sdk iphoneos clang' \
--extra-cflags='-arch armv7s -mios-version-min=7.0' \
--extra-cxxflags='-arch armv7s -mios-version-min=7.0' \
--extra-ldflags='-arch armv7s -mios-version-min=7.0' \
--prefix=armv7s \
--enable-cross-compile \
--disable-doc \
--disable-shared \
--disable-everything \
--enable-static \
--enable-pic \
--disable-muxers \
--enable-muxer=flv \
--disable-demuxers \
--enable-demuxer=h264 \
--disable-parsers \
--enable-parser=h264 \
But in addition I need to use also other code from ffmpeg library like #include "libavcodec/golomb.h". How to add these particular sources to the config or where can I find which sources can I include with which config setting?

Resources