What I've tried:

  • gcc -L/path/to/lib/ -llib ...
  • gcc -l/path/to/lib/lib.so.x.x.x ...
  • Update ldconfig
  • Added path to LD_LIBRARY_PATH
  • file shows correct build version and link to the correct file

No matter what, I still get /usr/bin/ld: cannot find -lavfilter

Any ideas?

  • Do you have a libavfilter.so (with no numbers) anywhere? You probably need the avfilter development package (libavfilter-dev on Debian and derivatives). Jan 25, 2019 at 9:03
  • Thank you, that solved it. I'm not quite sure why though, since I already had the libraries in that particular directory. libavfilter.so is in the same folder as *.so.x.x.x, which it links to.
    – William
    Jan 25, 2019 at 9:17

1 Answer 1


ld looks for shared libraries or linker scripts named libsomething.so, or static libraries named libsomething.a, where something matches the -lsomething parameter given to ld. Libraries named libsomething.so.x.y.z, where x.y.z is the library’s version, are used at runtime, not for building, and ld won’t use them.

You therefore need to install the development packages for libraries you want to link to, such as libavfilter-dev in your case (assuming Debian or a derivative).

You must log in to answer this question.

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