Re: Linking of libdar64
Denis Corbin <[email protected]> Thu, 13 Jul 2023 16:12:59 +0200
| Newsgroups | gmane.comp.sysutils.backup.dar.support |
|---|---|
| Message-ID | <[email protected]> |
On 12/07/2023 04:39, John Goerzen wrote: > On Tue, Jul 11 2023, Denis Corbin wrote: > >> I've fixed that by merging those other *_LIBS/CXXFLAGS/CPPFLAGS into their >> LIBS/CXXFLAGS/CPPFLAGS counterparts... the result seems fixing the issue. >> >> If you have the opportunity/possibility to test the 2.7.11.RC1 available at >> https://dar.edrusb.org/dar.linux.free.fr/Interim_releases/ for confirmation, I >> will then release 2.7.11 at next week-end. > > I took a quick look and ran into a stumbling block. I may not have the > chance to investigate this for a day or two, but from what you've said, > it sounds like you've got the solution. no worries > > Debian has been carrying this patch for awhile: > > --- dar-2.7.8.orig/src/dar_suite/Makefile.am > +++ dar-2.7.8/src/dar_suite/Makefile.am > @@ -92,7 +92,7 @@ endif > # > > bin_PROGRAMS = dar dar_xform dar_slave dar_manager dar_cp dar_split $(ALSO_BUILD) > -LDADD = ../libdar/$(MYLIB).la $(LIBCURL_LIBS) $(GPGME_LIBS) $(LIBTHREADAR_LIBS) $(LTLIBINTL) > +LDADD = ../libdar/$(MYLIB).la $(LIBCURL_LIBS) $(GPGME_LIBS) -lassuan $(LIBTHREADAR_LIBS) $(LTLIBINTL) > if DEBUG_STATIC > AM_LDFLAGS = -all-static $(LD_PROF) > else > > This is because libgpgme needs libassuan. TBH, this is another case of > "I'm not sure why this is working for others". Well that patch of > course no longer applies and LDADD doesn't look like the right place to > add this anymore either. I just need to find the right place to add > -lassuan. the libassuan dependency should be provided by libgpgme from pkg-config information, if it depends on it. If libgpgme is set properly on that, dar/libdar will add -lassuan automatically. > > ... but I mention it here because this got me thinking: why are we > patching this specially in Debian? Maybe this should be upstream? Yep, from my point of view, the -lassuan is gpgme upstream (if I'm not wrong) > > It's probably not a problem with the dynamically-linked version: > > $ ldd /usr/lib/x86_64-linux-gnu/libgpgme.so > linux-vdso.so.1 (0x00007ffdc50f5000) > libassuan.so.0 => /lib/x86_64-linux-gnu/libassuan.so.0 (0x00007f5e9577e000) > libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f5e95756000) > libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5e95575000) > /lib64/ld-linux-x86-64.so.2 (0x00007f5e95821000) you're correct it is not a problem for dynamic linking, because the dynamic linker will recursively load dependent library from dar dynamic binary to libdar to libgpgme to libassuan... as listed in the header of the ELF binary format (AFAIK). > > But with the static linking, it pops up: Yes, this is the reason of existence of pkg-config tool: each piece of software (library) can this way indicate what flags should be used to compile and link them to form an executable... well, now libgpgme does not set pkg-config, however they provide the AM_PATH_GPGME macro for autoconf, which dar uses. And It works: 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 # I just don't understand why it does not work in your case: > > libtool: link: g++ -g -O2 -ffile-prefix-map=/home/jgoerzen/work/dartmp/dar=. -fstack-protector-strong -Wformat -Werror=format-security -Wl, > -z -Wl,relro -Wl,-z -Wl,now -o dar_manager dar_suite.o dar_manager.o line_tools.o no_comment.o hide_file.o ../libdar/.libs/libdar64.a -lar > gon2 -lthreadar -lpthread -L/usr/lib/x86_64-linux-gnu -lgpgme -lrsync -lgcrypt -lgpg-error -llz4 -lzstd -llzma -llzo2 -lbz2 -lz -ldl -lcap > /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgpg-error.a(libgpg_error_la-sysutils.o): in function `_gpgrt_getpwdir': > (.text+0x2ca): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version > used for linking > /usr/bin/ld: (.text+0x2e8): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the g > libc version used for linking > /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgpgme.a(engine-gpgsm.o): in function `gpgsm_assuan_simple_command': > (.text+0x14f): undefined reference to `assuan_write_line' > /usr/bin/ld: (.text+0x172): undefined reference to `assuan_read_line' > /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgpgme.a(engine-gpgsm.o): in function `gpgsm_cancel': > (.text+0x4eb): undefined reference to `assuan_release' > ... and more ... > > I certainly don't mind adapting this Debian patch to the new layout, but > thought I'd mention in case you're interested also. > > - John > Thanks for your feedback Regards, Denis
OpenPGP_signature
(application/pgp-signature, 840 B) - not displayed