Re: Linking of libdar64

Denis Corbin <[email protected]> Sun, 16 Jul 2023 20:19:07 +0200
Newsgroups gmane.comp.sysutils.backup.dar.support
Message-ID <[email protected]>
On 14/07/2023 13:50, John Goerzen wrote:
> On Thu, Jul 13 2023, Denis Corbin wrote:
> 
>> the -lassuan is added to the list of dependent libraries. The generated Makefile
>> by the ./configure scripts has this variable
>> # grep GPGME_LIBS Makefile
>> GPGME_LIBS = -L/usr/lib/x86_64-linux-gnu -lgpgme -lassuan -lgpg-error
> 
> Thanks - this gives me a place to make the patch.
> 
>> I just don't understand why it does not work in your case:
> 
> Here is my /usr/lib/x86_64-linux-gnu/pkgconfig/gpgme.pc .  Is yours
> different, particularly the Libs line?

Non this is the same file I have and it is absolutely correct:

> 
> prefix=/usr
> exec_prefix=${prefix}
> includedir=${prefix}/include
> libdir=${prefix}/lib/x86_64-linux-gnu
> host=x86_64-pc-linux-gnu
> api_version=1
> 
> Name: gpgme
> Description: GnuPG Made Easy to access GnuPG
> Requires.private: gpg-error, libassuan
> Version: 1.18.0
> Cflags: -I${includedir}
> Libs: -L${libdir} -lgpgme
> URL: https://www.gnupg.org/software/gpgme/index.html


With that same file, on a Debian bullseye the "-lassuan" is properly 
added to GPGME_LIBS:

# grep GPGME_LIBS Makefile
GPGME_LIBS = -L/usr/lib/x86_64-linux-gnu -lgpgme -lassuan -lgpg-error

I tried a vanilla debian 12, adding the necessary packages and compilers 
and manually adding libthreadar in /usr/local in order to compile 
dar/libdar:

gpgme fails to be detected lacking the gpgme-config utility which came 
with package gpgme-tool in earlier Debian versions:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1023601

This gpgme-config tool is not used directly in dar source code but it 
seems used indirectly from the AM_PATH_GPGME automake macro used in 
dar's configure.ac script.

after running autoreconf (which needs additional packages, like 
autoconf, automake, libool and gettext) the re-generated configure 
scripts get fixed and can then properly detect the libgpgme library... 
However it does not take into account the static linking and the 
resulting Makefile miss the -lassuan:

# grep GPGME_LIBS Makefile
GPGME_LIBS = -L/usr/lib/x86_64-linux-gnu -lgpgme

Though running "pkg-config --libs --static gpgme" still provides the 
correct result:

# pkg-config --libs --static gpgme
-lgpgme -lgpg-error -lassuan -lgpg-error

It seems there is a regression in the GPGME package for static linking 
against libgpgme. But anyway, it makes no sense to statically link 
against libgpgme as this library is just a thin API over the shell gpg 
command line tool. Without this gpg binay in your path (or env 
variable), even if dar has been statically linked against libgpgme, it 
won't be able to do anything related to asymmetric ciphering/signing.

so building dar_static the --disable-gpgme-linking passed to ./configure
makes sense. Else you should build a static gpg binary and distribute it 
beside dar_static.

Cheers,
Denis


>
> - John
>
OpenPGP_signature (application/pgp-signature, 840 B) - not displayed