From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Revision 110444 breaks the native MS-Windows build Date: Mon, 08 Oct 2012 13:56:28 +0200 Message-ID: <83r4p941oz.fsf@gnu.org> References: <83y5jh4auz.fsf@gnu.org> <50729174.6070103@dancol.org> <83wqz149ot.fsf@gnu.org> <5072A8DC.6010208@dancol.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1349697454 32427 80.91.229.3 (8 Oct 2012 11:57:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Oct 2012 11:57:34 +0000 (UTC) Cc: emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 08 13:57:38 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TLBxn-0002MS-4T for ged-emacs-devel@m.gmane.org; Mon, 08 Oct 2012 13:57:35 +0200 Original-Received: from localhost ([::1]:37240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLBxg-0002ey-RZ for ged-emacs-devel@m.gmane.org; Mon, 08 Oct 2012 07:57:28 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLBxa-0002et-1j for emacs-devel@gnu.org; Mon, 08 Oct 2012 07:57:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLBxV-0004wG-KK for emacs-devel@gnu.org; Mon, 08 Oct 2012 07:57:21 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:35062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLBxV-0004vY-CE for emacs-devel@gnu.org; Mon, 08 Oct 2012 07:57:17 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MBK00400P2M3J00@a-mtaout21.012.net.il> for emacs-devel@gnu.org; Mon, 08 Oct 2012 13:56:39 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MBK003CUP6ASEA0@a-mtaout21.012.net.il>; Mon, 08 Oct 2012 13:56:35 +0200 (IST) In-reply-to: <5072A8DC.6010208@dancol.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:154227 Archived-At: > Date: Mon, 08 Oct 2012 03:20:12 -0700 > From: Daniel Colascione > CC: emacs-devel@gnu.org > > > and in jconfig.h, a jpeglib header included by jpeglib.h, I see this: > > > > #ifdef _WIN32 > > # include > > /* Define "boolean" as unsigned char, not int, per Windows custom */ > > # if !defined __RPCNDR_H__ || defined __MINGW32__ /* don't conflict if rpcndr.h already read */ > > # ifndef boolean /* don't conflict if rpcndr.h already read */ > > typedef unsigned char boolean; > > # endif /* boolean */ > > # endif /* __RPCNDR_H__ */ > > # define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ > > # define USE_WINDOWS_MESSAGEBOX 1 > > #endif /* _WIN32 */ > > > > This seems to be in perfect order, so I don't understand the conflict > > you were seeing. > > > > In any case, you cannot hope for the above to compile unless you also > > typedef jpeg_boolean. > > My jpeglib doesn't have that code. Which version of jpeglib is that, and where can I see its full set of headers? The latest upstream version, 8d, does seem to have that code. > The redefinition actually works fine under > Cygwin --- the jpeglib headers there just define a type they call "boolean", > which, thanks to our preprocessor macro, is substituted with jpeg_boolean. > Presumably, my hack breaks native Windows because there jpeglib _doesn't_ define > boolean. Yes. > I tried replacing my hack with the approach below. It does _not_ work --- > although this patch allows Emacs to compile under both Cygwin and native > Windows, it doesn't result in successful JPEG loading under Cygwin, presumably > due to the ABI we've made the jpeglib headers declare no longer matching the > compiled libjpeg we're using. What type does jpeglib define its 'boolean' to in the Cygwin build you have? Or does it use Cygwin's own 'boolean'? if so, what is its width? FWIW, I've just configured the latest jpeglib for MinGW, and the above conditional definition did appear in jconfig.h that was created. In any case, this sounds like a problem someone should report upstream: a Cygwin application using jpeglib could definitely include Windows headers, can't it? If jpeglib configured for Cygwin doesn't include the above conditional, then it will cause bugs on Cygwin, I think. > Instead, let's do this: > > +/* rpcndr.h (via windows.h) and jpeglib.h both define boolean types. > + Some versions of jpeglib try to detect whether rpcndr.h is loaded, > + using the Windows boolean type instead of the jpeglib boolean type > + if so. Cygwin jpeglib, however, doesn't try to detect whether its > + headers are included along with windows.h, so under Cygwin, jpeglib > + attempts to define a conflicting boolean type. Worse, forcing > + Cygwin jpeglib headers to use the Windows boolean type doesn't work > + because it created an ABI incompatibility between the > + already-compiled jpeg library and the header interface definition. > + > + The best we can do is to define jpeglib's boolean type to a > + different name. This name, jpeg_boolean, remains in effect through > + the rest of image.c. > +*/ > +#if defined (CYGWIN) && defined (HAVE_NTGUI) > #define boolean jpeg_boolean > +#endif > #include > #include That could be fine, but I'd like to understand the problem some more, because the problem you had could be specific to some version of jpeglib, and if so, this change could break with other versions or on other Cygwin installations. Thanks.