Please do not reply directly to this email. All additional comments should be made in the comments box of this bug.
Summary: mingw <pthread.h> is broken
https://bugzilla.redhat.com/show_bug.cgi?id=599227
Summary: mingw <pthread.h> is broken Product: Fedora Version: 13 Platform: All OS/Version: Linux Status: NEW Severity: medium Priority: low Component: mingw32-pthreads AssignedTo: rjones@redhat.com ReportedBy: eblake@redhat.com QAContact: extras-qa@fedoraproject.org CC: lfarkas@lfarkas.org, berrange@redhat.com, rjones@redhat.com, erik-fedora@vanpienbroek.nl, fedora-mingw@lists.fedoraproject.org Classification: Fedora Target Release: ---
Description of problem: The cross-compilation header /usr/i686-pc-mingw32/sys-root/mingw/include/pthread.h, installed as part of the mingw32-pthreads package, has several coding bugs.
Version-Release number of selected component (if applicable): mingw32-pthreads-2.8.0-10.fc13.noarch
How reproducible: Always
Steps to Reproduce: 1. Try cross-compiling any code that uses localtime_r with a second argument with side effects, or try calling (localtime_r)(arg1,arg2). 2. Try cross-compiling any project that uses gnulib's <time.h> replacement header (libvirt is an example project; it includes a ./autobuild.sh script that will automatically try a mingw cross-compilation, if you have installed a mingw portablexdr library, although that library is not yet part of fedora).
Actual results: The definition of localtime_r is broken, because it evaluates the second argument twice. And, since POSIX allows one to #undef localtime_r, but there is no localtime_r function in the library, you get a link failure if you bypass the function-like macro. Finally, the pthreads-win32 library made the mistake of installing <config.h>, which is asking for namespace collision with most other autotooled packages.
Expected results: <pthread.h> should not define any *_r functions, nor should it interfere with a proper <time.h>. Also, the library should not install <config.h>, but should instead modify its installed headers to be self-contained.
Additional info: See this thread on bug-gnulib for more details: http://lists.gnu.org/archive/html/bug-gnulib/2010-06/msg00007.html
Please do not reply directly to this email. All additional comments should be made in the comments box of this bug.
https://bugzilla.redhat.com/show_bug.cgi?id=599227
Ryan O'Hara rohara@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |rohara@redhat.com
--- Comment #1 from Ryan O'Hara rohara@redhat.com 2010-07-14 17:08:10 EDT --- I recently came across this bug when trying to compile libcheck under mingw32, which choked on the localtime_r problem described in comment #1.
Please do not reply directly to this email. All additional comments should be made in the comments box of this bug.
https://bugzilla.redhat.com/show_bug.cgi?id=599227
Erik van Pienbroek erik-fedora@vanpienbroek.nl changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED
--- Comment #2 from Erik van Pienbroek erik-fedora@vanpienbroek.nl 2011-01-28 13:37:53 EST --- Do you happen to know if these issues have been resolved upstream already? There has been activity in upstreams CVS repo to add support for mingw-w64 and possibly other fixes. See http://sourceforge.net/apps/trac/mingw-w64/wiki/Compile%20pthreads for details.
On that link there also are patches to fix the config.h issue which you mentioned. For the new cross compiler framework which I mentioned in your other bugreport (bug 599567) I have those patches already applied.
If you want to test this new version of mingw32-pthreads you can use the testing repository for the new cross compiler framework. Details for that can be found at https://fedoraproject.org/wiki/MinGW/CrossCompilerFramework
Please do not reply directly to this email. All additional comments should be made in the comments box of this bug.
https://bugzilla.redhat.com/show_bug.cgi?id=599227
Kalev Lember kalev@smartlink.ee changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |kalev@smartlink.ee
--- Comment #3 from Kalev Lember kalev@smartlink.ee 2011-05-12 03:08:56 EDT --- (In reply to comment #0) [snip]
Finally, the pthreads-win32 library made the mistake of installing <config.h>, which is asking for namespace collision with most other autotooled packages.
Expected results:
[snip]
Also, the library should not install <config.h>, but should instead modify its installed headers to be self-contained.
I gave a stab at fixing the config.h issue. In rawhide pthreads.h no longer includes config.h and both config.h and its other private headers are no longer installed.
The fix is in mingw32-pthreads-2.8.0-14.fc16
http://pkgs.fedoraproject.org/gitweb/?p=mingw32-pthreads.git;a=blobdiff;f=mi...
Please do not reply directly to this email. All additional comments should be made in the comments box of this bug.
https://bugzilla.redhat.com/show_bug.cgi?id=599227
--- Comment #4 from Kalev Lember kalev@smartlink.ee 2011-05-12 03:56:28 EDT --- It would also appear that in CVS HEAD localtime_r and other *_r definitions are gone from pthreads.h; perhaps we should consider packaging up a snapshot.
Anyone interested in talking to upstream and asking when they are going to make a new release?
Please do not reply directly to this email. All additional comments should be made in the comments box of this bug.
https://bugzilla.redhat.com/show_bug.cgi?id=599227
--- Comment #5 from Erik van Pienbroek erik-fedora@vanpienbroek.nl 2011-05-12 12:56:32 EDT --- After some discussion with Kalev on IRC I think it's a good idea to update the mingw32-pthreads package in Fedora to the latest CVS version. That way we should also be ready with a compatible version for when mingw-w64 will be introduced in Fedora 16
Please do not reply directly to this email. All additional comments should be made in the comments box of this bug.
https://bugzilla.redhat.com/show_bug.cgi?id=599227
Kalev Lember kalev@smartlink.ee changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |CLOSED Version|13 |rawhide Fixed In Version| |mingw32-pthreads-2.8.0-15.2 | |0110511cvs.fc16 Resolution| |RAWHIDE AssignedTo|rjones@redhat.com |kalev@smartlink.ee Last Closed| |2011-05-12 13:18:33
--- Comment #6 from Kalev Lember kalev@smartlink.ee 2011-05-12 13:18:33 EDT --- I just built mingw32-pthreads-2.8.0-15.20110511cvs.fc16 for rawhide, which should fix both the config.h issue by removing the header, and also remove the possibly conflicting localtime_r definition. I did some basic testing, but it would be very awesome if someone else could try it with a real world test case.
Closing the ticket.