flame@yamato static % PKG_CONFIG_PATH=$(pwd)/libavformat:$(pwd)/libavcodec:$(pwd)/libavutil:$(pwd)/libavcore pkg-config --libs 'libavformat >= 52.31.0 libavcodec >= 51'
/home/flame/devel/repos/git/ffmpeg/static/libavformat/libavformat.a -pthread /home/flame/devel/repos/git/ffmpeg/static/libavcodec/libavcodec.a /home/flame/devel/repos/git/ffmpeg/static/libavutil/libavutil.a /home/flame/devel/repos/git/ffmpeg/static/libavcore/libavcore.a -ldl -lasound -lm -lbz2 -lz
flame@yamato static % PKG_CONFIG_PATH=$(pwd)/libavcodec:$(pwd)/libavformat:$(pwd)/libavutil:$(pwd)/libavcore pkg-config --libs 'libavformat >= 52.31.0 libavcodec >= 51'
/home/flame/devel/repos/git/ffmpeg/static/libavcodec/libavcodec.a -pthread /home/flame/devel/repos/git/ffmpeg/static/libavformat/libavformat.a /home/flame/devel/repos/git/ffmpeg/static/libavutil/libavutil.a /home/flame/devel/repos/git/ffmpeg/static/libavcore/libavcore.a -ldl -lasound -lm -lbz2 -lz
The problem here is that if you pass the library paths as in the second call, the linker will discard libavcodec.a as unnecessary right away, and then will not find the symbols required by libavformat.a.
Looks like a missing requires in libavformat's .pc file to me.
% pkg-config --libs 'libavformat >= 52.31.0 libavcodec >= 51'
/home/flame/devel/repos/git/libav/yamato/libavformat/libavformat.a -pthread /home/flame/devel/repos/git/libav/yamato/libavcodec/libavcodec.a -ldl -lasound -lm -lbz2 -lz
you see again libavformat.a being before libavcodec.a as I said.
% fgrep Requires libavformat/libavformat-uninstalled.pc
Requires: libavcodec = 52.114.0
so the Requires line is properly there.
Diego, could you attach (or inline) the .pc files where you're hitting this issue? I have an idea what the problem is, but I'd like to make sure I'm seeing the same thing you are.
Oh, I think I see the issue. pkg-config only treats -l as a library. /lib.a is just another argument in Libs. pkg-config is known to not handle these well. This is the same as people getting the ordering of their -Wl arguments hosed. You can see that pkg-config doesn't consider these libraries by running "pkg-config --libs-only-other".
A workaround is to just use -L with the uninstalled path. The linker will still use the static archive if it's all that's there.
Fixed (for this use case) in commit 6ecf318c. There was indeed a bug in ordering of non-l flags. I've now fixed that and added a test. However, there's still the issue that pkg-config breaks the ordering of -l and non-l flags. That's bug19950 and possibly bug16101. I have an idea to fix that but haven't pulled it together yet.
on Dec 09, 2016 at 07:41:50.
(provided by the Example extension).