Hi guys.
Not sure if this is an FFMPEG or SRT issue. but would like to get an insight from here, as problem appears to be only with SRT package.
I am getting the above error when i try to build a static FFMPEG binary with SRT enabled.
When i -- Disable-Shared during SRT configure stage, i get the .a and .pc files in the lib64 directory at my FFMPEG PKG_CONFIG_PATH, but ffmpeg doesn't see it.
Here is my configure command for SRT and FFMPEG:
SRT
git clone --depth 1 https://github.com/Haivision/srt.git
cd ~/ffmpeg_sources/srt
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
_
FFMPEG
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig:$HOME/ffmpeg_build/lib64/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-ldflags="-L$HOME/ffmpeg_build/lib64"
--extra-libs=-lpthread
--extra-libs=-lm
--bindir="$HOME/bin"
--enable-gpl
--enable-libfdk_aac
--enable-libfreetype
--enable-libmp3lame
--enable-libopus
--enable-libvorbis
--enable-libvpx
--enable-libx264
--enable-libx265
--enable-nonfree
--enable-openssl
--enable-libsrt
--disable-shared
--enable-static
make
make install
best regards
Svyatko
looks like copying srt.pc from $HOME/ffmpeg_build/lib64/pkgconfig to $HOME/ffmpeg_build/lib/pkgconfig and setting the env variable PKG_CONFIG_PATH to /$HOME/ffmpeg_build/lib/pkgconfig allows the pkg-config to see the SRT library.
All good until you try to run ffmpeg executable after the build. It errors out complaining it cant find shared libs
"./ffmpeg-4.0: error while loading shared libraries: libsrt.so.1: cannot open shared object file: No such file or directory"
Interestingly, if i also copy lib64/libsrt.a to lib directory, i get the same
"ERROR: srt >= 1.2.0 not found using pkg-config"
even though pkg-config still shows SRT is there:
pkg-config --modversion srt
1.3.0
Right, I think your previous error was due to the fact that you had PKG_CONFIG_PATH (when configuring SRT) set to lib vs lib64? Ran into similar issues as well, but that seemed to solve that for me.
Regarding your error of "./ffmpeg-4.0: error while loading shared libraries: libsrt.so.1: cannot open shared object file: No such file or directory" try the following:
if you are on CentOS:
yum -y install mlocate (this is assuming you don't already have updatedb and locate commands installed)
ldd $(which ffmpeg) --> you'll likely see that liberty.so.1 is "not found"
then try: updatedb && locate libsrt.so.1 --> this SHOULD likely yield the fact that it is in the path of $HOME/ffmpeg_build/lib64/
You'll next need to add that path to /etc/ld.so.conf which you could do by doing:
echo "$HOME/ffmpeg_build/lib64/" | sudo tee -a /etc/ld/so.conf >/dev/null
sudo ldconfig
This worked for me -- hopefully works for you!
you should patch srt.pc, add -lstdc++ -lm to it
root@host01:~# pkg-config --libs srt
-L/usr/local/lib -lsrt -lstdc++ -lm
Thank you guys. you have made my day.
i have tried the quick solution from nxtreaming and it worked, although i am still unsure why, and which bit is the culprit here. FFMPEG, Centos or the srt.pc ?
After messing about for a bit longer, the following steps worked for me.
at SRT build stage, i forced libraries to be created in /ffmpeg_build/lib rather than /ffmpeg_build/lib64 directory, and then patched the srt.pc file as per advice above.
so my SRT configure command ended up looking like this :
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_LIBDIR="$HOME/ffmpeg_build/lib" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off
I used this "configure" and it worked without modifying the srt.pc:
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_BINDIR="$HOME/ffmpeg_build/bin" -DCMAKE_INSTALL_INCLUDEDIR="$HOME/ffmpeg_build/include" -DCMAKE_INSTALL_LIBDIR="$HOME/ffmpeg_build/lib" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off
Most helpful comment
I used this "configure" and it worked without modifying the srt.pc: