[libvirt] [PATCH] build: don't export avahi syms when unused

Detected when building --without-avahi. * src/libvirt_private.syms (virnetservermdns.h): Move... * src/libvirt_avahi.syms: ...to new file. * src/Makefile.am (USED_SYM_FILES, EXTRA_DIST): Use it. --- I'm debating whether to push this under the build-breaker rule. Unfortunately, while this solved my build on an Ubuntu machine, I have other machines which are failing for other symbols (some SASL related, and one for xenLinuxDomainBlockStats), so it's probably better to fix everything instead of just half the problem. src/Makefile.am | 7 ++++++- src/libvirt_avahi.syms | 13 +++++++++++++ src/libvirt_private.syms | 13 ------------- 3 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 src/libvirt_avahi.syms diff --git a/src/Makefile.am b/src/Makefile.am index da3d0cd..98bad3d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1344,6 +1344,10 @@ if HAVE_SASL USED_SYM_FILES += libvirt_sasl.syms endif +if HAVE_AVAHI +USED_SYM_FILES += libvirt_avahi.syms +endif + EXTRA_DIST += \ libvirt_public.syms \ libvirt_private.syms \ @@ -1357,7 +1361,8 @@ EXTRA_DIST += \ libvirt_qemu.syms \ libvirt_sasl.syms \ libvirt_vmx.syms \ - libvirt_xenxs.syms + libvirt_xenxs.syms \ + libvirt_avahi.syms GENERATED_SYM_FILES = libvirt.syms libvirt.def libvirt_qemu.def diff --git a/src/libvirt_avahi.syms b/src/libvirt_avahi.syms new file mode 100644 index 0000000..9bfed41 --- /dev/null +++ b/src/libvirt_avahi.syms @@ -0,0 +1,13 @@ +# Conditional on HAVE_AVAHI + +# virnetservermdns.h +virNetServerMDNSAddEntry; +virNetServerMDNSAddGroup; +virNetServerMDNSEntryFree; +virNetServerMDNSFree; +virNetServerMDNSGroupFree; +virNetServerMDNSNew; +virNetServerMDNSRemoveEntry; +virNetServerMDNSRemoveGroup; +virNetServerMDNSStart; +virNetServerMDNSStop; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 83ca99f..71341a2 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1541,19 +1541,6 @@ virNetServerClientStartKeepAlive; virNetServerClientWantClose; -# virnetservermdns.h -virNetServerMDNSAddEntry; -virNetServerMDNSAddGroup; -virNetServerMDNSEntryFree; -virNetServerMDNSFree; -virNetServerMDNSGroupFree; -virNetServerMDNSNew; -virNetServerMDNSRemoveEntry; -virNetServerMDNSRemoveGroup; -virNetServerMDNSStart; -virNetServerMDNSStop; - - # virnetserverprogram.h virNetServerProgramDispatch; virNetServerProgramFree; -- 1.7.11.2

On Mon, Jul 30, 2012 at 17:31:20 -0600, Eric Blake wrote:
Detected when building --without-avahi.
* src/libvirt_private.syms (virnetservermdns.h): Move... * src/libvirt_avahi.syms: ...to new file. * src/Makefile.am (USED_SYM_FILES, EXTRA_DIST): Use it. ---
ACK
I'm debating whether to push this under the build-breaker rule. Unfortunately, while this solved my build on an Ubuntu machine, I have other machines which are failing for other symbols (some SASL related, and one for xenLinuxDomainBlockStats), so it's probably better to fix everything instead of just half the problem.
I agree it would be nice to fix all issues but we can fix them with several patches, esp. since each of the issue may need to be solved in different way. My build also fails for xenLinuxDomainBlockStats, which should be easy to fix. The symbol is defined and used within Xen driver and nowhere else, thus the following patch should solve it: diff --git a/src/libvirt_linux.syms b/src/libvirt_linux.syms index 2258739..67c1d7f 100644 --- a/src/libvirt_linux.syms +++ b/src/libvirt_linux.syms @@ -5,7 +5,6 @@ # stats_linux.h linuxDomainInterfaceStats; -xenLinuxDomainBlockStats; # nodeinfo.h linuxNodeInfoCPUPopulate; However, my build also fails for 5 network symbols. I wonder if it's the same case as with xenLinuxDomainBlockStats. It's probably worth mentioning that I build with --without-driver-modules. Jirka

On Tue, Jul 31, 2012 at 10:54:52AM +0200, Jiri Denemark wrote:
On Mon, Jul 30, 2012 at 17:31:20 -0600, Eric Blake wrote:
Detected when building --without-avahi.
* src/libvirt_private.syms (virnetservermdns.h): Move... * src/libvirt_avahi.syms: ...to new file. * src/Makefile.am (USED_SYM_FILES, EXTRA_DIST): Use it. ---
ACK
I'm debating whether to push this under the build-breaker rule. Unfortunately, while this solved my build on an Ubuntu machine, I have other machines which are failing for other symbols (some SASL related, and one for xenLinuxDomainBlockStats), so it's probably better to fix everything instead of just half the problem.
I agree it would be nice to fix all issues but we can fix them with several patches, esp. since each of the issue may need to be solved in different way.
My build also fails for xenLinuxDomainBlockStats, which should be easy to fix. The symbol is defined and used within Xen driver and nowhere else, thus the following patch should solve it:
diff --git a/src/libvirt_linux.syms b/src/libvirt_linux.syms index 2258739..67c1d7f 100644 --- a/src/libvirt_linux.syms +++ b/src/libvirt_linux.syms @@ -5,7 +5,6 @@
# stats_linux.h linuxDomainInterfaceStats; -xenLinuxDomainBlockStats;
# nodeinfo.h linuxNodeInfoCPUPopulate;
ACK to that - I see no reason for it to be exported.
However, my build also fails for 5 network symbols. I wonder if it's the same case as with xenLinuxDomainBlockStats. It's probably worth mentioning that I build with --without-driver-modules.
Can you show me what the actual symbols you see are Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Tue, Jul 31, 2012 at 10:22:38 +0100, Daniel P. Berrange wrote:
On Tue, Jul 31, 2012 at 10:54:52AM +0200, Jiri Denemark wrote:
diff --git a/src/libvirt_linux.syms b/src/libvirt_linux.syms index 2258739..67c1d7f 100644 --- a/src/libvirt_linux.syms +++ b/src/libvirt_linux.syms @@ -5,7 +5,6 @@
# stats_linux.h linuxDomainInterfaceStats; -xenLinuxDomainBlockStats;
# nodeinfo.h linuxNodeInfoCPUPopulate;
ACK to that - I see no reason for it to be exported.
Thanks, I pushed this.
However, my build also fails for 5 network symbols. I wonder if it's the same case as with xenLinuxDomainBlockStats. It's probably worth mentioning that I build with --without-driver-modules.
Can you show me what the actual symbols you see are
All symbols from libvirt_network.syms: Expected symbol networkAllocateActualDevice is not in ELF library Expected symbol networkBuildDhcpDaemonCommandLine is not in ELF library Expected symbol networkGetNetworkAddress is not in ELF library Expected symbol networkNotifyActualDevice is not in ELF library Expected symbol networkReleaseActualDevice is not in ELF library According to nm, they are all in libvirt_driver_network.a: 0000000000005760 T networkAllocateActualDevice 00000000000036a0 T networkBuildDhcpDaemonCommandLine 00000000000065c0 T networkGetNetworkAddress 0000000000005f50 T networkNotifyActualDevice 00000000000062c0 T networkReleaseActualDevice but none of them makes it into the final libvirt library. Jirka

On Mon, Jul 30, 2012 at 05:31:20PM -0600, Eric Blake wrote:
Detected when building --without-avahi.
* src/libvirt_private.syms (virnetservermdns.h): Move... * src/libvirt_avahi.syms: ...to new file. * src/Makefile.am (USED_SYM_FILES, EXTRA_DIST): Use it. ---
I'm debating whether to push this under the build-breaker rule. Unfortunately, while this solved my build on an Ubuntu machine, I have other machines which are failing for other symbols (some SASL related, and one for xenLinuxDomainBlockStats), so it's probably better to fix everything instead of just half the problem.
src/Makefile.am | 7 ++++++- src/libvirt_avahi.syms | 13 +++++++++++++ src/libvirt_private.syms | 13 ------------- 3 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 src/libvirt_avahi.syms
Reluctant ACK. I'm surprised I wrote it using HAVE_AVAHI. I would be nice to change this so that the code in the .c file is conditionalized, and the APIs still exist providing a ENOSYS error or something. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 07/31/2012 03:21 AM, Daniel P. Berrange wrote:
On Mon, Jul 30, 2012 at 05:31:20PM -0600, Eric Blake wrote:
Detected when building --without-avahi.
* src/libvirt_private.syms (virnetservermdns.h): Move... * src/libvirt_avahi.syms: ...to new file. * src/Makefile.am (USED_SYM_FILES, EXTRA_DIST): Use it. ---
I'm debating whether to push this under the build-breaker rule. Unfortunately, while this solved my build on an Ubuntu machine, I have other machines which are failing for other symbols (some SASL related, and one for xenLinuxDomainBlockStats), so it's probably better to fix everything instead of just half the problem.
src/Makefile.am | 7 ++++++- src/libvirt_avahi.syms | 13 +++++++++++++ src/libvirt_private.syms | 13 ------------- 3 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 src/libvirt_avahi.syms
Reluctant ACK. I'm surprised I wrote it using HAVE_AVAHI. I would be nice to change this so that the code in the .c file is conditionalized, and the APIs still exist providing a ENOSYS error or something.
Sure, I can provide a v2 along these lines, then we can decide which version we like better (the v2 will be longer, but removing the conditionals will make maintenance of the .syms file easier). -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

The recent changes to test exported symbols flushed out the fact that we were unconditionally linking against symbols that were only conditionally compiled under HAVE_AVAHI. * src/Makefile.am (libvirt_net_rpc_server_la_SOURCES): Compile virnetservermdns unconditionally. * configure.ac (HAVE_AVAHI): Drop unused automake conditional. * src/rpc/virnetservermdns.c: Add fallbacks when Avahi is not present. --- Definitely more involved than splitting out a separate .syms file, so I'm not sure whether this approach is better than the v1 approach. But I did promise to propose this alternative, so here it is. I tested both with and without avahi development libraries present. configure.ac | 1 - src/Makefile.am | 8 +--- src/rpc/virnetservermdns.c | 98 ++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 91 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index 400ac3b..e93bbb5 100644 --- a/configure.ac +++ b/configure.ac @@ -1248,7 +1248,6 @@ if test "x$with_avahi" = "xyes" || test "x$with_avahi" = "xcheck"; then [whether Avahi is used to broadcast server presense]) fi fi -AM_CONDITIONAL([HAVE_AVAHI], [test "x$with_avahi" = "xyes"]) AC_SUBST([AVAHI_CFLAGS]) AC_SUBST([AVAHI_LIBS]) diff --git a/src/Makefile.am b/src/Makefile.am index b48ce65..8fbbabd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1529,14 +1529,8 @@ libvirt_net_rpc_server_la_SOURCES = \ rpc/virnetserverprogram.h rpc/virnetserverprogram.c \ rpc/virnetserverservice.h rpc/virnetserverservice.c \ rpc/virnetserverclient.h rpc/virnetserverclient.c \ + rpc/virnetservermdns.h rpc/virnetservermdns.c \ rpc/virnetserver.h rpc/virnetserver.c -if HAVE_AVAHI -libvirt_net_rpc_server_la_SOURCES += \ - rpc/virnetservermdns.h rpc/virnetservermdns.c -else -EXTRA_DIST += \ - rpc/virnetservermdns.h rpc/virnetservermdns.c -endif libvirt_net_rpc_server_la_CFLAGS = \ $(AVAHI_CFLAGS) \ $(XDR_CFLAGS) \ diff --git a/src/rpc/virnetservermdns.c b/src/rpc/virnetservermdns.c index 274be19..7c43c40 100644 --- a/src/rpc/virnetservermdns.c +++ b/src/rpc/virnetservermdns.c @@ -1,7 +1,7 @@ /* * virnetservermdns.c: advertise server sockets * - * Copyright (C) 2011 Red Hat, Inc. + * Copyright (C) 2011-2012 Red Hat, Inc. * Copyright (C) 2007 Daniel P. Berrange * * Derived from Avahi example service provider code. @@ -29,14 +29,16 @@ #include <stdio.h> #include <stdlib.h> -#include <avahi-client/client.h> -#include <avahi-client/publish.h> +#if HAVE_AVAHI +# include <avahi-client/client.h> +# include <avahi-client/publish.h> -#include <avahi-common/alternative.h> -#include <avahi-common/simple-watch.h> -#include <avahi-common/malloc.h> -#include <avahi-common/error.h> -#include <avahi-common/timeval.h> +# include <avahi-common/alternative.h> +# include <avahi-common/simple-watch.h> +# include <avahi-common/malloc.h> +# include <avahi-common/error.h> +# include <avahi-common/timeval.h> +#endif #include "virnetservermdns.h" #include "event.h" @@ -55,18 +57,23 @@ struct _virNetServerMDNSEntry { struct _virNetServerMDNSGroup { virNetServerMDNSPtr mdns; +#if HAVE_AVAHI AvahiEntryGroup *handle; +#endif char *name; virNetServerMDNSEntryPtr entry; virNetServerMDNSGroupPtr next; }; struct _virNetServerMDNS { +#if HAVE_AVAHI AvahiClient *client; AvahiPoll *poller; +#endif virNetServerMDNSGroupPtr group; }; +#if HAVE_AVAHI /* Avahi API requires this struct name in the app :-( */ struct AvahiWatch { int watch; @@ -612,3 +619,78 @@ void virNetServerMDNSEntryFree(virNetServerMDNSEntryPtr entry) VIR_FREE(entry->type); VIR_FREE(entry); } + +#else /* ! HAVE_AVAHI */ + +static const char *unsupported = N_("avahi not available at build time"); + +virNetServerMDNS * +virNetServerMDNSNew(void) +{ + VIR_DEBUG("%s", _(unsupported)); + return NULL; +} + +int +virNetServerMDNSStart(virNetServerMDNS *mdns ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); + return -1; +} + +virNetServerMDNSGroupPtr +virNetServerMDNSAddGroup(virNetServerMDNS *mdns ATTRIBUTE_UNUSED, + const char *name ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); + return NULL; +} + +void +virNetServerMDNSRemoveGroup(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED, + virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); +} + +virNetServerMDNSEntryPtr +virNetServerMDNSAddEntry(virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED, + const char *type ATTRIBUTE_UNUSED, + int port ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); + return NULL; +} + +void +virNetServerMDNSRemoveEntry(virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED, + virNetServerMDNSEntryPtr entry ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); +} + +void +virNetServerMDNSStop(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); +} + +void +virNetServerMDNSFree(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); +} + +void +virNetServerMDNSGroupFree(virNetServerMDNSGroupPtr grp ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); +} + +void +virNetServerMDNSEntryFree(virNetServerMDNSEntryPtr entry ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); +} + +#endif /* ! HAVE_AVAHI */ -- 1.7.11.2

On Wed, Aug 01, 2012 at 05:52:42PM -0600, Eric Blake wrote:
The recent changes to test exported symbols flushed out the fact that we were unconditionally linking against symbols that were only conditionally compiled under HAVE_AVAHI.
* src/Makefile.am (libvirt_net_rpc_server_la_SOURCES): Compile virnetservermdns unconditionally. * configure.ac (HAVE_AVAHI): Drop unused automake conditional. * src/rpc/virnetservermdns.c: Add fallbacks when Avahi is not present.
---
Definitely more involved than splitting out a separate .syms file, so I'm not sure whether this approach is better than the v1 approach. But I did promise to propose this alternative, so here it is. I tested both with and without avahi development libraries present.
configure.ac | 1 - src/Makefile.am | 8 +--- src/rpc/virnetservermdns.c | 98 ++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 91 insertions(+), 16 deletions(-)
Hmm, there should be a change to src/rpc/virnetserver.c to remove the avahi conditionals there I think. If everything still operates when avahi is disabled, then I think I prefer this patch, even though it is more complex, because it means the HAVE_AVAHI conditionals don't spread across the source tree to every user of this API. ACK
diff --git a/configure.ac b/configure.ac index 400ac3b..e93bbb5 100644 --- a/configure.ac +++ b/configure.ac @@ -1248,7 +1248,6 @@ if test "x$with_avahi" = "xyes" || test "x$with_avahi" = "xcheck"; then [whether Avahi is used to broadcast server presense]) fi fi -AM_CONDITIONAL([HAVE_AVAHI], [test "x$with_avahi" = "xyes"]) AC_SUBST([AVAHI_CFLAGS]) AC_SUBST([AVAHI_LIBS])
diff --git a/src/Makefile.am b/src/Makefile.am index b48ce65..8fbbabd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1529,14 +1529,8 @@ libvirt_net_rpc_server_la_SOURCES = \ rpc/virnetserverprogram.h rpc/virnetserverprogram.c \ rpc/virnetserverservice.h rpc/virnetserverservice.c \ rpc/virnetserverclient.h rpc/virnetserverclient.c \ + rpc/virnetservermdns.h rpc/virnetservermdns.c \ rpc/virnetserver.h rpc/virnetserver.c -if HAVE_AVAHI -libvirt_net_rpc_server_la_SOURCES += \ - rpc/virnetservermdns.h rpc/virnetservermdns.c -else -EXTRA_DIST += \ - rpc/virnetservermdns.h rpc/virnetservermdns.c -endif libvirt_net_rpc_server_la_CFLAGS = \ $(AVAHI_CFLAGS) \ $(XDR_CFLAGS) \ diff --git a/src/rpc/virnetservermdns.c b/src/rpc/virnetservermdns.c index 274be19..7c43c40 100644 --- a/src/rpc/virnetservermdns.c +++ b/src/rpc/virnetservermdns.c @@ -1,7 +1,7 @@ /* * virnetservermdns.c: advertise server sockets * - * Copyright (C) 2011 Red Hat, Inc. + * Copyright (C) 2011-2012 Red Hat, Inc. * Copyright (C) 2007 Daniel P. Berrange * * Derived from Avahi example service provider code. @@ -29,14 +29,16 @@ #include <stdio.h> #include <stdlib.h>
-#include <avahi-client/client.h> -#include <avahi-client/publish.h> +#if HAVE_AVAHI +# include <avahi-client/client.h> +# include <avahi-client/publish.h>
-#include <avahi-common/alternative.h> -#include <avahi-common/simple-watch.h> -#include <avahi-common/malloc.h> -#include <avahi-common/error.h> -#include <avahi-common/timeval.h> +# include <avahi-common/alternative.h> +# include <avahi-common/simple-watch.h> +# include <avahi-common/malloc.h> +# include <avahi-common/error.h> +# include <avahi-common/timeval.h> +#endif
#include "virnetservermdns.h" #include "event.h" @@ -55,18 +57,23 @@ struct _virNetServerMDNSEntry {
struct _virNetServerMDNSGroup { virNetServerMDNSPtr mdns; +#if HAVE_AVAHI AvahiEntryGroup *handle; +#endif char *name; virNetServerMDNSEntryPtr entry; virNetServerMDNSGroupPtr next; };
struct _virNetServerMDNS { +#if HAVE_AVAHI AvahiClient *client; AvahiPoll *poller; +#endif virNetServerMDNSGroupPtr group; };
+#if HAVE_AVAHI /* Avahi API requires this struct name in the app :-( */ struct AvahiWatch { int watch; @@ -612,3 +619,78 @@ void virNetServerMDNSEntryFree(virNetServerMDNSEntryPtr entry) VIR_FREE(entry->type); VIR_FREE(entry); } + +#else /* ! HAVE_AVAHI */ + +static const char *unsupported = N_("avahi not available at build time"); + +virNetServerMDNS * +virNetServerMDNSNew(void) +{ + VIR_DEBUG("%s", _(unsupported)); + return NULL; +} + +int +virNetServerMDNSStart(virNetServerMDNS *mdns ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); + return -1; +} + +virNetServerMDNSGroupPtr +virNetServerMDNSAddGroup(virNetServerMDNS *mdns ATTRIBUTE_UNUSED, + const char *name ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); + return NULL; +} + +void +virNetServerMDNSRemoveGroup(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED, + virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); +} + +virNetServerMDNSEntryPtr +virNetServerMDNSAddEntry(virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED, + const char *type ATTRIBUTE_UNUSED, + int port ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); + return NULL; +} + +void +virNetServerMDNSRemoveEntry(virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED, + virNetServerMDNSEntryPtr entry ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); +} + +void +virNetServerMDNSStop(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); +} + +void +virNetServerMDNSFree(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); +} + +void +virNetServerMDNSGroupFree(virNetServerMDNSGroupPtr grp ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); +} + +void +virNetServerMDNSEntryFree(virNetServerMDNSEntryPtr entry ATTRIBUTE_UNUSED) +{ + VIR_DEBUG("%s", _(unsupported)); +} + +#endif /* ! HAVE_AVAHI */ --
Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 08/02/2012 04:11 AM, Daniel P. Berrange wrote:
On Wed, Aug 01, 2012 at 05:52:42PM -0600, Eric Blake wrote:
The recent changes to test exported symbols flushed out the fact that we were unconditionally linking against symbols that were only conditionally compiled under HAVE_AVAHI.
* src/Makefile.am (libvirt_net_rpc_server_la_SOURCES): Compile virnetservermdns unconditionally. * configure.ac (HAVE_AVAHI): Drop unused automake conditional. * src/rpc/virnetservermdns.c: Add fallbacks when Avahi is not present.
---
Definitely more involved than splitting out a separate .syms file, so I'm not sure whether this approach is better than the v1 approach. But I did promise to propose this alternative, so here it is. I tested both with and without avahi development libraries present.
configure.ac | 1 - src/Makefile.am | 8 +--- src/rpc/virnetservermdns.c | 98 ++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 91 insertions(+), 16 deletions(-)
Hmm, there should be a change to src/rpc/virnetserver.c to remove the avahi conditionals there I think.
I will have to do that as a followup patch; this patch made creation of a new object always fail, but the virnetserver code assumes that if the object creation call exists, then it is usable. So it is not just a trivial removal of #ifdef HAVE_AVAHI, but some actual changes to the fallback code to be a useful no-op.
If everything still operates when avahi is disabled, then I think I prefer this patch, even though it is more complex, because it means the HAVE_AVAHI conditionals don't spread across the source tree to every user of this API.
ACK
I've gone ahead and pushed this, for build reasons, while working on the followup. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Daniel P. Berrange
-
Eric Blake
-
Jiri Denemark