0

I'm trying to compile bmdtools with a custom built version of libav 11 which I compiled under ~/libav-11.8/build using g++ 4.8.4 under Ubuntu 14.04. bmd uses pkg-config to build g++ flags, and since compilation fails on the linking phase, I tested pkg-config output as follows:

echo `pkg-config --cflags --libs libavcodec libavformat libswscale libavutil`

which yelds

-I/usr/local/include -pthread -L/usr/local/lib -lavformat -lavcodec
-ldl -lasound -lz -lwscale -lavutil -lm

So I figured -I and -L flags where not set to the custom build location. Setting PKG_CONFIG_PATH=~/libav-11.8/build/lib/pkgconfig and running it again yelded

-Ibuild/include -pthread -Lbuild/lib ...<lib flags>

which would be correct if I ran g++ from the build root folder. Shouldn't pkg-config resolve to an absolute path instead of a relative one? What is the rationale behind this behaviour?

2
  • Presumably it's reading pkg-config files under ~/libav-11.8/build/lib/pkgconfig; look for files with a .pc extension — what do they contain? I'm guessing you'll find the relative paths in there... Oct 19, 2016 at 16:42
  • I did find those, but they use prefix variable, which is set to build, in the Libs and Cflags section. That way it cannot be used to compile dependent libs which are not in the same root folder. Oct 19, 2016 at 16:59

1 Answer 1

2

After reading Freedesktop Guide to pkg-config I realized pkg-config does nothing to validate whether binaries, libraries or paths are accurate. It only spits out what is written in the Libs and Cflags of the .pc files.

In my case those are created by libav's compilation process and use the prefix variable passed to configure.

So after recompiling libav with prefix set to an absolute path, pkg-config will output -I and -L flags appropriate for use in the compilation of other projects.

You must log in to answer this question.

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