Search code examples
g++pkg-config

pkg-config cannot find a customized build of a library


I installed ffmpeg4.2 through apt a week ago. The library was installed under /usr/lib/x86_64-linux-gnu. Then I realize that I want to test my code in ffmpeg4.5, so I built it from source and installed it under /home/xxx/ffmpeg_build/lib. I also did export PKG_CONFIG_PATH=/home/xxx/ffmpeg_build/lib/pkgconfig:$PKG_CONFIG_PATH.

However, pkg-config cannot find the ffmpeg4.5 that I want it to see. So I checked the pc_path variable with pkg-config --variable=pc_path pkg-config, and it gave me /usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig.

I am guessing that pkg-config goes to /usr/local to find the *.pc file and therefore ignore my customized build. Is there a way I can append my customized path in the front, so as pkg-config can find the ffmpeg4.5 I built from source first?

EDIT: I just recall that pkg-config can find the ffmpeg4.5 I built from source correctly at first, but I did ldconfig -v for OpenCV setting, and then it stopped working.


Solution

  • My final work around is to decode all configs from the *.pc files into a g++ command manually. It's definitely not ideal, but for a small project I am working on, it does what I need