Some linkers use flags such as -Bstatic and -Bdynamic to indicate how to link subsequent libraries. These flags are meant to be interleaved amongst the libraries as necessary. pkg-config does not specially handle these, so they are treated as "other libs" and end up grouped together which breaks the purpose. Below is an example that shows the grouping of these flags which breaks the intent. [chulbert@fourier tmp]$ cat test.pc prefix=/us/local exec_prefix=${prefix} libdir=${exec_prefix}/lib64 includedir=${prefix}/include fcflags=-I${includedir} Name: test Description: test pc Version: 1.0 Libs: -L${libdir} -Bdynamic -la -Bstatic -lb [chulbert@fourier tmp]$ PKG_CONFIG_PATH=. pkg-config --libs test -Bdynamic -Bstatic -L/us/local/lib64 -la -lb
Handle specific link flags would be very helpful. Some other flags such as GNU --start-group/--end-group could be used with pkg-config as well.
*** Bug 56699 has been marked as a duplicate of this bug. ***
I pushed the flag-order-fixes branch to git which I believe addresses this issue. http://cgit.freedesktop.org/pkg-config/log/?h=flag-order-fixes Some info can be found on the list at http://lists.freedesktop.org/archives/pkg-config/2012-December/000908.html. Please test out the branch if you can. If there aren't any comments after a bit, I'll push to master and close this bug.
I pushed the flag-order-fixes branch to master and I think this is fixed now. Please reopen if that's not the case.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.