From 29d753c8d5965939ee5a530d0cf998223228d42e Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 10 May 2011 17:42:06 +0200 Subject: [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 when 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 62c056030f..71c496883c 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 ]) - dnl Cygwin requires -I/usr/include/tirpc for + dnl Cygwin/recent glibc requires -I/usr/include/tirpc for old_CFLAGS=$CFLAGS AC_CACHE_CHECK([where to find ], [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 f734c890c5..2095c1c230 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -87,7 +87,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)\"" \