[libvirt-users] Libvirt remote-client compilation for RHEL4

Daniel P. Berrange berrange at redhat.com
Thu Mar 7 16:29:41 UTC 2013


On Thu, Mar 07, 2013 at 01:05:22AM +0000, Saravanan Shanmugham (sarvi) wrote:
> I am using the following configure to minimize dependencies and avoid anything unrelated to getting a libvirt remote client going. Turned on —with-remote=yes, --with-python=yes —with-rhel5-api=yes
> 
> ./configure --with-python --with-apparmor=no --with-apparmor-mount=no --with-attr=no --with-audit=no --with-avahi=no --with-blkid=no --with-capng=no --with-curl=no --with-dbus=no --with-fuse=no --with-hal=no --with-netcf=no --with-numactl=no --with-openwsman=no --with-pciaccess=no --with-sanlock=no --with-sasl=no --with-selinux=no --with-selinux-mount=no --with-ssh2=no --with-udev=no --with-yajl=no --with-xen=no --with-xen-inotify=no --with-qemu=no --with-uml=no --with-openvz=no --with-vmware=no --with-phyp=no --with-xenapi=no --with-libxl=no --with-vbox=no --with-lxc=no --with-esx=no --with-hyperv=no --with-parallels=no --with-test=no --with-remote=yes --with-libvirtd=no --with-rhel5-api=yes --with-gnutls=no --with-polkit=no --with-firewalld=no --with-secdriver-selinux=no --with-secdriver-apparmor=no --with-dtrace=no --with-numad=no --with-network=no --with-secrets=no --with-storage-dir=no --with-storage-fs=no --with-storage-lvm=no --with-storage-iscsi=no --with-storage-scsi=no --with-storage-mpath=no --with-storage-disk=no --with-storage-rbd=no --with-storage-sheepdog=no --with-python=yes --with-interface=no --with-qemu-user=no --with-qemu-group=no --with-macvtap=no --with-virtualport=no
> 
> I am getting the following error/warnings.
>   CC     libvirt_util_la-virfile.lo
> In file included from util/virfile.c:36:
> /usr/include/linux/loop.h:31:2: #error "Wrong dev_t in loop.h"
> In file included from util/virfile.c:42:
> util/viralloc.h:67: warning: declaration of 'remove' shadows a global declaration
> /usr/include/stdio.h:154: warning: shadowed declaration is here
> make-3.79.1-p7[3]: *** [libvirt_util_la-virfile.lo] Error 1
> 
> I also found this thread relating to compiling clients for RHEL4 from 2011
> https://www.redhat.com/archives/libvirt-users/2011-January/msg00108.html

Attached is a patch which makes 1.0.3 compile on RHEL-4. Apply to a
fresh 1.0.3 libvirt codebase, and then run something like this:

  # ./configure --without-libvirtd  --without-python --without-numactl
                --without-vbox --prefix=/home/berrange/libvirt
                --localstatedir=/var --sysconfdir=/etc
  # make
  # make install


You could probably also pass --without-esx --without-parallels and
--without-vbox

I'll get this patch applied to GIT for the next release

Regards,
Daniel

diff -rup libvirt-1.0.3/src/driver.h libvirt-1.0.3.new/src/driver.h
--- libvirt-1.0.3/src/driver.h	2013-02-25 06:20:25.000000000 -0500
+++ libvirt-1.0.3.new/src/driver.h	2013-03-07 09:57:21.000000000 -0500
@@ -1443,7 +1443,7 @@ typedef char *
 typedef virStorageVolPtr
     (*virDrvStorageVolCreateXMLFrom)         (virStoragePoolPtr pool,
                                               const char *xmldesc,
-                                              virStorageVolPtr clone,
+                                              virStorageVolPtr clonefrom,
                                               unsigned int flags);
 typedef int
     (*virDrvStorageVolDownload) (virStorageVolPtr vol,
diff -rup libvirt-1.0.3/src/rpc/virnetclient.h libvirt-1.0.3.new/src/rpc/virnetclient.h
--- libvirt-1.0.3/src/rpc/virnetclient.h	2013-01-17 01:01:39.000000000 -0500
+++ libvirt-1.0.3.new/src/rpc/virnetclient.h	2013-03-07 10:07:48.000000000 -0500
@@ -37,7 +37,7 @@
 
 virNetClientPtr virNetClientNewUNIX(const char *path,
                                     bool spawnDaemon,
-                                    const char *daemon);
+                                    const char *binary);
 
 virNetClientPtr virNetClientNewTCP(const char *nodename,
                                    const char *service);
Only in libvirt-1.0.3.new/src/rpc: virnetclient.h~
diff -rup libvirt-1.0.3/src/util/viralloc.c libvirt-1.0.3.new/src/util/viralloc.c
--- libvirt-1.0.3/src/util/viralloc.c	2012-12-21 08:30:55.000000000 -0500
+++ libvirt-1.0.3.new/src/util/viralloc.c	2013-03-07 09:47:29.000000000 -0500
@@ -341,12 +341,12 @@ virInsertElementsN(void *ptrptr, size_t 
  */
 int
 virDeleteElementsN(void *ptrptr, size_t size, size_t at,
-                   size_t *countptr, size_t remove,
+                   size_t *countptr, size_t toremove,
                    bool inPlace)
 {
-    if (at + remove > *countptr) {
+    if (at + toremove > *countptr) {
         VIR_WARN("out of bounds index - count %zu at %zu remove %zu",
-                 *countptr, at, remove);
+                 *countptr, at, toremove);
         return -1;
     }
 
@@ -355,12 +355,12 @@ virDeleteElementsN(void *ptrptr, size_t 
      * already been cleared.
     */
     memmove(*(char**)ptrptr + (size * at),
-            *(char**)ptrptr + (size * (at + remove)),
-            size * (*countptr - remove - at));
+            *(char**)ptrptr + (size * (at + toremove)),
+            size * (*countptr - toremove - at));
     if (inPlace)
-        *countptr -= remove;
+        *countptr -= toremove;
     else
-        virShrinkN(ptrptr, size, countptr, remove);
+        virShrinkN(ptrptr, size, countptr, toremove);
     return 0;
 }
 
diff -rup libvirt-1.0.3/src/util/viralloc.h libvirt-1.0.3.new/src/util/viralloc.h
--- libvirt-1.0.3/src/util/viralloc.h	2013-02-25 06:20:25.000000000 -0500
+++ libvirt-1.0.3.new/src/util/viralloc.h	2013-03-07 09:47:09.000000000 -0500
@@ -64,7 +64,7 @@ int virInsertElementsN(void *ptrptr, siz
                        bool clearOriginal, bool inPlace)
     ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
 int virDeleteElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr,
-                       size_t remove, bool inPlace)
+                       size_t toremove, bool inPlace)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
 int virAllocVar(void *ptrptr,
                 size_t struct_size,
diff -rup libvirt-1.0.3/src/util/virfile.c libvirt-1.0.3.new/src/util/virfile.c
--- libvirt-1.0.3/src/util/virfile.c	2013-02-17 22:20:07.000000000 -0500
+++ libvirt-1.0.3.new/src/util/virfile.c	2013-03-07 09:53:25.000000000 -0500
@@ -32,7 +32,8 @@
 #include <unistd.h>
 #include <dirent.h>
 
-#ifdef __linux__
+#if defined(__linux__) && HAVE_DECL_LO_FLAGS_AUTOCLEAR
+# include <sys/types.h>
 # include <linux/loop.h>
 # include <sys/ioctl.h>
 #endif
diff -rup libvirt-1.0.3/src/util/virnetdevbridge.c libvirt-1.0.3.new/src/util/virnetdevbridge.c
--- libvirt-1.0.3/src/util/virnetdevbridge.c	2013-01-17 01:01:39.000000000 -0500
+++ libvirt-1.0.3.new/src/util/virnetdevbridge.c	2013-03-07 10:06:29.000000000 -0500
@@ -46,7 +46,7 @@
 #define VIR_FROM_THIS VIR_FROM_NONE
 
 
-#ifdef SIOCBRADDBR
+#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__)
 static int virNetDevSetupControlFull(const char *ifname,
                                      struct ifreq *ifr,
                                      int domain,
@@ -89,7 +89,7 @@ static int virNetDevSetupControl(const c
 }
 #endif
 
-#ifdef __linux__
+#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__)
 # define SYSFS_NET_DIR "/sys/class/net"
 /*
  * Bridge parameters can be set via sysfs on newish kernels,
@@ -211,7 +211,7 @@ cleanup:
  *
  * Returns 0 in case of success or -1 on failure
  */
-#ifdef SIOCBRADDBR
+#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDBR)
 int virNetDevBridgeCreate(const char *brname)
 {
     int fd = -1;
@@ -249,7 +249,7 @@ int virNetDevBridgeCreate(const char *br
  *
  * Returns 0 in case of success or an errno code in case of failure.
  */
-#ifdef SIOCBRDELBR
+#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELBR)
 int virNetDevBridgeDelete(const char *brname)
 {
     int fd = -1;
@@ -288,7 +288,7 @@ int virNetDevBridgeDelete(const char *br
  *
  * Returns 0 in case of success or an errno code in case of failure.
  */
-#ifdef SIOCBRADDIF
+#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDIF)
 int virNetDevBridgeAddPort(const char *brname,
                            const char *ifname)
 {
@@ -335,7 +335,7 @@ int virNetDevBridgeAddPort(const char *b
  *
  * Returns 0 in case of success or an errno code in case of failure.
  */
-#ifdef SIOCBRDELIF
+#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELIF)
 int virNetDevBridgeRemovePort(const char *brname,
                               const char *ifname)
 {
@@ -375,7 +375,7 @@ int virNetDevBridgeRemovePort(const char
 #endif
 
 
-#ifdef __linux__
+#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__)
 /**
  * virNetDevBridgeSetSTPDelay:
  * @brname: the bridge name
Only in libvirt-1.0.3.new/src/util: virnetdevbridge.c~
diff -rup libvirt-1.0.3/src/util/virnetdev.c libvirt-1.0.3.new/src/util/virnetdev.c
--- libvirt-1.0.3/src/util/virnetdev.c	2013-02-17 22:20:07.000000000 -0500
+++ libvirt-1.0.3.new/src/util/virnetdev.c	2013-03-07 10:04:54.000000000 -0500
@@ -673,6 +673,9 @@ int virNetDevGetIndex(const char *ifname
 
 
 #if defined(SIOCGIFVLAN) && defined(HAVE_STRUCT_IFREQ)
+# ifndef GET_VLAN_VID_CMD
+#  define GET_VLAN_VID_CMD 9
+# endif
 int virNetDevGetVLanID(const char *ifname, int *vlanid)
 {
     struct vlan_ioctl_args vlanargs = {
Only in libvirt-1.0.3.new/src/util: virnetdev.c~
diff -rup libvirt-1.0.3/tools/virsh-domain.c libvirt-1.0.3.new/tools/virsh-domain.c
--- libvirt-1.0.3/tools/virsh-domain.c	2013-02-25 06:20:25.000000000 -0500
+++ libvirt-1.0.3.new/tools/virsh-domain.c	2013-03-07 10:23:23.000000000 -0500
@@ -56,6 +56,13 @@
 #include "virtypedparam.h"
 #include "virxml.h"
 
+#ifndef xmlSaveToBuffer
+XMLPUBFUN xmlSaveCtxtPtr XMLCALL
+xmlSaveToBuffer         (xmlBufferPtr buffer,
+			 const char *encoding,
+			 int options);
+#endif
+
 /* Gnulib doesn't guarantee SA_SIGINFO support.  */
 #ifndef SA_SIGINFO
 # define SA_SIGINFO 0
Only in libvirt-1.0.3.new/tools: virsh-domain.c~


-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvirt-users mailing list