[Libguestfs] [PATCH] build: Reference RPC_CFLAGS where needed

Martin Kletzander mkletzan at redhat.com
Sat Nov 18 18:44:02 UTC 2017


Since glibc-2.26 removed the /usr/include/rpc/rpc.h, it caused problem even
though probing for libtirpc has taken place and worked properly.  The problem is
that RPC_CFLAGS (usually `-I/usr/include/tirpc` on Linux) was not used in places
where it was needed.  So the build failed with messages like the following:

In file included from guestfs_protocol.c:6:0:
guestfs_protocol.h:9:10: fatal error: rpc/rpc.h: No such file or directory
 #include <rpc/rpc.h>
          ^~~~~~~~~~~

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---

Notes:
    Using $(RPC_CFLAGS) in places where needed fixes the issue and libguestfs
    compiles cleanly with glibc-2.26 for me.  Disclaimer: I wasn't able to build
    with everything enabled, so there might be some more build sources that need
    this, but I haven't found them.

 common/protocol/Makefile.am | 3 ++-
 fish/Makefile.am            | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/protocol/Makefile.am b/common/protocol/Makefile.am
index cfac2d8d375f..778758209d4c 100644
--- a/common/protocol/Makefile.am
+++ b/common/protocol/Makefile.am
@@ -34,7 +34,8 @@ noinst_LTLIBRARIES = libprotocol.la
 # warnings here.
 libprotocol_la_SOURCES = guestfs_protocol.c  guestfs_protocol.h
 libprotocol_la_CFLAGS = \
-	-Wall -Wno-unused -fno-strict-aliasing $(GCC_VISIBILITY_HIDDEN)
+	-Wall -Wno-unused -fno-strict-aliasing $(GCC_VISIBILITY_HIDDEN) \
+  $(RPC_CFLAGS)
 
 if HAVE_RPCGEN
 
diff --git a/fish/Makefile.am b/fish/Makefile.am
index a6efbb43966c..8623e8ecae72 100644
--- a/fish/Makefile.am
+++ b/fish/Makefile.am
@@ -101,7 +101,7 @@ guestfish_SOURCES = \
 # This convenience library is solely to compile its generated sources with
 # custom flags.
 librc_protocol_la_SOURCES = rc_protocol.c rc_protocol.h
-librc_protocol_la_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing
+librc_protocol_la_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing $(RPC_CFLAGS)
 
 # Build the command lookup perfect hash code.  The generated code has
 # lots of warnings so we must compile it in a separate mini-library.
-- 
2.15.0




More information about the Libguestfs mailing list