Received: from eggs.gnu.org ([2001:4830:134:3::10]:53256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKjSR-0000M1-6V for qemu-devel@nongnu.org; Fri, 22 Aug 2014 03:40:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKjSM-0004qR-DB for qemu-devel@nongnu.org; Fri, 22 Aug 2014 03:40:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKjSM-0004qM-5a for qemu-devel@nongnu.org; Fri, 22 Aug 2014 03:40:18 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7M7eGnx029273 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 22 Aug 2014 03:40:17 -0400 From: Markus Armbruster References: <53F55173.6070704@redhat.com> <20140821090328.GA32580@stefanha-thinkpad.redhat.com> <53F68A8E.4060105@redhat.com> Date: Fri, 22 Aug 2014 09:40:14 +0200 In-Reply-To: <53F68A8E.4060105@redhat.com> (John Snow's message of "Thu, 21 Aug 2014 20:10:54 -0400") Message-ID: <87y4uhht0h.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] issue: linking 64bit glib when building for cpu=i386 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: qemu-devel , Stefan Hajnoczi John Snow writes: > I was running a series of tests on 32 and 64 bit hosts to test for > endianness and variable width issues when I noticed that I couldn't > properly perform a build of "make check" against a 32bit target from a > 64bit host: > > ../../configure --cpu=i386 && make -j4 && make check > > This 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. >From glibconfig.h: typedef signed char gint8; typedef unsigned char guint8; typedef signed short gint16; typedef unsigned short guint16; typedef signed int gint32; typedef unsigned int guint32; typedef signed long gint64; typedef unsigned long guint64; Anyone redoing in this day and age is a weirdo. Anyone getting it wrong is a weirdo and a fool. But getting it wrong in code expressively generated to configure for a specific platform with a perfectly working , that's in a category of weird foolishness of its own. But wait, it gets even better: typedef signed long gssize; typedef unsigned long gsize; Oh yeah, can't rely on size_t, it's been reliably available only since a decade before GLib was born! [...]