[libvirt] [PATCH] Fix link errors in tools/nss and tests

Jim Fehlig posted 1 patch 5 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180808170001.17225-1-jfehlig@suse.com
Test syntax-check passed
tools/Makefile.am | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[libvirt] [PATCH] Fix link errors in tools/nss and tests
Posted by Jim Fehlig 5 years, 8 months ago
While local builds succeed fine, a build worker building in a chroot
environment is encountering errors when linking some items in tools/nss
and tests, e.g.

[  469s] libtool: link: gcc -shared  -fPIC -DPIC  -Wl,--whole-archive nss/.libs/libnss_libvirt_impl.a -Wl,--no-whole-archive  -lpthread -lutil -ltirpc  -fstack-protector-strong -grecord-gcc-switches -O2 -fstack-protector-strong -g -Wl,--version-script=./nss/libvirt_nss.syms -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,--no-copy-dt-needed-entries -Wl,-z -Wl,defs -grecord-gcc-switches -O2 -fstack-protector-strong -g   -pthread -Wl,-soname -Wl,libnss_libvirt.so.2 -o nss/.libs/libnss_libvirt.so.2
[  469s] nss/.libs/libnss_libvirt_impl.a(libvirt_nss_la-virjsoncompat.o): In function `virJSONJanssonOnce':
[  469s] /home/abuild/rpmbuild/BUILD/libvirt-4.6.0/src/util/virjsoncompat.c:63: undefined reference to `dlopen'
[  469s] /home/abuild/rpmbuild/BUILD/libvirt-4.6.0/src/util/virjsoncompat.c:79: undefined reference to `dlsym'
...

A similar problem was fixed in commit b018ada3 and inspires this fix.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
 tools/Makefile.am | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/Makefile.am b/tools/Makefile.am
index 1452d984a0..26c887649e 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -527,7 +527,8 @@ nss_libnss_libvirt_impl_la_CFLAGS = \
 
 nss_libnss_libvirt_impl_la_LIBADD = \
 	../gnulib/lib/libgnu.la \
-	../src/libvirt-nss.la
+	../src/libvirt-nss.la \
+	$(DLOPEN_LIBS)
 
 nss_libnss_libvirt_la_SOURCES =
 nss_libnss_libvirt_la_LDFLAGS = \
@@ -554,7 +555,8 @@ nss_libnss_libvirt_guest_impl_la_CFLAGS = \
 
 nss_libnss_libvirt_guest_impl_la_LIBADD = \
 	../gnulib/lib/libgnu.la \
-	../src/libvirt-nss.la
+	../src/libvirt-nss.la \
+	$(DLOPEN_LIBS)
 
 nss_libnss_libvirt_guest_la_SOURCES =
 nss_libnss_libvirt_guest_la_LDFLAGS = \
-- 
2.18.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix link errors in tools/nss and tests
Posted by Daniel P. Berrangé 5 years, 8 months ago
On Wed, Aug 08, 2018 at 11:00:01AM -0600, Jim Fehlig wrote:
> While local builds succeed fine, a build worker building in a chroot
> environment is encountering errors when linking some items in tools/nss
> and tests, e.g.
> 
> [  469s] libtool: link: gcc -shared  -fPIC -DPIC  -Wl,--whole-archive nss/.libs/libnss_libvirt_impl.a -Wl,--no-whole-archive  -lpthread -lutil -ltirpc  -fstack-protector-strong -grecord-gcc-switches -O2 -fstack-protector-strong -g -Wl,--version-script=./nss/libvirt_nss.syms -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,--no-copy-dt-needed-entries -Wl,-z -Wl,defs -grecord-gcc-switches -O2 -fstack-protector-strong -g   -pthread -Wl,-soname -Wl,libnss_libvirt.so.2 -o nss/.libs/libnss_libvirt.so.2
> [  469s] nss/.libs/libnss_libvirt_impl.a(libvirt_nss_la-virjsoncompat.o): In function `virJSONJanssonOnce':
> [  469s] /home/abuild/rpmbuild/BUILD/libvirt-4.6.0/src/util/virjsoncompat.c:63: undefined reference to `dlopen'
> [  469s] /home/abuild/rpmbuild/BUILD/libvirt-4.6.0/src/util/virjsoncompat.c:79: undefined reference to `dlsym'
> ...
> 
> A similar problem was fixed in commit b018ada3 and inspires this fix.
> 
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix link errors in tools/nss and tests
Posted by Michal Privoznik 5 years, 8 months ago
On 08/08/2018 07:00 PM, Jim Fehlig wrote:
> While local builds succeed fine, a build worker building in a chroot
> environment is encountering errors when linking some items in tools/nss
> and tests, e.g.
> 
> [  469s] libtool: link: gcc -shared  -fPIC -DPIC  -Wl,--whole-archive nss/.libs/libnss_libvirt_impl.a -Wl,--no-whole-archive  -lpthread -lutil -ltirpc  -fstack-protector-strong -grecord-gcc-switches -O2 -fstack-protector-strong -g -Wl,--version-script=./nss/libvirt_nss.syms -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,--no-copy-dt-needed-entries -Wl,-z -Wl,defs -grecord-gcc-switches -O2 -fstack-protector-strong -g   -pthread -Wl,-soname -Wl,libnss_libvirt.so.2 -o nss/.libs/libnss_libvirt.so.2
> [  469s] nss/.libs/libnss_libvirt_impl.a(libvirt_nss_la-virjsoncompat.o): In function `virJSONJanssonOnce':
> [  469s] /home/abuild/rpmbuild/BUILD/libvirt-4.6.0/src/util/virjsoncompat.c:63: undefined reference to `dlopen'
> [  469s] /home/abuild/rpmbuild/BUILD/libvirt-4.6.0/src/util/virjsoncompat.c:79: undefined reference to `dlsym'
> ...
> 
> A similar problem was fixed in commit b018ada3 and inspires this fix.
> 
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
>  tools/Makefile.am | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/Makefile.am b/tools/Makefile.am
> index 1452d984a0..26c887649e 100644
> --- a/tools/Makefile.am
> +++ b/tools/Makefile.am
> @@ -527,7 +527,8 @@ nss_libnss_libvirt_impl_la_CFLAGS = \
>  
>  nss_libnss_libvirt_impl_la_LIBADD = \
>  	../gnulib/lib/libgnu.la \
> -	../src/libvirt-nss.la
> +	../src/libvirt-nss.la \
> +	$(DLOPEN_LIBS)
>  
>  nss_libnss_libvirt_la_SOURCES =
>  nss_libnss_libvirt_la_LDFLAGS = \
> @@ -554,7 +555,8 @@ nss_libnss_libvirt_guest_impl_la_CFLAGS = \
>  
>  nss_libnss_libvirt_guest_impl_la_LIBADD = \
>  	../gnulib/lib/libgnu.la \
> -	../src/libvirt-nss.la
> +	../src/libvirt-nss.la \
> +	$(DLOPEN_LIBS)
>  
>  nss_libnss_libvirt_guest_la_SOURCES =
>  nss_libnss_libvirt_guest_la_LDFLAGS = \
> 

While I agree that we need to put DLOPEN_LIBS somewhere shouldn't be
that the lib that compiles virjsoncompat.c in? I mean, that is the
source of the dependency and therefore anything linking with it will
need similar treatment. Something among these lines (quickly written and
untested patch):


diff --git i/src/Makefile.am w/src/Makefile.am
index a4f213480e..51c134f08e 100644
--- i/src/Makefile.am
+++ w/src/Makefile.am
@@ -744,6 +744,7 @@ libvirt_setuid_rpc_client_la_LDFLAGS = \
                $(AM_LDFLAGS) \
                $(LIBXML_LIBS) \
                $(SECDRIVER_LIBS) \
+               $(DLOPEN_LIBS) \
                $(NULL)
 libvirt_setuid_rpc_client_la_CFLAGS = \
                -DLIBVIRT_SETUID_RPC_CLIENT \
@@ -1000,6 +1001,7 @@ libvirt_nss_la_CFLAGS = \
                $(NULL)
 libvirt_nss_la_LDFLAGS = \
                $(AM_LDFLAGS) \
+               $(DLOPEN_LIBS) \
                $(NULL)
 endif WITH_NSS

diff --git i/src/util/Makefile.inc.am w/src/util/Makefile.inc.am
index 8ef9ee1dfa..c5c50f1844 100644
--- i/src/util/Makefile.inc.am
+++ w/src/util/Makefile.inc.am
@@ -278,6 +278,7 @@ libvirt_util_la_LIBADD = \
        $(NUMACTL_LIBS) \
        $(ACL_LIBS) \
        $(GNUTLS_LIBS) \
+       $(DLOPEN_LIBS) \
        $(NULL)



Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix link errors in tools/nss and tests
Posted by Jim Fehlig 5 years, 8 months ago
On 08/09/2018 07:42 AM, Michal Privoznik wrote:
> On 08/08/2018 07:00 PM, Jim Fehlig wrote:
>> While local builds succeed fine, a build worker building in a chroot
>> environment is encountering errors when linking some items in tools/nss
>> and tests, e.g.
>>
>> [  469s] libtool: link: gcc -shared  -fPIC -DPIC  -Wl,--whole-archive nss/.libs/libnss_libvirt_impl.a -Wl,--no-whole-archive  -lpthread -lutil -ltirpc  -fstack-protector-strong -grecord-gcc-switches -O2 -fstack-protector-strong -g -Wl,--version-script=./nss/libvirt_nss.syms -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,--no-copy-dt-needed-entries -Wl,-z -Wl,defs -grecord-gcc-switches -O2 -fstack-protector-strong -g   -pthread -Wl,-soname -Wl,libnss_libvirt.so.2 -o nss/.libs/libnss_libvirt.so.2
>> [  469s] nss/.libs/libnss_libvirt_impl.a(libvirt_nss_la-virjsoncompat.o): In function `virJSONJanssonOnce':
>> [  469s] /home/abuild/rpmbuild/BUILD/libvirt-4.6.0/src/util/virjsoncompat.c:63: undefined reference to `dlopen'
>> [  469s] /home/abuild/rpmbuild/BUILD/libvirt-4.6.0/src/util/virjsoncompat.c:79: undefined reference to `dlsym'
>> ...
>>
>> A similar problem was fixed in commit b018ada3 and inspires this fix.
>>
>> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
>> ---
>>   tools/Makefile.am | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/Makefile.am b/tools/Makefile.am
>> index 1452d984a0..26c887649e 100644
>> --- a/tools/Makefile.am
>> +++ b/tools/Makefile.am
>> @@ -527,7 +527,8 @@ nss_libnss_libvirt_impl_la_CFLAGS = \
>>   
>>   nss_libnss_libvirt_impl_la_LIBADD = \
>>   	../gnulib/lib/libgnu.la \
>> -	../src/libvirt-nss.la
>> +	../src/libvirt-nss.la \
>> +	$(DLOPEN_LIBS)
>>   
>>   nss_libnss_libvirt_la_SOURCES =
>>   nss_libnss_libvirt_la_LDFLAGS = \
>> @@ -554,7 +555,8 @@ nss_libnss_libvirt_guest_impl_la_CFLAGS = \
>>   
>>   nss_libnss_libvirt_guest_impl_la_LIBADD = \
>>   	../gnulib/lib/libgnu.la \
>> -	../src/libvirt-nss.la
>> +	../src/libvirt-nss.la \
>> +	$(DLOPEN_LIBS)
>>   
>>   nss_libnss_libvirt_guest_la_SOURCES =
>>   nss_libnss_libvirt_guest_la_LDFLAGS = \
>>
> 
> While I agree that we need to put DLOPEN_LIBS somewhere shouldn't be
> that the lib that compiles virjsoncompat.c in?

Yes, you are right.

> I mean, that is the
> source of the dependency and therefore anything linking with it will
> need similar treatment. Something among these lines (quickly written and
> untested patch):
> 
> 
> diff --git i/src/Makefile.am w/src/Makefile.am
> index a4f213480e..51c134f08e 100644
> --- i/src/Makefile.am
> +++ w/src/Makefile.am
> @@ -744,6 +744,7 @@ libvirt_setuid_rpc_client_la_LDFLAGS = \
>                  $(AM_LDFLAGS) \
>                  $(LIBXML_LIBS) \
>                  $(SECDRIVER_LIBS) \
> +               $(DLOPEN_LIBS) \
>                  $(NULL)
>   libvirt_setuid_rpc_client_la_CFLAGS = \
>                  -DLIBVIRT_SETUID_RPC_CLIENT \
> @@ -1000,6 +1001,7 @@ libvirt_nss_la_CFLAGS = \
>                  $(NULL)
>   libvirt_nss_la_LDFLAGS = \
>                  $(AM_LDFLAGS) \
> +               $(DLOPEN_LIBS) \
>                  $(NULL)
>   endif WITH_NSS
> 
> diff --git i/src/util/Makefile.inc.am w/src/util/Makefile.inc.am
> index 8ef9ee1dfa..c5c50f1844 100644
> --- i/src/util/Makefile.inc.am
> +++ w/src/util/Makefile.inc.am
> @@ -278,6 +278,7 @@ libvirt_util_la_LIBADD = \
>          $(NUMACTL_LIBS) \
>          $(ACL_LIBS) \
>          $(GNUTLS_LIBS) \
> +       $(DLOPEN_LIBS) \
>          $(NULL)

I tested the patch, works fine. What is the best course of action since I pushed 
the other one? Revert it and push your patch?

Regards,
Jim

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix link errors in tools/nss and tests
Posted by Michal Privoznik 5 years, 8 months ago
On 08/09/2018 07:15 PM, Jim Fehlig wrote:

> 
> I tested the patch, works fine. What is the best course of action since
> I pushed the other one? Revert it and push your patch?

No need to revert. I'll send a patch that moves DLOPEN_* where I suggested.

Michal

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