After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 675171 - Fix stat-related issues with MinGW
Fix stat-related issues with MinGW
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Windows
: Normal blocker
: 0.11.x
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-04-30 16:25 UTC by LRN
Modified: 2012-04-30 20:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix stat-related issues with MinGW (716 bytes, patch)
2012-04-30 16:27 UTC, LRN
rejected Details | Review
Rearrange sys/stat.h inclusion point (1005 bytes, patch)
2012-04-30 16:55 UTC, LRN
committed Details | Review

Description LRN 2012-04-30 16:25:53 UTC
This code (example from gstfilesrc.c):

#ifdef G_OS_WIN32
#include <io.h>                 /* lseek, open, close, read */
/* On win32, stat* default to 32 bit; we need the 64-bit
 * variants, so explicitly define it that way. */
#define stat __stat64
#define fstat _fstat64
#undef lseek
#define lseek _lseeki64
#undef off_t
#define off_t guint64
/* Prevent stat.h from defining the stat* functions as
 * _stat*, since we're explicitly overriding that */
#undef _INC_STAT_INL
#endif
#include <sys/stat.h>

Means that <sys/stat.h>, when included, gets mangled (all occurrences of "stat" are replaced by "__stat64"), which results in redefinition of the "__stat64" structure.

Until http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=19d4c0ba73a84bfb179dcf2c09be1e4cb763c158 this was averted by gstplugin.h including <sys/stat.h> early on.
Comment 1 LRN 2012-04-30 16:27:33 UTC
Created attachment 213117 [details] [review]
Fix stat-related issues with MinGW

This is a short version. Only adds two lines to a public header, but fixes everything.

Fixing this without altering public header requires re-arranging #includes in several source files. I'll try that and submit an alternative patch.
Comment 2 LRN 2012-04-30 16:55:42 UTC
Created attachment 213123 [details] [review]
Rearrange sys/stat.h inclusion point

This is the other approach. Apparently, it came out to be easier than i expected, so this patch is also small.
Comment 3 Tim-Philipp Müller 2012-04-30 20:39:35 UTC
Pushed, thanks:

 commit 8a962bc1ab6dc749f9bf8fe21e9b1bbbac84ab8b
 Author: Руслан Ижбулатов <lrn1986@gmail.com>
 Date:   Mon Apr 30 20:29:21 2012 +0400

    filesrc: rearrange sys/stat.h inclusion point for MinGW
    
    gstplugin.h used to include this for us, but doesn't any longer.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=675171


I don't think a public header should be including system includes unless that is required for the structs or API exposed in that header, so much prefer the second patch.