From: Luis Lavena Date: 2011-12-14T20:35:08+09:00 Subject: [ruby-core:41651] [ruby-trunk - Bug #5724][Rejected] date_core compiling issues with MinGW GCC 4.6 Issue #5724 has been updated by Luis Lavena. Status changed from Open to Rejected This was caused by a bug of mingw-w64's GCC 4.6 and not Ruby. ---------------------------------------- Bug #5724: date_core compiling issues with MinGW GCC 4.6 http://redmine.ruby-lang.org/issues/5724 Author: Luis Lavena Status: Rejected Priority: Normal Assignee: tadayoshi funaba Category: ext Target version: ruby -v: - Hello, I'm having problems building date_core.c with GCC 4.6 from mingw-w64 project:
make[2]: Entering directory `/c/Users/Luis/projects/oss/oneclick/rubyinstaller/sandbox/ruby19_build/ext/date'
generating date_core-i386-mingw32.def
compiling ../../../../../../ruby/ext/date/date_core.c
../../../../../../ruby/ext/date/date_core.c:3572:1: error: expected identifier or '(' before '{' token
make[2]: *** [date_core.o] Error 1
make[2]: Leaving directory `/c/Users/Luis/projects/oss/oneclick/rubyinstaller/sandbox/ruby19_build/ext/date'
make[1]: *** [ext/date/all] Error 2
The issue seems to be associated with this piece of code: =begin #if !defined(HAVE_GMTIME_R) static struct tm* localtime_r(const time_t *t, struct tm *tm) { auto struct tm *tmp = localtime(t); if (tmp) *tm = *tmp; return tmp; } #endif =end The following piece of code shows the same issue: =begin #include #include static struct tm* localtime_r(const time_t *t, struct tm *a) { auto struct tm *tmp = localtime(t); if (tmp) *a = *tmp; return tmp; } int main(void) { return 0; } =end Now, trying the same with clang shows more details:
C:\Users\Luis\projects\sandbox>clang t.c -o t.exe
t.c:5:1: error: expected identifier or '('
localtime_r(const time_t *t, struct tm *tm)
^
C:/Users/Luis/Tools/DevKit/4.6.3-w32/mingw/bin/../lib/clang/3.1/../../../i686-w64-mingw32/include\pthread.h:411:34: note:
      expanded from macro 'localtime_r'
#define localtime_r(_Time, _Tm) ({ struct tm *___tmp_tm;                \
                                 ^
t.c:5:1: error: expected ')'
localtime_r(const time_t *t, struct tm *tm)
^
C:/Users/Luis/Tools/DevKit/4.6.3-w32/mingw/bin/../lib/clang/3.1/../../../i686-w64-mingw32/include\pthread.h:411:34: note:
      expanded from macro 'localtime_r'
#define localtime_r(_Time, _Tm) ({ struct tm *___tmp_tm;                \
                                 ^
t.c:5:1: note: to match this '('
localtime_r(const time_t *t, struct tm *tm)
^
C:/Users/Luis/Tools/DevKit/4.6.3-w32/mingw/bin/../lib/clang/3.1/../../../i686-w64-mingw32/include\pthread.h:411:33: note:
      expanded from macro 'localtime_r'
#define localtime_r(_Time, _Tm) ({ struct tm *___tmp_tm;                \
                                ^
2 errors generated.
Perhaps is missing a check for localtime_r in configure instead? -- http://redmine.ruby-lang.org