On Thu, Oct 04, 2007 at 04:39:30PM -0400, Gregory Haskins wrote:
> On Thu, 2007-10-04 at 21:49 +0200, Farkas Levente wrote:
> > 
> > here i mean that packaging kvm for fedora/redhat/centos using gcc-4.x in
> > stead of gcc-3.x. if currently there is no reason to use gcc-3.x than i
> > change all of my spec file.
> 
> You *could*, sure.  I have done this for local builds here.  But if you
> go that route I would recommend making a patch to KVM so it doesn't fall
> back into QEMU mode automatically (today if it can't open the kvm module
> it will assume "-no-kvm" like behavior).  Otherwise you will have a
> bunch of support calls about why its not working properly should someone
> cause the system to fall back.

And considering also there might be other yet unknown bugs because of gcc4, it
is most likely better to stick to use gcc-3.x, unless there is really no other
option.

For cases where no compat-gcc package is provided (like in OpenSUSE) then the
following is IMHO the next best approach to force users to get gcc-3.x
compiler installed from source just to be able to compile kvm.

Carlo

PS. please let me know what you think about it and if interested so I can
provide the 3 patches (or more if more changes are needed) in a [PATCH] 
series for easy git-am'ing

---
diff --git a/configure b/configure
index d9292fe..33a56d2 100755
--- a/configure
+++ b/configure
@@ -63,8 +63,12 @@ while [[ "$1" = -* ]]; do
 done
 
 if [[ -z "$qemu_cc" ]]; then
-    echo "$0: cannot locate gcc 3.x. please install it or specify with 
--qemu-cc"
-    exit 1
+    if [[ -z "$disable_gcc_check" ]]; then
+        echo "$0: cannot locate gcc 3.x. please install it or specify with 
--qemu-cc"
+        exit 1
+    else
+        qemu_cc=gcc
+    fi
 fi
 
 libkvm_kerneldir="$kerneldir"
diff --git a/qemu/configure b/qemu/configure
index fc1e59a..15549e3 100755
--- a/qemu/configure
+++ b/qemu/configure
@@ -1022,6 +1022,11 @@ if test "$target_cpu" = "i386" ; then
   if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
     echo "#define USE_KQEMU 1" >> $config_h
   fi
+  if test $check_gcc = "no" ; then
+    if gcc -v 2>&1 | grep -q 'gcc *version *4\.[0-3]\.[0-9]'; then
+      echo "#define USE_GCC4 1" >> $config_h
+    fi
+  fi
   configure_kvm
 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
   echo "TARGET_ARCH=arm" >> $config_mak
@@ -1059,6 +1064,11 @@ elif test "$target_cpu" = "x86_64" ; then
   if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; 
then
     echo "#define USE_KQEMU 1" >> $config_h
   fi
+  if test $check_gcc = "no" ; then
+    if gcc -v 2>&1 | grep -q 'gcc *version *4\.[0-3]\.[0-9]'; then
+      echo "#define USE_GCC4 1" >> $config_h
+    fi
+  fi
   configure_kvm
 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
   echo "TARGET_ARCH=mips" >> $config_mak
diff --git a/qemu/vl.c b/qemu/vl.c
index fe49d2c..2f78955 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -8421,8 +8421,13 @@ int main(int argc, char **argv)
 #endif
 #ifdef USE_KVM
            case QEMU_OPTION_no_kvm:
+#ifdef USE_GCC4
+               fprintf(stderr, "Can't run without kvm if compiled with 
gcc4\n");
+               exit(1);
+#else
                kvm_allowed = 0;
                break;
+#endif
            case QEMU_OPTION_no_kvm_irqchip:
                kvm_irqchip = 0;
                break;
@@ -8552,8 +8557,13 @@ int main(int argc, char **argv)
 #if USE_KVM
     if (kvm_allowed) {
        if (kvm_qemu_init() < 0) {
+#if USE_GCC4
+           fprintf(stderr, "Could not initialize KVM, can't run without kvm if 
compiled with gcc4\n");
+           exit(1);
+#else
            fprintf(stderr, "Could not initialize KVM, will disable KVM 
support\n");
            kvm_allowed = 0;
+#endif
        }
     }
 #endif

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to