Bug 19950 - -Bstatic and -Bdynamic not handled properly
Summary: -Bstatic and -Bdynamic not handled properly
Alias: None
Product: pkg-config
Classification: Unclassified
Component: src (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Dan Nicholson
QA Contact:
: 56699 (view as bug list)
Depends on:
Blocks: 16101
  Show dependency treegraph
Reported: 2009-02-04 03:56 UTC by Chris Hulbert
Modified: 2013-01-22 13:20 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Description Chris Hulbert 2009-02-04 03:56:45 UTC
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

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
Comment 1 Sébastien Fabbro 2010-12-11 15:45:51 UTC
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.
Comment 2 Dan Nicholson 2012-11-06 14:38:57 UTC
*** Bug 56699 has been marked as a duplicate of this bug. ***
Comment 3 Dan Nicholson 2012-12-08 20:04:17 UTC
I pushed the flag-order-fixes branch to git which I believe addresses this issue.


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.
Comment 4 Dan Nicholson 2013-01-22 13:20:14 UTC
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.