Re: Beware pkg-config --libs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

[It took me long time, but I hope we are getting to a sane solution
now..  I'm sorry that I was not able to get there quicker.  Thanks a
lot for your patience.]

On Sat, Dec 08, 2007 at 01:35:43AM +0100, Karel Zak wrote:
>         Name: blkid
>         Requires:
>         Libs: -L${libdir} -lblkid
>         Libs.private: -luuid -ldevmapper

>         # pkg-config --libs blkid
>         -lblkid  

>         # pkg-config --static --libs blkid
>         -lblkid -luuid -ldevmapper  

but this is not correct: before the change, the output of the latter
command was:
	-L/lib -lblkid -luuid -ldevmapper -lselinux -lsepol

The extra flags come from devmapper.pc, which was brought into the
play by the (recursive) evaluation of "Requires".

More generally speaking, the outlined solution does not scale,
because Libs.private would have to list all required libraries,
directly or indirectly.  So if a library deep below in the tree
changed its requirements, the Libs.private tag would become
incorrect.

Indeed, the man page clearly indicates that this is not what
"Libs.private:" has been invented for:
---quote---
  Libs:  This  line  should give the link flags specific to your package.
	 Don't add any flags for required packages; pkg-config  will  add
	 those automatically.
  Libs.private:
	 This  line  should  list  any private libraries in use.  Private
	 libraries are libraries  which  are  not  exposed  through  your
	 library, but are needed in the case of static linking.
---end-of-quote---
I believe this context shows that Libs.private is meant for libraries
which are part of the package but do not implement any part of
published API.

The solution must be that pkg-config refrains from recursive
gathering of "Libs:" for dynamic linking.

Luckily, the functionality seems to be present in pkg-config-0.22:
There is a "Requires.private:" tag.

Actually, when each .pc file corresponds to one library, it seems
that Requires.private should be always used instead of Requires.

In that light, I believe we can use pkg-config in the most
straightforward manner, as originally proposed, relying that the
problem will be fixed on the side of the .pc descriptions of the
libraries we use.  I hope to post followups to the main thread (with
patches), and to submit patches for blkid.pc and volume_id.pc RSN.

Have a nice day,
	Stepan
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux