All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carlo Marcelo Arenas Belon <carenas-kLeDWSohozoJb6fo7hG9ng@public.gmane.org>
To: Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel
	<kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	Discussion about the virtualization on CentOS
	<centos-virt-IFYaIzF+flcdnm+yROfE0A@public.gmane.org>
Subject: [RFC] let kvm be compiled with gcc4 and prevent users to shoot themselves in the foot while doing so (was Re: [ kvm-Bugs-1807620 ]	KVM's	--disable-gcc-check	doesn't work)
Date: Sun, 7 Oct 2007 16:20:55 -0500	[thread overview]
Message-ID: <20071007212054.GA26380@tapir> (raw)
In-Reply-To: <1191530370.5019.108.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>

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/

  parent reply	other threads:[~2007-10-07 21:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-04 16:25 [ kvm-Bugs-1807620 ] KVM's --disable-gcc-check doesn't work SourceForge.net
     [not found] ` <E1IdTWB-0003Uo-Dv-fsxqSYOXIJgGKePtCzJsP6QD96bmaF075NbjCUgZEJk@public.gmane.org>
2007-10-04 16:33   ` Farkas Levente
     [not found]     ` <470515DA.9080606-lWVWdrzSO4GHXe+LvDLADg@public.gmane.org>
2007-10-04 16:54       ` Gregory Haskins
     [not found]         ` <1191516896.5019.83.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-10-04 17:27           ` Farkas Levente
     [not found]             ` <47052269.80501-lWVWdrzSO4GHXe+LvDLADg@public.gmane.org>
2007-10-04 17:42               ` Gregory Haskins
     [not found]                 ` <1191519749.5019.99.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-10-04 19:49                   ` Farkas Levente
     [not found]                     ` <470543AC.50901-lWVWdrzSO4GHXe+LvDLADg@public.gmane.org>
2007-10-04 20:39                       ` Gregory Haskins
     [not found]                         ` <1191530370.5019.108.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-10-07 21:20                           ` Carlo Marcelo Arenas Belon [this message]
2007-10-07 22:18                             ` [RFC] let kvm be compiled with gcc4 and prevent users to shoot themselves in the foot while doing so (was Re: [ kvm-Bugs-1807620 ] KVM's --disable-gcc-check doesn't work) Jim Paris
     [not found]                               ` <20071007221827.GA25232-lSbMZ+N7itA@public.gmane.org>
2007-10-08  6:15                                 ` Carlo Marcelo Arenas Belon
2007-10-05 11:41                       ` [ kvm-Bugs-1807620 ] KVM's --disable-gcc-check doesn't work Avi Kivity
2007-10-05 16:54                   ` Bernhard Kaindl
2007-10-05 17:00           ` Anthony Liguori
2007-10-08 15:43   ` [ kvm-Bugs-1807620 ] KVM's --disable-gcc-check doesn'twork Itamar Heim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071007212054.GA26380@tapir \
    --to=carenas-kledwsohozojb6fo7hg9ng@public.gmane.org \
    --cc=centos-virt-IFYaIzF+flcdnm+yROfE0A@public.gmane.org \
    --cc=ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.