Mac os: Rails broken - bundle not working - ovirt-engine-sdk - ERROR: Failed to build gem native extension

161 Views Asked by At

I'm trying to use ovirt-engine-sdk gem in my rails(6) application. bundle install is failing in my mac machine. As per the PR's the gem should work with ruby 3.x versions but i'm getting following error when i do bundle install

Installing ovirt-engine-sdk 4.6.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/xxx/.rvm/gems/ruby-3.0.0/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
/Users/xxx/.rvm/rubies/ruby-3.0.0/bin/ruby -I /Users/sh077503/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0 -r ./siteconf20240306-89931-47eohb.rb extconf.rb
checking for xml2-config... yes
checking for curl-config... yes
creating Makefile

current directory: /Users/xxx/.rvm/gems/ruby-3.0.0/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
make "DESTDIR=" clean

current directory: /Users/xxx/.rvm/gems/ruby-3.0.0/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
make "DESTDIR="
compiling ov_error.c
compiling ov_http_client.c
ov_http_client.c:216:29: warning: excess elements in array initializer [-Wexcess-initializers]
        .reserved = { NULL, NULL }
                            ^~~~
/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/stddef.h:89:16: note: expanded from macro 'NULL'
#  define NULL ((void*)0)
               ^~~~~~~~~~
ov_http_client.c:501:9: error: call to undeclared function 'ruby_thread_has_gvl_p'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    if (ruby_thread_has_gvl_p()) {
        ^
ov_http_client.c:853:25: warning: implicit conversion from enumeration type 'CURLMcode' to different enumeration type 'CURLcode' [-Wenum-conversion]
    context_ptr->code = curl_multi_wait(context_ptr->handle, NULL, 0, timeout, NULL);
                      ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ov_http_client.c:874:25: warning: implicit conversion from enumeration type 'CURLMcode' to different enumeration type 'CURLcode' [-Wenum-conversion]
    context_ptr->code = curl_multi_perform(context_ptr->handle, &pending);
                      ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ov_http_client.c:1009:47: warning: incompatible function pointer types passing 'int (VALUE, VALUE, struct curl_slist **)' (aka 'int (unsigned long, unsigned long, struct curl_slist **)')
to parameter of type 'int (*)(VALUE, VALUE, VALUE)' (aka 'int (*)(unsigned long, unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
        rb_hash_foreach(request_ptr->headers, ov_http_client_add_header, (VALUE) headers);
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sh077503/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/ruby/internal/intern/hash.h:33:35: note: passing argument to parameter here
void rb_hash_foreach(VALUE, int (*)(VALUE, VALUE, VALUE), VALUE);
                                  ^
4 warnings and 1 error generated.
make: *** [ov_http_client.o] Error 1

make failed, exit code 2

How can i install/integrate ovirt-engine-sdk in my rails application? Thanks in advance for any help. Please let me know if there are any other files or information you need to assist.

1

There are 1 best solutions below

0
William Jones On

I had a very similar problem to this. I ran

gem install ovirt-engine-sdk -- --with-cflags="-Wno-error=implicit-function-declaration”

followed by

bundle install

and everything worked.