Created attachment 107917 [details] The files mentioned in the bug report. Hi! It seems that pkg-configs handling of dependencies between libraries is broken when the flag "--static" is used. The resuling link-line contains the -lXXX in wrong order. Strangely enough they come in the correct order if I DON'T specify "--static" (in which case im linking dynamically and order doesn't matter anyway) Is this a bug, or did I use an "undocumented feature" in 0.26 that disappeared in 0.28. In the later case, what is the correct way of getting this kind of dependencies to work? This bug (?) seems to have appeared somewhere between versions 0.26 and 0.28 (see test-runs below)? I created two as-simple-as-possible .pc files to illustrate the problem. NOTE: * pkg-config_0.26 - is from a 32-bit installation of ubuntu 12.04 LTS Linux version 3.2.0-33-generic-pae (buildd@lamiak) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #52-Ubuntu SMP Thu Oct 18 16:39:21 UTC 2012 * pkg-config_0.28 - is from a recent gentoo installation Linux version 3.0.6-gentoo (root@ms_skrivbord) (gcc version 4.5.3 (Gentoo 4.5.3-r1 p1.0, pie-0.4.5) ) #15 SMP PREEMPT Mon Apr 7 13:32:30 CEST 2014 ========== Files used for test =========== $ ls b.pc iDependOnB.pc pkg-config_0.26 pkg-config_0.28 ========== b.pc ========== $ cat b.pc # Package Information for pkg-config Name: libB Description: Library that depends on nothing but itself Version: 2.4.3 Libs: -lb ========== iDependOnB.pc ========== $ cat iDependOnB.pc # Package Information for pkg-config Name: libIDependOnB Description: Library that depends on libB Version: 2.4.3 Requires: b Libs: -liDepedOnB ========== Reproducing the problem ========== ## ------ This causes link-error because "b" is needed by the second lib "iDependOnB", and thus should come after "-liDependOnB", not before. $ PKG_CONFIG_LIBDIR=. ./pkg-config_0.28 --static --libs b iDependOnB.pc -lb -liDepedOnB ## ------ Rest of lines seem correct to me $ PKG_CONFIG_LIBDIR=. ./pkg-config_0.26 --static --libs b iDependOnB.pc -liDepedOnB -lb $ PKG_CONFIG_LIBDIR=. ./pkg-config_0.28 --libs b iDependOnB.pc -liDepedOnB -lb $ PKG_CONFIG_LIBDIR=. ./pkg-config_0.26 --libs b iDependOnB.pc -liDepedOnB -lb
Thanks for the report. I can't seem to reproduce that here, either with pkg-config from git or 0.28. Could you add "--debug" to your command line and paste the output here? One thing I'll note in your test is that you're specifying b without the .pc suffix, but you are specifying iDependOnB with it. That might have a subtle influence on the path ordering, but you are correct that it should print "-liDepedOnB -lb".
(In reply to Dan Nicholson from comment #1) > Thanks for the report. I can't seem to reproduce that here, either with > pkg-config from git or 0.28. Could you add "--debug" to your command line > and paste the output here? > > One thing I'll note in your test is that you're specifying b without the .pc > suffix, but you are specifying iDependOnB with it. That might have a subtle > influence on the path ordering, but you are correct that it should print > "-liDepedOnB -lb". Hi Dan! It shows that the buggy pkg-config implementation on the gentoo machine was: * dev-util/pkgconf Homepage: https://github.com/pkgconf/pkgconf Description: pkg-config compatible replacement Which means it is not your implementation. I noticed my misstake when there was no --debug flag. I was fooled initially by that the BSD version outputed a version-number similar to yours (0.28). So I posted this bug report in the wrong project. Sorry for the inconvenience and thank you for your answer. Best Regards Axel
Thanks for getting back about that. Closing this bug.
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.