oj: Version 3.13.0 can't be installed on Windows ('gettimeofday' conflicting types)

The issue described in #94 is back with 3.13.0 - probably, because a new parser has been introduced. I’m observing this on Windows 10x64 with Ruby 2.7 and 3.0 (and the latest mingw toolchain):

make DESTDIR\=
generating oj-x64-mingw32.def
compiling cache.c
compiling cache8.c
compiling circarray.c
compiling code.c
compiling compat.c
compiling custom.c
compiling debug.c
compiling dump.c
compiling dump_compat.c
compiling dump_leaf.c
compiling dump_object.c
compiling dump_strict.c
compiling err.c
compiling fast.c
fast.c: In function 'parse_json':
fast.c:776:20: warning: array subscript -16384 is outside array bounds of 'struct _parseInfo[1]' [-Warray-bounds]
  776 |     pi.stack_min = (void *)((char *)&pi - (512 * 1024));
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fast.c:752:23: note: while referencing 'pi'
  752 |     struct _parseInfo pi;
      |                       ^~
compiling hash_test.c
compiling intern.c
compiling mimic_json.c
compiling object.c
compiling odd.c
compiling oj.c
compiling parse.c
compiling parser.c
In file included from parser.c:18:
C:/Ruby30-x64/msys64/mingw64/x86_64-w64-mingw32/include/sys/time.h:42:13: error: conflicting types for 'gettimeofday'
   42 | int __cdecl gettimeofday(struct timeval *__restrict__,
      |             ^~~~~~~~~~~~
In file included from C:/Ruby30-x64/include/ruby-3.0.0/ruby/internal/dosish.h:38,
                 from C:/Ruby30-x64/include/ruby-3.0.0/ruby/defines.h:79,
                 from C:/Ruby30-x64/include/ruby-3.0.0/ruby/ruby.h:23,
                 from C:/Ruby30-x64/include/ruby-3.0.0/ruby.h:38,
                 from parser.h:8,
                 from parser.c:3:
C:/Ruby30-x64/include/ruby-3.0.0/ruby/win32.h:304:12: note: previous declaration of 'gettimeofday' was here
  304 | extern int gettimeofday(struct timeval *, struct timezone *);
      |            ^~~~~~~~~~~~
make: *** [Makefile:245: parser.o] Error 1

make failed, exit code 2

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Quite alright. It would only be to run the tests and give me the results.

The gettimeofday issue really looks to be an environmental one though where the mingw64 has a conflict with ruby and I’m not sure how to deal with that one other than to avoid using it which might be very easy since it is only used in the hash_test.c which is not needed anyway.