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 \

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

3 Answers 3


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
  • 2
    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.
    – doug
    Jun 23, 2020 at 19:37
  • 1
    I've just had this same error (on Debian 10.4) and installing libunistring-dev solved the problem for me too.
    – Tony
    Jun 25, 2020 at 20:56
  • @doug - This is on the default compile command line from ffmpeg compile instructions: trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
    – ezwrighter
    Jul 10, 2020 at 23:20
  • 2
    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..
    – doug
    Jul 11, 2020 at 0:16
  • Thanks. This was the problem. Once i installed libunistring dev headers it compiled.
    – LFMekz
    Jan 24, 2021 at 6:13

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

apt install libgnutls28-dev

Yes, that guide does not work correctly on any Ubuntu build since at least 16.04. The simplest method to solve this problem I've found is to first install the default Ubuntu package and then generate your custom script. Prior to running your ffmpeg compile script, install the default package from official Ubuntu repository of the library that ffmpeg is complaining about:

apt install -y gnutls

The root cause many of these library issues and Package Config appears to be often related to C/C++ syntax that is incorrect in the library source files. This has been an issue (and continues to be one) for several ffmpeg dependencies in Ubuntu, such as VLC's x265 library. The problem is compounded by BitBucket's recent decision to discontinue Mercurial support, including their decision to shutdown its forums, which removed several related discussions and solutions from the Internet. :(

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .