Bug 61792

Summary: examples/wocky-dump-certificates doesn't have TLS_CFLAGS / TLS_LIBS in Makefile
Product: Wocky Reporter: Will Thompson <will>
Component: GeneralAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: rishi.is
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch for wocky
New version of patch

Description Will Thompson 2013-03-04 14:41:26 UTC
Since the dump-certificates example program from bug 36207 was merged, Wocky (and hence Gabble) has failed to build on Fedora because it doesn't link:

    libtool: link: gcc -std=gnu99 -I.. -I.. -Wall -Wextra -Wdeclaration-after-statement -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wsign-compare -Wnested-externs -Wpointer-arith -Wformat-security -Winit-self -Wno-missing-field-initializers -Wno-unused-parameter -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -Wl,-z -Wl,relro -o .libs/wocky-dump-certificates dump-certificates.o -pthread  -lgthread-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 ../wocky/.libs/libwocky.so -pthread -Wl,-rpath -Wl,/usr/lib/telepathy/gabble-0/lib
    /usr/bin/ld: dump-certificates.o: undefined reference to symbol 'gnutls_x509_crt_get_dn@@GNUTLS_1_4'
    /usr/bin/ld: note: 'gnutls_x509_crt_get_dn@@GNUTLS_1_4' is defined in DSO /lib/libgnutls.so.28 so try adding it to the linker command line
    /lib/libgnutls.so.28: could not read symbols: Invalid operation
    collect2: error: ld returned 1 exit status
    make[7]: *** [wocky-dump-certificates] Error 1

examples/Makefile.am doesn't specify @TLS_FLAGS@ or @TLS_LIBS@ for the dump-certificates example's rules, so that's probably why.
Comment 1 Dominique Leuenberger 2013-03-15 18:34:50 UTC
Created attachment 76588 [details] [review]
Patch for wocky
Comment 2 Simon McVittie 2013-03-15 20:01:17 UTC
Comment on attachment 76588 [details] [review]
Patch for wocky

Review of attachment 76588 [details] [review]:
-----------------------------------------------------------------

I think it'd be better to set wocky_dump_certificates_LDADD to contain both $(LDADD) and $(TLS_LIBS) (or @TLS_LIBS@ if you prefer) - the rest of the examples don't use TLS code directly, so there's no point giving them a strong dependency on it.

AM_CFLAGS ought to have $(TLS_CFLAGS) too, so it'll work if gnutls is not on the compiler's default search path. That one doesn't really need to be target-specific in the same way, since it won't alter the code that gets compiled/linked for the other examples - it can just go in AM_CFLAGS.
Comment 3 Dominique Leuenberger 2013-03-17 13:22:16 UTC
Created attachment 76645 [details] [review]
New version of patch

absolutely right... TLS_LIBS should of course only be linked to the one needing it (was no issue here as I generally build with -Wl,--as-needed, so it got auto-removed again).

This new patch adds TLS only to the dump-register-certificate example and leaves the others alone.
Comment 4 Simon McVittie 2013-03-18 11:21:21 UTC
Comment on attachment 76645 [details] [review]
New version of patch

Review of attachment 76645 [details] [review]:
-----------------------------------------------------------------

Thanks, I'll merge this.

::: examples/Makefile.am
@@ +13,4 @@
>  
>  wocky_dump_certificates_SOURCES = dump-certificates.c
>  wocky_dump_certificates_DEPENDENCIES = $(top_builddir)/wocky/libwocky.la
> +wocky_dump_certificates_CFLAGS = $(TLS_CFLAGS) $(AM_CFLAGS)

Not what I suggested, but this is also fine.
Comment 5 Simon McVittie 2013-03-18 12:54:15 UTC
Fixed in wocky master, and in Gabble master for 0.17.4. Thanks!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.