Ruby declares gettimeofday() on Windows, but the function is also declared in mingw-w64's sys/time.h. Both definitions are incompatible and extension builds fail, if both ruby.h and sys/time.h are included. This is the related error message from rake gem:native of the grpc gem:
compiling ../../../../src/ruby/ext/grpc/rb_byte_buffer.c
In file included from ../../../../src/ruby/ext/grpc/rb_grpc.h:23:0,
from ../../../../src/ruby/ext/grpc/rb_byte_buffer.c:27:
/usr/share/mingw-w64/include/sys/time.h:42:13: error: conflicting types for 'gettimeofday'
int __cdecl gettimeofday(struct timeval *__restrict__,
^~~~~~~~~~~~
In file included from /usr/local/rake-compiler/ruby/i686-w64-mingw32/ruby-2.7.0/include/ruby-2.7.0/ruby/defines.h:371:0,
from /usr/local/rake-compiler/ruby/i686-w64-mingw32/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:29,
from ../../../../src/ruby/ext/grpc/rb_byte_buffer.c:19:
/usr/local/rake-compiler/ruby/i686-w64-mingw32/ruby-2.7.0/include/ruby-2.7.0/ruby/win32.h:318:12: note: previous declaration of 'gettimeofday' was here
extern int gettimeofday(struct timeval *, struct timezone *);
^~~~~~~~~~~~
Ruby declares
gettimeofday()
on Windows, but the function is also declared in mingw-w64'ssys/time.h
. Both definitions are incompatible and extension builds fail, if bothruby.h
andsys/time.h
are included. This is the related error message fromrake gem:native
of the grpc gem: