GNOME Bugzilla – Bug 585075
Compilation with MSVC fails for files including config.h multiple times
Last modified: 2009-06-10 20:16:56 UTC
Compiling gstreamer-0.10.23 using MVSC fails for "gstregistrybinary.c" and "basesink.c" with the following error: GST_FUNCTION not defined Both files include "gst_private.h" and commenting out '#include "gst_private.h"' in "gstregistrybinary.c" removes the compilation errors (doing the same with basesink.c removes the previous error but throws other errors because of the missing macros defined in "gst_private.h"). I've tryed to look at the recent changes in gst_private.h and gstinfo.h but I've not been able to figure out what causes this issue.
Redefining GST_FUNCTION in both files as done in gst-info.h also solves the compilation errors: #ifndef GST_FUNCTION #if defined (__GNUC__) || (defined (_MSC_VER) && _MSC_VER >= 1300) # define GST_FUNCTION ((const char*) (__FUNCTION__)) #elif defined (__STDC__) && defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L # define GST_FUNCTION ((const char*) (__func__)) #else # define GST_FUNCTION ((const char*) ("???")) #endif #endif It's not a soultion but it may help you to locate the error.
> It's not a soultion but it may help you to locate the error. Quite unlikely that *we* will figure out the error without a way to reproduce it ... What you could try: move the gst_private.h include to the very top, just after the config.h include. Maybe that makes a difference. You could also try removing the 'undef GST_FUNCTION' from the win32/common/config.h (assuming that's the one you use) - I don't think that should make a difference with everything else being correctly included (config.h must always be included first), but then sometimes bugs sneak in. Also try the git version rather than the last release - we might have fixed an include order error or so already (not that I remember something we fixed since the last release, but you never know).
It's weird... but removing 'undef GST_FUNCTION' from the win32/common/config.h header solved the compilation errors. BTW, the 'fsync' function (in gstregistryxml.c) is not defined in MSVCRT and '_commit' should be used instead. AFAIK, the xml registry is going to be removed in the next release, so do I have to fill a bug for this?
gstregistryxml is already removed in git. It shouldn't even (need to) be compiled with any recent GStreamer (with autotools you would need to pass a special configure option to get the old xml registry), the binary registry should be used by default. So no need to do anything about fsync/gstregistryxml. You marked this bug as FIXED - what exactly fixed it now? Does it work with a newer version out of the box? Or do we need to remove the undef GST_FUNCTION from config.h? (if this messes things up this indicates an include order problem - config.h should always be included as the very first header)
It has been fixed by removing 'undef GST_FUNCTION' from config.h. This new line has been added in gstreamer-0.10.23[1] and was the one that was messing everything up. I have seen that this line has also been added in gst-plugins-base-0.10.23 and I also had to remove it in order to get everyhing compiled without errors. I think it should be removed though [1]http://cgit.freedesktop.org/gstreamer/gstreamer/diff/win32/common/config.h?id=646a746965f35abfa298923cdc8fba46d8d7ba71
The idea is to only mark a bug as RESOLVED|FIXED if it is fixed in git and would work fine with a clean checkout, not if you managed to work around it locally :) I fixed it a bit differently, hope it works for you as well: commit 7e9105bca0dc643841376f6c06f2e661ad4eaa2d Author: Tim-Philipp Müller <tim.muller@collabora.co.uk> Date: Wed Jun 10 20:29:41 2009 +0100 Make sure config.h is only included once Fixes build problem on win32 (#585075).
Thank you for explanation about how to mark bugs and for helping me with this issue! I will try to compile from git to see what happens... Cheers Andoni