Bug 604702

Summary: Custom Fedora patch to mingw32-libjpeg breaks API
Product: [Fedora] Fedora Reporter: Adam Goode <adam>
Component: mingw32-libjpegAssignee: Richard W.M. Jones <rjones>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: berrange, erik-fedora, fedora-mingw, kalevlember, lfarkas, rjones
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-28 16:44:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 710101    
Bug Blocks:    

Description Adam Goode 2010-06-16 14:36:58 UTC
Description of problem:
The resolution of bug #497492 creates a source incompatible fork of libjpeg that is not even compatible with the native libjpeg!

Version-Release number of selected component (if applicable):

Steps to Reproduce:
1. Try to compile libtiff with standard Fedora configure, make.
2. Now try to compile libtiff  with mingw32-configure, mingw32-make.
Actual results:
tif_jpeg.c:289: error: expected declaration specifiers or '...' before 'boolean'


I don't think we should fork libjpeg in Fedora. Bug #497492 should be reopened and the programs that crash should be fixed.

Comment 1 Adam Goode 2010-06-16 14:38:51 UTC
In fact, here is the code from libtiff that works around the problem without breaking libjpeg:

   The windows RPCNDR.H file defines boolean, but defines it with the
   unsigned char size.  You should compile JPEG library using appropriate
   definitions in jconfig.h header, but many users compile library in wrong
   way. That causes errors of the following type:

   "JPEGLib: JPEG parameter struct mismatch: library thinks size is 432,
   caller expects 464"

   For such users we wil fix the problem here. See install.doc file from
   the JPEG library distribution for details.

/* Define "boolean" as unsigned char, not int, per Windows custom. */
#if defined(__WIN32__) && !defined(__MINGW32__)
# ifndef __RPCNDR_H__            /* don't conflict if rpcndr.h already read */
   typedef unsigned char boolean;
# endif
# define HAVE_BOOLEAN            /* prevent jmorecfg.h from redefining it */

#include "jpeglib.h"
#include "jerror.h"

Comment 2 Bug Zapper 2011-06-02 10:36:56 UTC
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '13'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 13's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 13 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 

Comment 3 Kalev Lember 2011-06-02 11:01:35 UTC
Setting version to rawhide.

I would like to switch from libjpeg7 to libjpeg-turbo like was done in native Fedora packages.  libjpeg-turbo upstream is much more responsive and I believe we should be able to fix the boolean problem in an upstreamable manner.

Erik, you said you had mingw-libjpeg-turbo packaged up locally.  Can you post it for review?  I would be happy to review it and help with rebuilds.

Comment 4 Levente Farkas 2011-06-02 11:12:29 UTC
unfortunately even libjpeg-turbo seems to be api and binary compatible with libjpeg it's not (we learn it from rhel-6.1 extra packages). so either it's required a large massrebuild or please keep mingw32-libjpeg along with mingw-libjpeg-turbo.

Comment 5 Kalev Lember 2011-06-02 11:27:52 UTC
Yes, we would need a large scare rebuild to switch over.  We would also be breaking binary compatibility with this change, because libjpeg7 and libjpeg-turbo have different DLL names. (libjpeg-turbo and libjpeg-6b would have been compatible, but we are already using libjpeg7).

libjpeg 6b:    libjpeg-62.dll
libjpeg 7:     libjpeg-7.dll
libjpeg-turbo: libjpeg-62.dll

So, considering that we'll need a rebuild to switch over, it would also make sense to fix the boolean definition in one go.

Comment 6 Levente Farkas 2011-06-02 11:35:08 UTC
in the mean time may be it'd be useful to apply libtiff's patch to the current mingw32-libjpeg...

Comment 7 Erik van Pienbroek 2011-06-02 11:44:56 UTC
@Kalev, comment 3: I have a mingw-libjpeg-turbo package ready, but it's already based on the new guidelines (with win64 support). I could put it up for review, but it won't build successfully at the moment because the mingw-w64 toolchain isn't approved in Fedora yet

@Levente, comment 4: It's strange that you encountered an API/ABI difference between libjpeg and libjpeg-turbo. When libjpeg-turbo was introduced in Fedora 14 no rebuilds were necessary at all as can be seen at https://fedoraproject.org/wiki/Features/libjpeg-turbo

@Kalev, comment 5: That was also the plan I was having with the mingw-libjpeg-turbo package once the mingw-w64 toolchain gets approved for inclusion in Fedora. A mass rebuild will be required at that time anyway

@Levente, comment 6: The patch mentioned in comment 1 only applies to libtiff. It isn't supposed to work in libjpeg. All packages using libjpeg would have to apply a variant to this patch as it all depends on the headers which get included in c/c++ files which want to use libjpeg headers

Comment 8 Erik van Pienbroek 2011-06-02 13:13:49 UTC
The mingw-libjpeg-turbo package has just been put up for review at bug 710101

Comment 9 Erik van Pienbroek 2011-06-10 17:39:21 UTC
The mingw-libjpeg-turbo package is now in Fedora and doesn't contain any ugly hacks any more.

Are you okay that we close this bug?

Comment 10 Adam Goode 2011-06-11 18:43:07 UTC
I will test it out using OpenSlide, which is what had problems before. But looking promising so far.

Comment 11 Erik van Pienbroek 2012-02-28 16:44:53 UTC
No more issues reported, closing bug