[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] fix xdr detection and use with recent glibc



glibc 2.13.90 has obsoleted its rpc implementation in favour of
the one provided by the TI-RPC library:

> * The RPC implementation in libc is obsoleted.  Old programs keep working
>   but new programs cannot be linked with the routines in libc anymore.
>   Programs in need of RPC functionality must be linked against TI-RPC.
>   The TI-RPC implemtation is IPv6 enabled and there are other benefits.
>
>   Visible changes of this change include (obviously) the inability to
>   link
>   programs using RPC functions without referencing the TI-RPC library,
>   the
>   removal of the RPC headers from the glibc headers, and the lack of
>   symbols defined in <rpc/netdb.h> when <netdb.h> is installed.
>   Implemented by Ulrich Drepper.
(from glibc NEWS)

Thus with recent glibc, we need to try linking with -ltirpc when looking
for the XDR functions. The daemon also needs to use XDR_CFLAGS to be able
to find the XDR headers stored in /usr/include/tirpc.

When using TI-RPC, there are some warnings about redundant declarations, but
the fix probably belongs in other modules:

/usr/include/tirpc/rpc/rpcent.h:68:13: warning: redundant redeclaration of
'setrpcent' [-Wredundant-decls]
/usr/include/rpc/netdb.h:53:13: note: previous declaration of 'setrpcent'
was here

/usr/include/tirpc/rpc/rpcent.h:69:13: warning: redundant redeclaration of
'endrpcent' [-Wredundant-decls]
/usr/include/rpc/netdb.h:54:13: note: previous declaration of 'endrpcent'
was here

/usr/include/tirpc/rpc/rpc.h:84:12: warning: redundant redeclaration of
'bindresvport' [-Wredundant-decls]
/usr/include/netinet/in.h:440:12: note: previous declaration of
'bindresvport' was here
---
 configure.ac       |    6 +++---
 daemon/Makefile.am |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index dcec371..db1c0e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -366,16 +366,16 @@ if test x"$with_remote" = x"yes" || test x"$with_libvirtd" = x"yes"; then
     dnl Where are the XDR functions?
     dnl If portablexdr is installed, prefer that.
     dnl Otherwise try -lrpc (Cygwin) -lxdr (some MinGW), -lnsl (Solaris)
-    dnl or none (most Unix)
+    dnl -ltirpc (glibc 2.13.90 or newer) or none (most Unix)
     AC_CHECK_LIB([portablexdr],[xdrmem_create],[],[
-        AC_SEARCH_LIBS([xdrmem_create],[rpc xdr nsl],[],
+        AC_SEARCH_LIBS([xdrmem_create],[rpc xdr nsl tirpc],[],
             [AC_MSG_ERROR([Cannot find a XDR library])])
         ])
 
     dnl check for cygwin's variation in xdr function names
     AC_CHECK_FUNCS([xdr_u_int64_t],[],[],[#include <rpc/xdr.h>])
 
-    dnl Cygwin requires -I/usr/include/tirpc for <rpc/rpc.h>
+    dnl Cygwin/recent glibc requires -I/usr/include/tirpc for <rpc/rpc.h>
     old_CFLAGS=$CFLAGS
     AC_CACHE_CHECK([where to find <rpc/rpc.h>], [lv_cv_xdr_cflags], [
       for add_CFLAGS in '' '-I/usr/include/tirpc' 'missing'; do
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index af71188..ef1804b 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -80,7 +80,7 @@ libvirtd_CFLAGS = \
 	-I$(top_srcdir)/src/conf \
 	-I$(top_srcdir)/src/remote \
 	$(LIBXML_CFLAGS) $(GNUTLS_CFLAGS) $(SASL_CFLAGS) \
-	$(POLKIT_CFLAGS) \
+	$(XDR_CFLAGS) $(POLKIT_CFLAGS) \
 	$(WARN_CFLAGS) \
 	$(COVERAGE_CFLAGS) \
 	-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\"" \
-- 
1.7.5.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]