Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running build-aws.ps1 on windows fails with vagrant 2.2.18 #291

Open
matt-richardson opened this issue Oct 28, 2021 · 1 comment
Open

Running build-aws.ps1 on windows fails with vagrant 2.2.18 #291

matt-richardson opened this issue Oct 28, 2021 · 1 comment

Comments

@matt-richardson
Copy link
Contributor

Running build-aws.ps on window 11, using vagrant 2.2.18 fails with a nasty error: conflicting types for 'gettimeofday'

PS > .\build-aws.ps1 -SkipPester
Vagrant installed - good.
AWS CLI installed - good.
Vagrant plugin vagrant-aws not installed.
Installing the 'vagrant-aws' plugin. This can take a few minutes...
Building native extensions. This could take a while...
Vagrant failed to properly resolve required dependencies. These
errors can commonly be caused by misconfigured plugin installations
or transient network issues. The reported error is:

ERROR: Failed to build gem native extension.

    current directory: C:/Users/anon/.vagrant.d/gems/2.7.4/gems/ovirt-engine-sdk-4.4.1/ext/ovirtsdk4c
C:/HashiCorp/Vagrant/embedded/mingw64/bin/ruby.exe -I C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.7.0 -r ./siteconf20211028-19688-x6r1d6.rb extconf.rb
checking for xml2-config... no
checking for curl-config... no
creating Makefile

current directory: C:/Users/anon/.vagrant.d/gems/2.7.4/gems/ovirt-engine-sdk-4.4.1/ext/ovirtsdk4c
make "DESTDIR=" clean
bash.exe: warning: could not find /tmp, please create!

current directory: C:/Users/anon/.vagrant.d/gems/2.7.4/gems/ovirt-engine-sdk-4.4.1/ext/ovirtsdk4c
make "DESTDIR="
generating ovirtsdk4c-x64-mingw32.def
bash.exe: warning: could not find /tmp, please create!
compiling ov_error.c
compiling ov_http_client.c
In file included from ov_http_client.c:26:
C:/HashiCorp/Vagrant/embedded/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:/HashiCorp/Vagrant/embedded/mingw64/include/ruby-2.7.0/ruby/defines.h:371,
                 from C:/HashiCorp/Vagrant/embedded/mingw64/include/ruby-2.7.0/ruby/ruby.h:29,
                 from C:/HashiCorp/Vagrant/embedded/mingw64/include/ruby-2.7.0/ruby.h:33,
                 from ov_http_client.c:17:
C:/HashiCorp/Vagrant/embedded/mingw64/include/ruby-2.7.0/ruby/win32.h:318:12: note: previous declaration of 'gettimeofday' was here
  318 | extern int gettimeofday(struct timeval *, struct timezone *);
      |            ^~~~~~~~~~~~
ov_http_client.c:216:29: warning: excess elements in array initializer
  216 |         .reserved = { NULL, NULL }
      |                             ^~~~
ov_http_client.c:216:29: note: (near initialization for 'ov_http_client_type.function.reserved')
ov_http_client.c: In function 'ov_http_client_prepare_handle':
ov_http_client.c:1001:47: warning: passing argument 2 of 'rb_hash_foreach' from incompatible pointer type [-Wincompatible-pointer-types]
 1001 |         rb_hash_foreach(request_ptr->headers, ov_http_client_add_header, (VALUE) headers);
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                               |
      |                                               int (*)(VALUE,  VALUE,  struct curl_slist **) {aka int (*)(long long unsigned int,  long long unsigned int,  struct curl_slist **)}
In file included from C:/HashiCorp/Vagrant/embedded/mingw64/include/ruby-2.7.0/ruby/ruby.h:2148,
                 from C:/HashiCorp/Vagrant/embedded/mingw64/include/ruby-2.7.0/ruby.h:33,
                 from ov_http_client.c:17:
C:/HashiCorp/Vagrant/embedded/mingw64/include/ruby-2.7.0/ruby/intern.h:558:29: note: expected 'int (*)(VALUE,  VALUE,  VALUE)' {aka 'int (*)(long long unsigned int,  long long unsigned int,  long long unsigned int)'} but argument is of type 'int (*)(VALUE,  VALUE,  struct curl_slist **)' {aka 'int (*)(long long unsigned int,  long long unsigned int,  struct curl_slist **)'}
  558 | void rb_hash_foreach(VALUE, int (*)(VALUE, VALUE, VALUE), VALUE);
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:245: ov_http_client.o] Error 1

make failed, exit code 2

Gem files will remain installed in C:/Users/anon/.vagrant.d/gems/2.7.4/gems/ovirt-engine-sdk-4.4.1 for inspection.
Results logged to C:/Users/anon/.vagrant.d/gems/2.7.4/extensions/x64-mingw32/2.7.0/ovirt-engine-sdk-4.4.1/gem_make.out
@matt-richardson
Copy link
Contributor Author

Solution Hacky workaround is to edit C:\HashiCorp\Vagrant\embedded\mingw64\x86_64-w64-mingw32\include\sys\time.h and change:

#ifndef _GETTIMEOFDAY_DEFINED
#define _GETTIMEOFDAY_DEFINED
int __cdecl gettimeofday(struct timeval *__restrict__,
                         void *__restrict__  /* tzp (unused) */);
#endif

to

#ifndef _GETTIMEOFDAY_DEFINED
#define _GETTIMEOFDAY_DEFINED
//int __cdecl gettimeofday(struct timeval *__restrict__,
//                         void *__restrict__  /* tzp (unused) */);
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant