Jeoker
Jeoker

Reputation: 81

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.

Upvotes: 0

Views: 1052

Answers (2)

Jeoker
Jeoker

Reputation: 81

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

Upvotes: 0

Hannes Stoolmann
Hannes Stoolmann

Reputation: 896

Add you custom lib to the dyanmic linker search path.

1.) add a new conf file

/etc/ld.so.conf.d/customlib.conf

2.) insert: (assuming your lib is in the directory /usr/local/ffmpeg45/lib

/usr/local/ffmpeg45/lib

3.) run

ldconfig -v 2>&1|grep -iv ffmpeg

Should work

Upvotes: 0

Related Questions