diff mbox

[v5,1/5] Add hard build dependency on glib

Message ID 1307911585-22106-2-git-send-email-stefanha@linux.vnet.ibm.com
State New
Headers show

Commit Message

Stefan Hajnoczi June 12, 2011, 8:46 p.m. UTC
From: Anthony Liguori <aliguori@us.ibm.com>

GLib is an extremely common library that has a portable thread implementation
along with tons of other goodies.

GLib and GObject have a fantastic amount of infrastructure we can leverage in
QEMU including an object oriented programming infrastructure.

Short term, it has a very nice thread pool implementation that we could leverage
in something like virtio-9p.  It also has a test harness implementation that
this series will use.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 Makefile        |    2 ++
 Makefile.objs   |    2 ++
 Makefile.target |    1 +
 configure       |   13 +++++++++++++
 4 files changed, 18 insertions(+), 0 deletions(-)

Comments

Andreas Färber June 18, 2011, 4:15 p.m. UTC | #1
Am 12.06.2011 um 22:46 schrieb Stefan Hajnoczi:

> From: Anthony Liguori <aliguori@us.ibm.com>
>
> GLib is an extremely common library that has a portable thread  
> implementation
> along with tons of other goodies.
>
> GLib and GObject have a fantastic amount of infrastructure we can  
> leverage in
> QEMU including an object oriented programming infrastructure.

GObject still doesn't build on Darwin/ppc64:

   CC     gboxed.lo
../../glib-2.28.8/gobject/gboxed.c: In function 'g_closure_get_type':
../../glib-2.28.8/gobject/gboxed.c:120: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:120: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:120: error: incompatible type for  
argument 2 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c:120: error: incompatible type for  
argument 3 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c: In function 'g_value_get_type':
../../glib-2.28.8/gobject/gboxed.c:121: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:121: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:121: error: incompatible type for  
argument 2 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c:121: error: incompatible type for  
argument 3 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c: In function  
'g_value_array_get_type':
../../glib-2.28.8/gobject/gboxed.c:122: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:122: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:122: error: incompatible type for  
argument 2 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c:122: error: incompatible type for  
argument 3 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c: In function 'g_date_get_type':
../../glib-2.28.8/gobject/gboxed.c:123: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:123: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:123: error: incompatible type for  
argument 2 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c:123: error: incompatible type for  
argument 3 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c: In function 'g_gstring_get_type':
../../glib-2.28.8/gobject/gboxed.c:125: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:125: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:125: error: incompatible type for  
argument 2 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c:125: error: incompatible type for  
argument 3 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c: In function 'g_hash_table_get_type':
../../glib-2.28.8/gobject/gboxed.c:126: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:126: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:126: error: incompatible type for  
argument 2 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c:126: error: incompatible type for  
argument 3 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c: In function 'g_array_get_type':
../../glib-2.28.8/gobject/gboxed.c:127: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:127: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:127: error: incompatible type for  
argument 2 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c:127: error: incompatible type for  
argument 3 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c: In function 'g_ptr_array_get_type':
../../glib-2.28.8/gobject/gboxed.c:128: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:128: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:128: error: incompatible type for  
argument 2 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c:128: error: incompatible type for  
argument 3 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c: In function 'g_byte_array_get_type':
../../glib-2.28.8/gobject/gboxed.c:129: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:129: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:129: error: incompatible type for  
argument 2 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c:129: error: incompatible type for  
argument 3 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c: In function 'g_regex_get_type':
../../glib-2.28.8/gobject/gboxed.c:132: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:132: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:132: error: incompatible type for  
argument 2 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c:132: error: incompatible type for  
argument 3 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c: In function  
'g_variant_type_get_gtype':
../../glib-2.28.8/gobject/gboxed.c:138: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:138: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:138: error: incompatible type for  
argument 2 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c:138: error: incompatible type for  
argument 3 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c: In function 'g_error_get_type':
../../glib-2.28.8/gobject/gboxed.c:141: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:141: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:141: error: incompatible type for  
argument 2 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c:141: error: incompatible type for  
argument 3 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c: In function 'g_date_time_get_type':
../../glib-2.28.8/gobject/gboxed.c:143: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:143: warning: union cannot be made  
transparent
../../glib-2.28.8/gobject/gboxed.c:143: error: incompatible type for  
argument 2 of '_g_register_boxed'
../../glib-2.28.8/gobject/gboxed.c:143: error: incompatible type for  
argument 3 of '_g_register_boxed'
make[4]: *** [gboxed.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

With both gcc 4.0.1 and 4.2.1, using CC="gcc -arch ppc64" CPPFLAGS="- 
arch ppc64" and supplying GNU gettext and GNU libiconv (since it  
chokes on the system iconv.h). No Google hit.

Any thoughts?

Andreas
Stefan Hajnoczi June 18, 2011, 5:21 p.m. UTC | #2
On Sat, Jun 18, 2011 at 5:15 PM, Andreas Färber <andreas.faerber@web.de> wrote:
> With both gcc 4.0.1 and 4.2.1, using CC="gcc -arch ppc64" CPPFLAGS="-arch
> ppc64" and supplying GNU gettext and GNU libiconv (since it chokes on the
> system iconv.h). No Google hit.

Strange, Fink seems to support it:
http://pdb.finkproject.org/pdb/package.php/glib2-dev

Stefan
Andreas Färber June 18, 2011, 7:44 p.m. UTC | #3
Am 18.06.2011 um 19:21 schrieb Stefan Hajnoczi:

> On Sat, Jun 18, 2011 at 5:15 PM, Andreas Färber <andreas.faerber@web.de 
> > wrote:
>> With both gcc 4.0.1 and 4.2.1, using CC="gcc -arch ppc64"  
>> CPPFLAGS="-arch
>> ppc64" and supplying GNU gettext and GNU libiconv (since it chokes  
>> on the
>> system iconv.h). No Google hit.
>
> Strange, Fink seems to support it:
> http://pdb.finkproject.org/pdb/package.php/glib2-dev

Says nothing about powerpc64...

Andreas
Stefan Hajnoczi June 18, 2011, 8:46 p.m. UTC | #4
On Sat, Jun 18, 2011 at 8:44 PM, Andreas Färber <andreas.faerber@web.de> wrote:
> Am 18.06.2011 um 19:21 schrieb Stefan Hajnoczi:
>
>> On Sat, Jun 18, 2011 at 5:15 PM, Andreas Färber <andreas.faerber@web.de>
>> wrote:
>>>
>>> With both gcc 4.0.1 and 4.2.1, using CC="gcc -arch ppc64" CPPFLAGS="-arch
>>> ppc64" and supplying GNU gettext and GNU libiconv (since it chokes on the
>>> system iconv.h). No Google hit.
>>
>> Strange, Fink seems to support it:
>> http://pdb.finkproject.org/pdb/package.php/glib2-dev
>
> Says nothing about powerpc64...

Shows my ignorance of Mac or Darwin :).  I figured 10.5/powerpc is
what you're after.

Stefan
Andreas Färber June 18, 2011, 9:29 p.m. UTC | #5
Am 18.06.2011 um 22:46 schrieb Stefan Hajnoczi:

> On Sat, Jun 18, 2011 at 8:44 PM, Andreas Färber <andreas.faerber@web.de 
> > wrote:
>> Am 18.06.2011 um 19:21 schrieb Stefan Hajnoczi:
>>
>>> On Sat, Jun 18, 2011 at 5:15 PM, Andreas Färber <andreas.faerber@web.de 
>>> >
>>> wrote:
>>>>
>>>> With both gcc 4.0.1 and 4.2.1, using CC="gcc -arch ppc64"  
>>>> CPPFLAGS="-arch
>>>> ppc64" and supplying GNU gettext and GNU libiconv (since it  
>>>> chokes on the
>>>> system iconv.h). No Google hit.
>>>
>>> Strange, Fink seems to support it:
>>> http://pdb.finkproject.org/pdb/package.php/glib2-dev
>>
>> Says nothing about powerpc64...
>
> Shows my ignorance of Mac or Darwin :).  I figured 10.5/powerpc is
> what you're after.

No prob, it was a very short-lived technology - arrived in v10.4 half- 
done, became usable in v10.5 and was dropped in v10.6 in favor of Intel.
You have the same ppc vs. ppc64 split for Linux packages btw.

GLib 2.22.4 finished building okay now. I've filed a bug against GLib.  
Hope it works at runtime.

Andreas
Andreas Färber June 25, 2011, 2:02 p.m. UTC | #6
Am 12.06.2011 um 22:46 schrieb Stefan Hajnoczi:

> From: Anthony Liguori <aliguori@us.ibm.com>
>
> GLib is an extremely common library that has a portable thread  
> implementation
> along with tons of other goodies.
>
> GLib and GObject have a fantastic amount of infrastructure we can  
> leverage in
> QEMU including an object oriented programming infrastructure.
>
> Short term, it has a very nice thread pool implementation that we  
> could leverage
> in something like virtio-9p.  It also has a test harness  
> implementation that
> this series will use.
>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> ---
> Makefile        |    2 ++
> Makefile.objs   |    2 ++
> Makefile.target |    1 +
> configure       |   13 +++++++++++++
> 4 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 096480b..306cd9b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -106,6 +106,8 @@ audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $ 
> (FMOD_CFLAGS)
>
> QEMU_CFLAGS+=$(CURL_CFLAGS)
>
> +QEMU_CFLAGS+=$(GLIB_CFLAGS)
> +
> ui/cocoa.o: ui/cocoa.m
>
> ui/sdl.o audio/sdlaudio.o ui/sdl_zoom.o baum.o: QEMU_CFLAGS += $ 
> (SDL_CFLAGS)
> diff --git a/Makefile.objs b/Makefile.objs
> index 52d8b23..a7807e8 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -368,3 +368,5 @@ vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
>
> vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)
>
> +vl.o: QEMU_CFLAGS+=$(GLIB_CFLAGS)
> +
> diff --git a/Makefile.target b/Makefile.target
> index b1a0f6d..0d900e2 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -202,6 +202,7 @@ QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
> QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
> QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
> QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
> +QEMU_CFLAGS += $(GLIB_CFLAGS)
>
> # xen backend driver support
> obj-i386-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
> diff --git a/configure b/configure
> index 663b557..3697eba 100755
> --- a/configure
> +++ b/configure
> @@ -1767,6 +1767,18 @@ EOF
> fi
>
> ##########################################
> +# glib support probe
> +if $pkg_config --modversion gthread-2.0 gio-2.0 > /dev/null 2>&1 ;  
> then
> +    glib_cflags=`$pkg_config --cflags gthread-2.0 gio-2.0 2>/dev/ 
> null`
> +    glib_libs=`$pkg_config --libs gthread-2.0 gio-2.0 2>/dev/null`
> +    libs_softmmu="$glib_libs $libs_softmmu"
> +    libs_tools="$glib_libs $libs_tools"
> +else
> +    echo "glib-2.0 required to compile QEMU"
> +    exit 1
> +fi
> +
> +##########################################
> # kvm probe
> if test "$kvm" != "no" ; then
>     cat > $TMPC <<EOF

This hunk no longer applies.

Andreas

> @@ -2923,6 +2935,7 @@ if test "$bluez" = "yes" ; then
>   echo "CONFIG_BLUEZ=y" >> $config_host_mak
>   echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
> fi
> +echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
> if test "$xen" = "yes" ; then
>   echo "CONFIG_XEN=y" >> $config_host_mak
>   echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >>  
> $config_host_mak
> -- 
> 1.7.5.3
>
>
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 096480b..306cd9b 100644
--- a/Makefile
+++ b/Makefile
@@ -106,6 +106,8 @@  audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
 
 QEMU_CFLAGS+=$(CURL_CFLAGS)
 
+QEMU_CFLAGS+=$(GLIB_CFLAGS)
+
 ui/cocoa.o: ui/cocoa.m
 
 ui/sdl.o audio/sdlaudio.o ui/sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS)
diff --git a/Makefile.objs b/Makefile.objs
index 52d8b23..a7807e8 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -368,3 +368,5 @@  vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
 
 vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)
 
+vl.o: QEMU_CFLAGS+=$(GLIB_CFLAGS)
+
diff --git a/Makefile.target b/Makefile.target
index b1a0f6d..0d900e2 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -202,6 +202,7 @@  QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
 QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
 QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
+QEMU_CFLAGS += $(GLIB_CFLAGS)
 
 # xen backend driver support
 obj-i386-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
diff --git a/configure b/configure
index 663b557..3697eba 100755
--- a/configure
+++ b/configure
@@ -1767,6 +1767,18 @@  EOF
 fi
 
 ##########################################
+# glib support probe
+if $pkg_config --modversion gthread-2.0 gio-2.0 > /dev/null 2>&1 ; then
+    glib_cflags=`$pkg_config --cflags gthread-2.0 gio-2.0 2>/dev/null`
+    glib_libs=`$pkg_config --libs gthread-2.0 gio-2.0 2>/dev/null`
+    libs_softmmu="$glib_libs $libs_softmmu"
+    libs_tools="$glib_libs $libs_tools"
+else
+    echo "glib-2.0 required to compile QEMU"
+    exit 1
+fi
+
+##########################################
 # kvm probe
 if test "$kvm" != "no" ; then
     cat > $TMPC <<EOF
@@ -2923,6 +2935,7 @@  if test "$bluez" = "yes" ; then
   echo "CONFIG_BLUEZ=y" >> $config_host_mak
   echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
 fi
+echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
 if test "$xen" = "yes" ; then
   echo "CONFIG_XEN=y" >> $config_host_mak
   echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak