aboutsummaryrefslogtreecommitdiff
path: root/include/qemu
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-01-27 09:00:45 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2016-02-09 15:45:26 +0100
commit977a82ab56daac83623d730174f47d5a7edd73c9 (patch)
tree4335996e661bbb77fb66520104ca31b9a1bccea4 /include/qemu
parent34689e206abddac87a5217d458534e24f2a05562 (diff)
downloadqemu-977a82ab56daac83623d730174f47d5a7edd73c9.zip
qemu-977a82ab56daac83623d730174f47d5a7edd73c9.tar.gz
qemu-977a82ab56daac83623d730174f47d5a7edd73c9.tar.bz2
configure: sanity check the glib library that pkg-config finds
Developers on 64-bit machines will often try to perform a 32-bit build of QEMU by running ./configure --extra-cflags="-m32" Unfortunately if PKG_CONFIG_LIBDIR is not set to point to the location of the 32-bit pkg-config files, then configure will silently pick up the 64-bit pkg-config files and still succeed. This causes a problem for glib because it means QEMU will be pulling in /usr/lib64/glib-2.0/include/glibconfig.h instead of /usr/lib/glib-2.0/include/glibconfig.h This causes problems because the 'gsize' type (defined as 'unsigned long') will no longer be fully compatible with the 'size_t' type (defined as 'unsigned int'). Although both are the same size, the compiler refuses to allow casts from 'unsigned long *' to 'unsigned int *' as they are different pointer types. This results in non-obvious compiler errors when building QEMU eg qga/commands-posix.c: In function ‘qmp_guest_set_user_password’: qga/commands-posix.c:1912:55: error: passing argument 2 of ‘g_base64_decode’ from incompatible pointer type [-Werror=incompatible-pointer-types] rawpasswddata = (char *)g_base64_decode(password, &rawpasswdlen); ^ In file included from /usr/include/glib-2.0/glib.h:35:0, from qga/commands-posix.c:14: /usr/include/glib-2.0/glib/gbase64.h:52:9: note: expected ‘gsize * {aka long unsigned int *}’ but argument is of type ‘size_t * {aka unsigned int *}’ guchar *g_base64_decode (const gchar *text, ^ cc1: all warnings being treated as errors To detect this problem, add a check to configure that verifies that GLIB_SIZEOF_SIZE_T matches sizeof(size_t). If this fails print a warning suggesting that the dev probably needs to set PKG_CONFIG_LIBDIR. On Fedora x86_64 it passes with any of: # ./configure # PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig ./configure --extra-cflags="-m32" # PKG_CONFIG_LIBDIR=/usr/lib64/pkgconfig ./configure --extra-cflags="-m64" And fails with a mis-match # PKG_CONFIG_LIBDIR=/usr/lib64/pkgconfig ./configure --extra-cflags="-m32" # PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig ./configure --extra-cflags="-m64" ERROR: sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T. You probably need to set PKG_CONFIG_LIBDIR to point to the right pkg-config files for your build target Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1453885245-15562-1-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/qemu')
0 files changed, 0 insertions, 0 deletions