[libvirt] [PATCH 1/3] tests: Tweak cputest_LDADDS

Andrea Bolognani posted 3 patches 6 years, 8 months ago
[libvirt] [PATCH 1/3] tests: Tweak cputest_LDADDS
Posted by Andrea Bolognani 6 years, 8 months ago
We want have all test programs using qemu_LDADDS also use LDADDS,
and cputest is the only existing exception.

We can't just replace GNULIB_LIBS with LDADDS though, even though
the latter is a superset of the former, because that would result
in a linking error due to including the same object twice:

  /usr/bin/ld:
  ../src/libvirt_probes.o:.../src/libvirt_probes.o.dtrace-temp.c:141:
  multiple definition of `libvirt_object_new_semaphore';
  ../src/libvirt_probes.o:.../src/libvirt_probes.o.dtrace-temp.c:141:
  first defined here

To work around this, we include both qemu_LDADDS and LDADDS when
QEMU support is enabled, and just LDADDS otherwise.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 tests/Makefile.am | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6b17d99501..c34cfba34c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -962,11 +962,13 @@ interfacexml2xmltest_LDADD = $(LDADDS)
 cputest_SOURCES = \
 	cputest.c \
 	testutils.c testutils.h
-cputest_LDADD = $(LDADDS) $(LIBXML_LIBS)
+cputest_LDADD = $(LIBXML_LIBS)
 if WITH_QEMU
 cputest_SOURCES += testutilsqemu.c testutilsqemu.h
-cputest_LDADD += libqemumonitortestutils.la $(qemu_LDADDS) $(GNULIB_LIBS)
-endif WITH_QEMU
+cputest_LDADD += libqemumonitortestutils.la $(qemu_LDADDS) $(LDADDS)
+else ! WITH_QEMU
+cputest_LDADD += $(LDADDS)
+endif ! WITH_QEMU
 
 metadatatest_SOURCES = \
 	metadatatest.c \
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] tests: Tweak cputest_LDADDS
Posted by Jim Fehlig 6 years, 8 months ago
On 6/12/19 5:19 AM, Andrea Bolognani wrote:
> We want have all test programs using qemu_LDADDS also use LDADDS,

This part of the sentence seems awkward. How about "We want all test programs 
using qemu_LDADDS to also use LDADDS," ?

> and cputest is the only existing exception.
> 
> We can't just replace GNULIB_LIBS with LDADDS though, even though
> the latter is a superset of the former, because that would result
> in a linking error due to including the same object twice:
> 
>    /usr/bin/ld:
>    ../src/libvirt_probes.o:.../src/libvirt_probes.o.dtrace-temp.c:141:
>    multiple definition of `libvirt_object_new_semaphore';
>    ../src/libvirt_probes.o:.../src/libvirt_probes.o.dtrace-temp.c:141:
>    first defined here
> 
> To work around this, we include both qemu_LDADDS and LDADDS when
> QEMU support is enabled, and just LDADDS otherwise.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>   tests/Makefile.am | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 6b17d99501..c34cfba34c 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -962,11 +962,13 @@ interfacexml2xmltest_LDADD = $(LDADDS)
>   cputest_SOURCES = \
>   	cputest.c \
>   	testutils.c testutils.h
> -cputest_LDADD = $(LDADDS) $(LIBXML_LIBS)
> +cputest_LDADD = $(LIBXML_LIBS)
>   if WITH_QEMU
>   cputest_SOURCES += testutilsqemu.c testutilsqemu.h
> -cputest_LDADD += libqemumonitortestutils.la $(qemu_LDADDS) $(GNULIB_LIBS)
> -endif WITH_QEMU
> +cputest_LDADD += libqemumonitortestutils.la $(qemu_LDADDS) $(LDADDS)
> +else ! WITH_QEMU
> +cputest_LDADD += $(LDADDS)
> +endif ! WITH_QEMU
>   
>   metadatatest_SOURCES = \
>   	metadatatest.c \
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list