[libvirt] [PATCH v2] virtlogd: Fix build without DBus

Daniel P. Berrange berrange at redhat.com
Fri Nov 27 14:00:22 UTC 2015


On Fri, Nov 27, 2015 at 02:05:11PM +0100, Martin Kletzander wrote:
> The rule for virrotatingfiletest was defined in DBUS-only block even
> though the test does not use DBus at all.  Also DBUS_CFLAGS and
> DBUS_LIBS are removed from the rules.  The original error was:
> 
> /usr/lib/gcc/x86_64-pc-linux-gnu/5.2.0/../../../../lib64/Scrt1.o: In
> function `_start':
> (.text+0x20): undefined reference to `main'

Ah, so what was happening is that because it was inclusde WITH_DBUS,
no rules were setup, so the built-in make rule for C files was
just trying todo  'gcc -o virrotatingfiletest virrotatingfiletest.c'
and so not linking in testutils.c, hence missing the 'main' method.

> 
> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> ---
>  tests/Makefile.am | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index b449286f1fb3..e1e28eca93f1 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -1062,6 +1062,11 @@ virnetdevmock_la_LIBADD = $(GNULIB_LIBS) \
>  					   ../src/libvirt.la
>  virnetdevmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
> 
> +virrotatingfiletest_SOURCES = \
> +	virrotatingfiletest.c testutils.h testutils.c
> +virrotatingfiletest_CFLAGS = $(AM_CFLAGS)
> +virrotatingfiletest_LDADD = $(LDADDS)
> +
>  if WITH_LINUX
>  virusbtest_SOURCES = \
>  	virusbtest.c testutils.h testutils.c
> @@ -1101,11 +1106,6 @@ virpolkittest_SOURCES = \
>  virpolkittest_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
>  virpolkittest_LDADD = $(LDADDS) $(DBUS_LIBS)
> 
> -virrotatingfiletest_SOURCES = \
> -	virrotatingfiletest.c testutils.h testutils.c
> -virrotatingfiletest_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
> -virrotatingfiletest_LDADD = $(LDADDS) $(DBUS_LIBS)
> -
>  virsystemdtest_SOURCES = \
>  	virsystemdtest.c testutils.h testutils.c
>  virsystemdtest_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)

ACK

Regards,
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 :|




More information about the libvir-list mailing list