[libvirt] [PATCH] rpc: Fix VPATH building issue

Guannan Ren gren at redhat.com
Tue Mar 6 17:07:47 UTC 2012


     The XDR routine .c file generated by rpcgen includes the corresponding
   Header file. however, the path in include directive of the header file
   is picked up based on the path of .x file. In the situation of VPATH Builds
   it will include full path of the header file rather than relative path. Hence,
   the error happens when compiling time

   For example: The libvirt source code resides in /home/testuser,
                I make dist in /tmp/buildvpath, the XDR routine .c file will
                include full path of the header file like:

                #include "/home/testuser/src/rpc/virnetprotocol.h"
                #include "internal.h"
                #include <arpa/inet.h>

   If we distribute the tarball to another machine to compile,
   it will report error as follows:

   rpc/virnetprotocol.c:7:59: fatal error:
   /home/testuser/src/rpc/virnetprotocol.h: No such file or directory
---
 src/Makefile.am |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index e57eca2..6c9f598 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -662,12 +662,18 @@ $(srcdir)/remote/remote_driver.c: $(REMOTE_DRIVER_GENERATED)
 endif WITH_REMOTE
 
 %protocol.c: %protocol.x %protocol.h $(srcdir)/rpc/genprotocol.pl
-	$(AM_V_GEN)perl -w $(srcdir)/rpc/genprotocol.pl $(RPCGEN) -c \
-	       $< $@
+	$(AM_V_GEN)protocolx='$<'; \
+	protocolc='$@'; \
+	cd $(srcdir); \
+	perl -w $(srcdir)/rpc/genprotocol.pl $(RPCGEN) -c \
+		$${protocolx/'$(srcdir)/'/''} $${protocolc/'$(srcdir)/'/''}
 
 %protocol.h: %protocol.x $(srcdir)/rpc/genprotocol.pl
-	$(AM_V_GEN)perl -w $(srcdir)/rpc/genprotocol.pl $(RPCGEN) -h \
-	       $< $@
+	$(AM_V_GEN)protocolx='$<'; \
+	protocolh='$@'; \
+	cd $(srcdir); \
+	perl -w $(srcdir)/rpc/genprotocol.pl $(RPCGEN) -h \
+		$${protocolx/'$(srcdir)/'/''} $${protocolh/'$(srcdir)/'/''}
 
 if WITH_XEN
 if WITH_DRIVER_MODULES
-- 
1.7.7.5




More information about the libvir-list mailing list