Subject: Re: libssh2.pc lacks Requires

Re: libssh2.pc lacks Requires

From: Vincent Torri <>
Date: Mon, 23 Apr 2012 12:54:24 +0200

On Mon, Apr 23, 2012 at 12:46 PM, Guenter <> wrote:
> Am 23.04.2012 09:48, schrieb Vincent Torri:
>> On Mon, Apr 23, 2012 at 1:36 AM, Mikhail Gusarov
>> <>  wrote:
>>> Twas brillig at 01:18:27 23.04.2012 UTC+02 when did gyre
>>> and gimble:
>>>  >>  .private (both for Libs and Requires) is shown when pkg-config is
>>> run
>>>  >>  with --static.
>>>  G>  then we should just duplicate it and have both, or?
>>> No.
>>> If the library is exposed in Libs/Requires, then the client of shared
>>> version libssh2 is becoming linked to this library, which is a bad thing
>>> (e.g. see ).
>> Right. I post here a discussion i had in the pkg-config list with the
>> same problem :
> thanks Vincent.
> I did for now just change to 'Requires.private' since only apps which link
> statically against libssh2 need the dependencies. Not sure if the hack what
> you suggested is needed - pkg-config 0.22 is close to 5 years out already,
> and IMO if some uses a version < 0.22 and this fails its probably a good
> reminder to the developer to update.
> One thing remains though: we do not yet cope with libz dependency. Shouldnt
> we have -lz with 'Libs.private:' when build with zlib?

it depends on how you check zlib. zlib added zlib.pc recently
(something like zlib1.2.3 or 1.2.4, i can't remember).

what you can do:

1) check if zlib.pc exists (PKG_CHECK_MODULES)
2) if yes, add zlib to Requires.private
3) if no, check if header and library files exist
  a) if yes add -lz to Libs.private
  b) if no, well, do what you want when no zlib is not found

Vincent Torri

Received on 2012-04-23