wrong gnutls.pc

Andreas Metzler ametzler at downhill.at.eu.org
Fri Feb 26 19:30:26 CET 2010

On 2010-02-26 Vincent Torri <vincent.torri at gmail.com> wrote:
> Hey,
> compiling libcurl on Windows with MinGW leads to undefined symbols. The
> problem is in a bug in gnutls.pc. Indeed libgcrypt is a required dependency
> (btw, it is not checked in gnutls/lib/configure.ac. I think that it must be
> checked there. The library has a libgcrypt-config to  get cflags and libs).
> Hence, -lgcrypt must appear in the Libs.private field of gnutls.pc


This broke somewhere after 2.6.6. 2.6.6 still has
Libs: -L${libdir} -lgnutls
Libs.private: -L${exec_prefix}/lib -lgnutls -lgcrypt  -L/usr/lib -ltasn1

but e.g. 2.7.11 is missing -lgcrypt in Libs.private.

I will try to investigate further this weekend.

> * in Libs.private of gnutls.pc.in, @LIBGNUTLS_LIBS@ is added, which means,
> according to its definition, that -lgnutls appears in Libs.private, which is
> useless.

It does not hurt either, pkg-config strips the duplicates.
>  * libtasn1 is not checked with pkg-config if it exists (well, i don't see
> anything in gnutls/lib/configure.ac).

tasn is searched for with AC_LIB_HAVE_LINKFLAGS. See

> If it exists, 'libtasn1' must appear
> in the Requires.private field (or Requires field if you support pkg-config <
> 0.22).

It does.

> If it does not exists, i think that you link directly against your
> own libtasn2 code, so @LTLIBTASN1@ should not appear in Libs.private

This seems to work correctly for me, too. If build against external
tasn I get -ltasn1 in Libs.private, if I uses internal tasn I do not:
ametzler at argenau:/tmp/GNUTLS$ wdiff */debian/tmp/usr/lib/pkgconfig/gnutls.pc | \
       grep -1 tasn
Libs: -L${libdir} -lgnutls
Libs.private: -L${exec_prefix}/lib -lgnutls  {+-L/usr/lib -ltasn1+}
Cflags: -I${includedir}

For reference all my testing was done on Linux, not Windows.

cu andreas
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'

More information about the Gnutls-devel mailing list