Bug 19950

Summary: -Bstatic and -Bdynamic not handled properly
Product: pkg-config Reporter: Chris Hulbert <cchgroupmail>
Component: srcAssignee: Dan Nicholson <dbn.lists>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: zboszor
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 16101    

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
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
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.

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.
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.