Unable to compile FFmpeg on Ubuntu 20.04

18,192

Solution 1

In the ffbuild directory (path : ffmpeg_sources/ffmpeg/ffbuild/), inspecting the config.log gives more info on the error message :

/usr/bin/ld: cannot find -lunistring
collect2: error: ld returned 1 exit status
ERROR: gnutls not found using pkg-config

With help from ffmpeg's IRC channel, installing the libunistring-dev package fixed the problem.

sudo apt-get install libunistring-dev

Solution 2

The other solutions didn't work for me, although I'm on Debian not Ubuntu. For me the solution was:

apt install libgnutls28-dev
Share:
18,192
Saurabh P Bhandari
Author by

Saurabh P Bhandari

Updated on September 18, 2022

Comments

  • Saurabh P Bhandari
    Saurabh P Bhandari almost 2 years

    I am following this compilation guide for FFmpeg. After compiling all the required dependencies, I get the following error in the last section.

    ERROR: gnutls not found using pkg-config
    

    This error occurs when I run the configure command as below :

    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
    

    I am compiling FFmpeg on a fresh install of Ubuntu 20.04.

  • doug
    doug about 4 years
    Hardly makes sense as one normally doesn't need libunistring-dev. The option --pkg-config-flags="--static" is what causes this.., not clear on value of that option, see none here.
  • Tony
    Tony about 4 years
    I've just had this same error (on Debian 10.4) and installing libunistring-dev solved the problem for me too.
  • ezwrighter
    ezwrighter almost 4 years
    @doug - This is on the default compile command line from ffmpeg compile instructions: trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
  • doug
    doug almost 4 years
    I understand it's in the guide. The configure option was added 5 yrs ago with no comment (trac.ffmpeg.org/wiki/CompilationGuide/…) . Now it needs a dep installed that isn't part of the guide. As far as option, it serves no purpose in this particular build/install of 3 binaries. No practical need for..
  • LFMekz
    LFMekz over 3 years
    Thanks. This was the problem. Once i installed libunistring dev headers it compiled.
  • llogan
    llogan over 2 years
    @doug Old Q/A I haven't seen before. I don't remember why --pkg-config-flags="--static" was added or why no comment was left (laziness?). IIRC, something to do with x265? Maybe I'll look into it. Haven't touched the guide much in a long time but made a few minor changes and cleanups today.