Re: [Qemu-devel] [PATCH 04/25] Add hard build dependency on glib
On Tue, 2 Aug 2011 10:03:30 +0800 TeLeMan gele...@gmail.com wrote: This patch introduces -mms-bitfields cflag on MinGW but this cflag breaks gcc packed structures(__attribute__((packed))). For example, slirp does not work on Win32. I'm not familiar with MinGW (or why glib would require that flag). Michael, Anthony, any idea?
Re: [Qemu-devel] [PATCH 04/25] Add hard build dependency on glib
On 08/02/2011 02:06 PM, Luiz Capitulino wrote: On Tue, 2 Aug 2011 10:03:30 +0800 TeLeMangele...@gmail.com wrote: This patch introduces -mms-bitfields cflag on MinGW but this cflag breaks gcc packed structures(__attribute__((packed))). For example, slirp does not work on Win32. I'm not familiar with MinGW (or why glib would require that flag). Michael, Anthony, any idea? ms-bitfields does packing of bitfields in a way compatible with MSVC. In order to call Windows API functions that use structures that have bitfields, you need to use ms-bitfields. Slirp will need to be fixed to not depend on GCC bitfield layout. This is one of the reasons why portable code should never use bitfields. Regards, Anthony Liguori
Re: [Qemu-devel] [PATCH 04/25] Add hard build dependency on glib
This patch introduces -mms-bitfields cflag on MinGW but this cflag breaks gcc packed structures(__attribute__((packed))). For example, slirp does not work on Win32.
Re: [Qemu-devel] [PATCH 04/25] Add hard build dependency on glib
You're probably setting up your cross environment incorrectly which, unfortunately, is very common. The proper thing to do is to have GCC use a different system include directory and a different prefix. That will result in a directory where there are gcc binaries with normal names installed in ${cross_prefix}/bin You need to build and install pkg-config to this prefix too, and then when it comes time to actually doing the QEMU configure, you should do something like: export PATH=${cross_prefix}/bin:$PATH export PKG_CONFIG_PATH=${cross_prefix}/lib/pkg-config:$PKG_CONFIG_PATH Many automated cross compiler environment scripts will install specially named versions of gcc and binutils in your normal $PATH. The trouble is, this is a bit of a hack and unless you know to make this hack work with other build tools, it all comes tumbling down. Well, that hard requirement is causing us problem on our 32/64-bit cross builds as well. It looks like glib (at least recent versions in -sid) can't be built 64-bit on a 32-bit system :-( At least not without fixing some horrid bugs in there related to some generated include path from what David says (I'll let him comment further). In general, every time you add a library requirement without some config option to disable it for cases such as ours, you add pain :-) Now, in the specific case of glib, I understand why you would want to get rid of re-invented wheels and use it, so I'm not specifically criticizing that specific change, we'll eventually have to fix it anyways. Just a heads up to be careful with hard requirements in general. Cheers, Ben.
Re: [Qemu-devel] [PATCH 04/25] Add hard build dependency on glib
-Original Message- From: Anthony Liguori [mailto:aligu...@us.ibm.com] Sent: Tuesday, July 26, 2011 5:10 PM To: Yoder Stuart-B08248 Cc: qemu-devel@nongnu.org Subject: Re: [PATCH 04/25] Add hard build dependency on glib On 07/26/2011 04:51 PM, Yoder Stuart-B08248 wrote: I am having issues with this in a cross compilation environment. In Power embedded, almost all our development is using cross toolchains. Neither glib or pkg-config are in our cross build environment and I'm having issues getting them built and installed. Not even sure if pkg-config is even supposed to work in a cross development environment...I'm new to that tool and poking around a bit with google raises some questions. You're probably setting up your cross environment incorrectly which, unfortunately, is very common. I got glib to build without too much trouble, however, 'make install' tries to re-link some stuff and at that point there seems to be a bug somewhere where libtool fails to use the correct CFLAGS and PATH, and thus the make install partially installs glib before erroring out. The proper thing to do is to have GCC use a different system include directory and a different prefix. That will result in a directory where there are gcc binaries with normal names installed in ${cross_prefix}/bin You need to build and install pkg-config to this prefix too, and then when it comes time to actually doing the QEMU configure, you should do something like: export PATH=${cross_prefix}/bin:$PATH export PKG_CONFIG_PATH=${cross_prefix}/lib/pkg-config:$PKG_CONFIG_PATH Many automated cross compiler environment scripts will install specially named versions of gcc and binutils in your normal $PATH. The trouble is, this is a bit of a hack and unless you know to make this hack work with other build tools, it all comes tumbling down. Note-- this is not just a matter of me getting this to work in my own private build environment, I'm working with a cross toolchain that gets delivered to our customers that I have little control over, and I need to get it working in that environment. Looks like our cross tools have both a specially named version of the tool (e.g. powerpc-linux-gnu-gcc) and plain (e.g. gcc). Unfortunately the plain version of the tools don't seem to be functional (and have never been used as far as I know). Will keep fiddling with this... Stuart
Re: [Qemu-devel] [PATCH 04/25] Add hard build dependency on glib
On Wed, Jul 27, 2011 at 06:54:09PM +1000, Benjamin Herrenschmidt wrote: You're probably setting up your cross environment incorrectly which, unfortunately, is very common. The proper thing to do is to have GCC use a different system include directory and a different prefix. That will result in a directory where there are gcc binaries with normal names installed in ${cross_prefix}/bin You need to build and install pkg-config to this prefix too, and then when it comes time to actually doing the QEMU configure, you should do something like: export PATH=${cross_prefix}/bin:$PATH export PKG_CONFIG_PATH=${cross_prefix}/lib/pkg-config:$PKG_CONFIG_PATH Many automated cross compiler environment scripts will install specially named versions of gcc and binutils in your normal $PATH. The trouble is, this is a bit of a hack and unless you know to make this hack work with other build tools, it all comes tumbling down. We're not, as a rule, cross building. We're doing compiles of ppc64 binaries on a ppc32. Although that can be approached as a cross-build, it's a common enough special case that it should be able to handle this without setting a full cross-build environment. At the moment this does seem to work for building x86_64 binaries on a 32-bit x86 system, but I suspect this is only accident. Well, that hard requirement is causing us problem on our 32/64-bit cross builds as well. It looks like glib (at least recent versions in -sid) can't be built 64-bit on a 32-bit system :-( At least not without fixing some horrid bugs in there related to some generated include path from what David says (I'll let him comment further). Actually, I think it can (provided a 64-bit glib is installed, including a 64-bit version of glibconfig.h), and it's not *as* painful to set up as I previously thought, although it's still not nice. In general, every time you add a library requirement without some config option to disable it for cases such as ours, you add pain :-) Now, in the specific case of glib, I understand why you would want to get rid of re-invented wheels and use it, so I'm not specifically criticizing that specific change, we'll eventually have to fix it anyways. Just a heads up to be careful with hard requirements in general. Cheers, Ben. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH 04/25] Add hard build dependency on glib
On 07/26/2011 04:51 PM, Yoder Stuart-B08248 wrote: I am having issues with this in a cross compilation environment. In Power embedded, almost all our development is using cross toolchains. Neither glib or pkg-config are in our cross build environment and I'm having issues getting them built and installed. Not even sure if pkg-config is even supposed to work in a cross development environment...I'm new to that tool and poking around a bit with google raises some questions. You're probably setting up your cross environment incorrectly which, unfortunately, is very common. The proper thing to do is to have GCC use a different system include directory and a different prefix. That will result in a directory where there are gcc binaries with normal names installed in ${cross_prefix}/bin You need to build and install pkg-config to this prefix too, and then when it comes time to actually doing the QEMU configure, you should do something like: export PATH=${cross_prefix}/bin:$PATH export PKG_CONFIG_PATH=${cross_prefix}/lib/pkg-config:$PKG_CONFIG_PATH Many automated cross compiler environment scripts will install specially named versions of gcc and binutils in your normal $PATH. The trouble is, this is a bit of a hack and unless you know to make this hack work with other build tools, it all comes tumbling down. Regards, Anthony Liguori Wanted to make you aware of the issue... Stuart
Re: [Qemu-devel] [PATCH 04/25] Add hard build dependency on glib
From: Anthony Liguori address@hidden 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 address@hidden Signed-off-by: Michael Roth address@hidden Signed-off-by: Luiz Capitulino address@hidden --- Makefile|2 ++ Makefile.objs |1 + Makefile.target |1 + configure | 13 + 4 files changed, 17 insertions(+), 0 deletions(-) diff --git a/Makefile b/Makefile index b3ffbe2..42ae4e5 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 c43ed05..55d18bb 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -376,3 +376,4 @@ 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 e20a313..cde509b 100644 --- a/Makefile.target +++ b/Makefile.target @@ -204,6 +204,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 support obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o diff --git a/configure b/configure index e57efb1..c0c8fdf 100755 --- a/configure +++ b/configure @@ -1803,6 +1803,18 @@ EOF fi ## +# glib support probe +if $pkg_config --modversion gthread-2.0 gio-2.0 /dev/null 21 ; 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 I am having issues with this in a cross compilation environment. In Power embedded, almost all our development is using cross toolchains. Neither glib or pkg-config are in our cross build environment and I'm having issues getting them built and installed. Not even sure if pkg-config is even supposed to work in a cross development environment...I'm new to that tool and poking around a bit with google raises some questions. Wanted to make you aware of the issue... Stuart
[Qemu-devel] [PATCH 04/25] Add hard build dependency on glib
From: Anthony Liguori aligu...@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 aligu...@us.ibm.com Signed-off-by: Michael Roth mdr...@linux.vnet.ibm.com Signed-off-by: Luiz Capitulino lcapitul...@gmail.com --- Makefile|2 ++ Makefile.objs |1 + Makefile.target |1 + configure | 13 + 4 files changed, 17 insertions(+), 0 deletions(-) diff --git a/Makefile b/Makefile index b3ffbe2..42ae4e5 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 c43ed05..55d18bb 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -376,3 +376,4 @@ 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 e20a313..cde509b 100644 --- a/Makefile.target +++ b/Makefile.target @@ -204,6 +204,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 support obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o diff --git a/configure b/configure index e57efb1..c0c8fdf 100755 --- a/configure +++ b/configure @@ -1803,6 +1803,18 @@ EOF fi ## +# glib support probe +if $pkg_config --modversion gthread-2.0 gio-2.0 /dev/null 21 ; 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 + +## # pthread probe PTHREADLIBS_LIST=-lpthread -lpthreadGC2 @@ -2849,6 +2861,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_BACKEND=y $config_host_mak echo CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version $config_host_mak -- 1.7.6.233.gd79bc