From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKcRf-0001SG-A3 for qemu-devel@nongnu.org; Thu, 21 Aug 2014 20:11:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKcRa-0007gV-Eh for qemu-devel@nongnu.org; Thu, 21 Aug 2014 20:11:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKcRa-0007gA-5S for qemu-devel@nongnu.org; Thu, 21 Aug 2014 20:11:02 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7M0B0sv010465 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 21 Aug 2014 20:11:01 -0400 Message-ID: <53F68A8E.4060105@redhat.com> Date: Thu, 21 Aug 2014 20:10:54 -0400 From: John Snow MIME-Version: 1.0 References: <53F55173.6070704@redhat.com> <20140821090328.GA32580@stefanha-thinkpad.redhat.com> In-Reply-To: <20140821090328.GA32580@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] issue: linking 64bit glib when building for cpu=i386 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Cc: Stefan Hajnoczi I was running a series of tests on 32 and 64 bit hosts to test for=20 endianness and variable width issues when I noticed that I couldn't=20 properly perform a build of "make check" against a 32bit target from a=20 64bit host: ../../configure --cpu=3Di386 && make -j4 && make check This produces some warnings in tests-cutils about overflowing variables=20 that are of type guint64. It's been mentioned on the mailing lists=20 before, actually:=20 http://lists.gnu.org/archive/html/qemu-devel/2014-05/msg00452.html The problem is that guint64 is being aliased against "unsigned long",=20 which is only 4 bytes instead of the implied 8. This occurs because we=20 link against the 64bit headers for glib instead of the 32bit ones when=20 we're building for i386 from an x86_64 host. Our include flags wind up looking like: -I/usr/include/glib-2.0 but=20 -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=3D/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=3D/usr/lib option > > You can set PKG_CONFIG=3Dpath/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=20 I must imagine that the ARCH/cpu variables we are setting in configure=20 could help us know to call the 32bit pkg-config instead of the native=20 64bit version and fix this issue. Does anyone have any good ideas? Surely other projects must have run=20 into this elsewhere. --=20 =97js