|
From: | John Snow |
Subject: | [Qemu-devel] issue: linking 64bit glib when building for cpu=i386 |
Date: | Thu, 21 Aug 2014 20:10:54 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 |
../../configure --cpu=i386 && make -j4 && make checkThis produces some warnings in tests-cutils about overflowing variables that are of type guint64. It's been mentioned on the mailing lists before, actually: http://lists.gnu.org/archive/html/qemu-devel/2014-05/msg00452.html
The problem is that guint64 is being aliased against "unsigned long", which is only 4 bytes instead of the implied 8. This occurs because we link against the 64bit headers for glib instead of the 32bit ones when we're building for i386 from an x86_64 host.
Our include flags wind up looking like: -I/usr/include/glib-2.0 but -I/usr/lib64/glib-2.0/include
I was discussing the problem with Stefan: On 08/21/2014 05:03 AM, Stefan Hajnoczi wrote:
The problem is that pkg-config uses libdir=/usr/lib64 by default on amd64 hosts. It doesn't know that gcc -m32 is being used. This results in glib's 64-bit headers being used where guint64 is just unsigned long. On 32-bit hosts this is incorrect. Two workarounds: 1. yum install pkgconfig.i686 and run it instead of pkgconfig.x86_64 2. Use the pkg-config --define-variable libdir=/usr/lib option You can set PKG_CONFIG=path/to/pkg-config.i686 on QEMU's ./configure command-line. This is all distro-specific :(. Any other solutions? Stefan
I am not extremely well versed in configure or pkg-config ninjutsu, but I must imagine that the ARCH/cpu variables we are setting in configure could help us know to call the 32bit pkg-config instead of the native 64bit version and fix this issue.
Does anyone have any good ideas? Surely other projects must have run into this elsewhere.
-- —js
[Prev in Thread] | Current Thread | [Next in Thread] |