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 568632 - __MSVCRT_VERSION__ not defined with mingw, causing "storage size of 'stat_results' isn't known" compile error
__MSVCRT_VERSION__ not defined with mingw, causing "storage size of 'stat_res...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Windows
: Normal blocker
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 568828 576018 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-01-22 00:20 UTC by LRN
Modified: 2009-04-17 15:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixes the lack of proper __MSVCRT_VERSION__ constant (826 bytes, patch)
2009-02-20 19:20 UTC, LRN
none Details | Review
Same as before, but instead of changing the #include order in gst.c it includes config.h directly (718 bytes, patch)
2009-02-20 19:42 UTC, LRN
none Details | Review
same as before but without chunk that's already been fixed (454 bytes, patch)
2009-04-16 23:07 UTC, Tim-Philipp Müller
none Details | Review
alternative patch (1.18 KB, patch)
2009-04-17 12:48 UTC, Tim-Philipp Müller
committed Details | Review

Description LRN 2009-01-22 00:20:34 UTC
__MSVCRT_VERSION__ is a constant that tells mingw which version of MSVCR is required by the application. When it is not defined, it is defaulted to 0x0600 in _mingw.h system header.
However, gstreamer uses a feature that, according to mingw headers, are only available in MSVCR versions newer than 60 (the __stat64 structure).
This appeared at devel mailing list, but never made it to the bug tracker -  http://www.nabble.com/gstreamer-mingw32-__stat64-td19835510.html

My opinion is that __MSVCRT_VERSION__ should be defined as 0x0601 in config.h or in gst.h
Comment 1 David Schleef 2009-01-23 17:37:41 UTC
*** Bug 568828 has been marked as a duplicate of this bug. ***
Comment 2 LRN 2009-01-24 00:04:00 UTC
Defining __MSVCRT_VERSION__ in config.h works only if config.h is included first.
For that gst/gst.c has to be modified to include gst_private.h before gstconfig.h
Alternatively you can #undef __MSVCRT_VERSION__ before defining it.
Comment 3 LRN 2009-02-20 19:20:48 UTC
Created attachment 129175 [details] [review]
Fixes the lack of proper __MSVCRT_VERSION__ constant

Adds __MSVCRT_VERSION__ definition to config.h (regenerate configure script with autogen.sh)

Includes gst_private.h before gstconfig.h. gstconfig.h pulls parser.h and, eventually, stat.h, but we need __MSVCRT_VERSION__ defined before stat.h is included. __MSVCRT_VERSION__ is defined in config.h, so it has to be included before stat.h, that is - before gstconfig.h . gst_private.h does just that.
Alternatively you can include config.h directly from gst.c, before both gstconfig.h and gst_private.h.
Comment 4 David Schleef 2009-02-20 19:31:54 UTC
config.h is supposed to be included first, always.  Anywhere this is not the case should be fixed.  Back in the day, we had a script that checked for this.

Since fixing those might take a while, it might be better to define __MSVCRT_VERSION__ using a -D in CFLAGS.
Comment 5 LRN 2009-02-20 19:42:14 UTC
Created attachment 129177 [details] [review]
Same as before, but instead of changing the #include order in gst.c it includes config.h directly
Comment 6 Tim-Philipp Müller 2009-04-16 23:00:31 UTC
*** Bug 576018 has been marked as a duplicate of this bug. ***
Comment 7 Tim-Philipp Müller 2009-04-16 23:07:03 UTC
Created attachment 132799 [details] [review]
same as before but without chunk that's already been fixed

The config.h include problem has already been fixed, so updating patch.
Comment 8 Tim-Philipp Müller 2009-04-16 23:20:19 UTC
Since this causes compile errors, we should try to get it into the release as well IMHO. Jan?
Comment 9 Tim-Philipp Müller 2009-04-17 12:48:21 UTC
Created attachment 132823 [details] [review]
alternative patch

Not sure if we should re-define this preprocessor symbol in case the compiler already provides it. Here's an alternative patch that checks if it's set by the compiler and only defines the symbol if the compiler doesn't provide it.
Comment 10 Jan Schmidt 2009-04-17 13:18:56 UTC
Sounds like a sensible idea. Maybe someone on Windows can confirm if this works for them?
Comment 11 LRN 2009-04-17 14:27:16 UTC
Works for me.
Comment 12 Jan Schmidt 2009-04-17 14:40:43 UTC
great, thanks for confirming
Comment 13 Tim-Philipp Müller 2009-04-17 15:08:56 UTC
commit 923b33a31684e736d9a5ed958ca501bdc16e90d6
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Fri Apr 17 15:46:52 2009 +0100

    win32: define __MSVCRT_VERSION__ when compiling with MingW, for __stat64
    
    Need to define this when using MingW, so that the includes provide
    __stat64 and friends. We need at least Windows XP SP2 for this.
    Fixes #568632.