Bug 324198 (MONO81520) - [PATCH] Mono does not build with latest eglib on Mac OS X
Summary: [PATCH] Mono does not build with latest eglib on Mac OS X
Status: RESOLVED FIXED
Alias: MONO81520
Product: Mono: Runtime
Classification: Mono
Component: misc (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: MONO81456
  Show dependency treegraph
 
Reported: 2007-05-02 22:58 UTC by Andreas Färber
Modified: 2007-11-06 15:07 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Proposed diff of fix (1.37 KB, patch)
2007-05-02 23:36 UTC, Thomas Wiest
Details | Diff
Patch with old version non msvc builds (3.38 KB, patch)
2007-05-03 23:31 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:37:26 UTC


---- Reported by andreas.faerber@web.de 2007-05-02 15:58:53 MST ----

Description of Problem:
Recent eglib changes lead to compilation failure of Mono on OS X (ppc64).

Steps to reproduce the problem:
1. patch eglib to compile on OS X (#81456)
2. configure Mono to use eglib
3. compile Mono

Actual Results:
...
mono-logger.c: In function 'mono_trace_push':
mono-logger.c:144: error: parse error before ')' token
mono-logger.c:147: error: 'entry' undeclared (first use in this function)
mono-logger.c:147: error: (Each undeclared identifier is reported only 
once
mono-logger.c:147: error: for each function it appears in.)
mono-logger.c: At top level:
mono-logger.c:157: error: parse error before '}' token
mono-logger.c: In function 'mono_trace_pop':
mono-logger.c:168: error: parse error before ')' token
mono-logger.c:175: error: 'entry' undeclared (first use in this function)
mono-logger.c: At top level:
mono-logger.c:180: error: parse error before '}' token
make[3]: *** [mono-logger.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Expected Results:
No compilation error in mono-logger.c

How often does this happen? 
Every time.

Additional Information:
r76209 has made the following signature change in glib.h for g_error 
(used in mono-logger.c:144):
-#define g_error(format...)    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, 
format)
+#define g_error(format, ...)    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, 
format, __VA_ARGS__)
This seems to break invocations not specifying additional parameters.



---- Additional Comments From joncham@gmail.com 2007-05-02 16:36:50 MST ----

Created an attachment (id=171904)
Proposed diff of fix




---- Additional Comments From joncham@gmail.com 2007-05-02 16:37:31 MST ----

Andreas, does the patch work for you? eglib builds and tests run with
changes on Windows and Linux but I have no Mac to try on.



---- Additional Comments From andreas.faerber@web.de 2007-05-02 16:55:21 MST ----

Yes, it does! I tried for g_error only and it appeared to compile fine.



---- Additional Comments From joncham@gmail.com 2007-05-02 17:02:55 MST ----

Ok, thanks. I couldn't try it as I can't link mono with eglib on
Linux64 but I don't think that's related to this.



---- Additional Comments From lupus@ximian.com 2007-05-03 10:52:32 MST ----

g_printerr has the same issue and it is not handled.
Proper test cases should be added to the test suite for each of these
macros before changes are committed.
It is also very likely that some compilers require the previous
version of the code, so add a configure.in check and use it in the header.



---- Additional Comments From andreas.faerber@web.de 2007-05-03 15:12:41 MST ----

Paolo, did you see that on OS X? I did not notice, and as mentioned
in https://bugzilla.novell.com/show_bug.cgi?id=MONO81456 for me eglib/test/
does not work at all as is.  Could you please comment on how to fix it
in an SVN-acceptable manner?

Where should the macro tests be added and what exactly should be checked with autoconf? 
(or do you know, Jonathan?)
And throwing an error as part of the test suite is probably not the best of all ideas (assuming 
it would lead make to abort), while a statement such as if (0) g_error(""); might be optimized 
away?



---- Additional Comments From joncham@gmail.com 2007-05-03 15:56:01 MST ----

I have some autoconf macros that work, but I'm not sure what to do
with them. The g_* macros in question are part of the public API,
exposed in glib.h. glib.h includes eglib-config.h, not config.h. So,
should the HAVE_C99_SUPPORT flag go in eglib-config.h? Does compile
specific options go in eglib-config.h, or just system specific?



---- Additional Comments From joncham@gmail.com 2007-05-03 16:31:58 MST ----

Created an attachment (id=171905)
Patch with old version non msvc builds




---- Additional Comments From joncham@gmail.com 2007-05-03 16:34:58 MST ----

Added a patch that restores old methodology for non-msvc builds. I did
leave g_printerr alone since it seems from the glib documentation it
is different than the others, i.e. g_error(...) vs g_printerr(const
gchar* format, ...)

http://developer.gnome.org/doc/API/2.0/glib/glib-Warnings-and-Assertions.html#g-printerr
and
http://developer.gnome.org/doc/API/2.0/glib/glib-Message-Logging.html#g-error

I also added a test case, only using g_message to avoid termination of
tests.

This bug blocked bug(s) 81456.
Imported an attachment (id=171904)
Imported an attachment (id=171905)

Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>Mac OS X v10.4.9 ppc64</cf_op_sys_details>
Unknown operating system other. Setting to default OS "Other".

Comment 1 Andreas Färber 2007-09-18 20:46:39 UTC
In

https://bugzilla.novell.com/show_bug.cgi?id=324135

the latest snapshot reverts the vararg changes for all platforms except Windows. Please review.
Comment 2 Miguel de Icaza 2007-11-03 19:05:13 UTC
Question, it seems that the bulk of this patch was applied to trunk in the past few months, but am still getting errors trying to compile code that contains g_error in Mono with embedded glib. 
Comment 3 Andreas Färber 2007-11-03 21:16:05 UTC
Well, my changes as linked in (new) comment #1 are not applied it seems. Comments to get them in shape and applied would be appreciated.

I just updated my working copy and I get this error instead:
../../../../mono/mono/utils/strtod.c:24: error: parse error before 'str_mutex'
../../../../mono/mono/utils/strtod.c:24: warning: type defaults to 'int' in declaration of 'str_mutex'
../../../../mono/mono/utils/strtod.c:24: error: 'G_STATIC_MUTEX_INIT' undeclared here (not in a function)
../../../../mono/mono/utils/strtod.c:24: warning: data definition has no type or storage class
../../../../mono/mono/utils/strtod.c: In function 'Balloc':
../../../../mono/mono/utils/strtod.c:533: warning: implicit declaration of function 'g_static_mutex_lock'
../../../../mono/mono/utils/strtod.c:533: warning: nested extern declaration of 'g_static_mutex_lock'
../../../../mono/mono/utils/strtod.c:554: warning: implicit declaration of function 'g_static_mutex_unlock'
../../../../mono/mono/utils/strtod.c:554: warning: nested extern declaration of 'g_static_mutex_unlock'
Comment 4 Jonathan Chambers 2007-11-03 21:20:19 UTC
I have a patch for this error on the mono-devel mailing list (part of Win64 Patch II):

http://lists.ximian.com/pipermail/mono-devel-list/2007-October/025436.html 
Comment 5 Geoff Norton 2007-11-06 15:07:25 UTC
Fixed in SVN