oVirt / ovirt-engine-sdk-ruby

Ruby gem that simplyfies access to the oVirt Engine API
20 stars 13 forks source link

Errors and warnings when trying to install ovirt-engine-sdk 4.6.0 #13

Open eremeyev opened 8 months ago

eremeyev commented 8 months ago

Gemfile:

# frozen_string_literal: true

source "https://rubygems.org"
ruby '3.1.3'

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# gem "rails"
gem 'fog'

rvm: ruby-3.1.3
bundler: 2.3.26

bundle install


Installing ovirt-engine-sdk 4.6.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: ~/.rvm/gems/ruby-3.1.3/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c

~/.rvm/rubies/ruby-3.1.3/bin/ruby -I /Users/andrey/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0 extconf.rb checking for xml2-config... yes checking for curl-config... yes creating Makefile

current directory: ~/.rvm/gems/ruby-3.1.3/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c make DESTDIR\= sitearchdir\=./.gem.20240321-53278-s4ujn4 sitelibdir\=./.gem.20240321-53278-s4ujn4 clean

current directory: ~/.rvm/gems/ruby-3.1.3/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c make DESTDIR\= sitearchdir\=./.gem.20240321-53278-s4ujn4 sitelibdir\=./.gem.20240321-53278-s4ujn4 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 } ^~~~ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/stddef.h:89:16: note: expanded from macro 'NULL'

define NULL ((void*)0)

           ^~~~~~~~~~

ov_http_client.c:272:39: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] count = INT2NUM(context_ptr->size * context_ptr->nmemb);


ov_http_client.c:392:33: warning: comparison of integers of different signs: 'long' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
        while (pointer - buffer < length && isspace(*pointer)) {
               ~~~~~~~~~~~~~~~~ ^ ~~~~~~
ov_http_client.c:501:9: error: implicit declaration of function 'ruby_thread_has_gvl_p' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if (ruby_thread_has_gvl_p()) {
        ^
ov_http_client.c:659:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    ptr->limit = connections;
               ~ ^~~~~~~~~~~
ov_http_client.c:853:71: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    context_ptr->code = curl_multi_wait(context_ptr->handle, NULL, 0, timeout, NULL);
                        ~~~~~~~~~~~~~~~                               ^~~~~~~
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/andrey/.rvm/rubies/ruby-3.1.3/include/ruby-3.1.0/ruby/internal/intern/hash.h:83:40: note: passing argument to parameter 'func' here
void rb_hash_foreach(VALUE hash, int (*func)(VALUE key, VALUE val, VALUE arg), VALUE arg);
                                       ^
ov_http_client.c:1100:34: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
    if (RHASH_SIZE(ptr->pending) < ptr->limit) {
        ~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
ov_http_client.c:1126:71: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
        while (RARRAY_LEN(ptr->queue) > 0 && RHASH_SIZE(ptr->pending) < ptr->limit) {
                                             ~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
8 warnings and 1 error generated.
make: *** [ov_http_client.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/andrey/.rvm/gems/ruby-3.1.3/gems/ovirt-engine-sdk-4.6.0 for inspection.
Results logged to ~/.rvm/gems/ruby-3.1.3/extensions/x86_64-darwin-21/3.1.0/ovirt-engine-sdk-4.6.0/gem_make.out

  ~/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/rubygems/ext/builder.rb:102:in `run'
  ~/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/rubygems/ext/builder.rb:51:in `block in make'
  ~/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/rubygems/ext/builder.rb:43:in `each'
  ~/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/rubygems/ext/builder.rb:43:in `make'
  ~/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:42:in `build'
  ~/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/rubygems/ext/builder.rb:171:in `build_extension'
  ~/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/rubygems/ext/builder.rb:205:in `block in build_extensions'
  ~/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/rubygems/ext/builder.rb:202:in `each'
  ~/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/rubygems/ext/builder.rb:202:in `build_extensions'
  ~/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/rubygems/installer.rb:843:in `build_extensions'
  ~/.rvm/gems/ruby-3.1.3/gems/bundler-2.3.26/lib/bundler/rubygems_gem_installer.rb:72:in `build_extensions'
  ~/.rvm/gems/ruby-3.1.3/gems/bundler-2.3.26/lib/bundler/rubygems_gem_installer.rb:28:in `install'
  ~/.rvm/gems/ruby-3.1.3/gems/bundler-2.3.26/lib/bundler/source/rubygems.rb:207:in `install'
  ~/.rvm/gems/ruby-3.1.3/gems/bundler-2.3.26/lib/bundler/installer/gem_installer.rb:54:in `install'
  ~/.rvm/gems/ruby-3.1.3/gems/bundler-2.3.26/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  ~/.rvm/gems/ruby-3.1.3/gems/bundler-2.3.26/lib/bundler/installer/parallel_installer.rb:186:in `do_install'
  ~/.rvm/gems/ruby-3.1.3/gems/bundler-2.3.26/lib/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  ~/.rvm/gems/ruby-3.1.3/gems/bundler-2.3.26/lib/bundler/worker.rb:62:in `apply_func'
  ~/.rvm/gems/ruby-3.1.3/gems/bundler-2.3.26/lib/bundler/worker.rb:57:in `block in process_queue'
  ~/.rvm/gems/ruby-3.1.3/gems/bundler-2.3.26/lib/bundler/worker.rb:54:in `loop'
  ~/.rvm/gems/ruby-3.1.3/gems/bundler-2.3.26/lib/bundler/worker.rb:54:in `process_queue'
  ~/.rvm/gems/ruby-3.1.3/gems/bundler-2.3.26/lib/bundler/worker.rb:91:in `block (2 levels) in create_threads'

An error occurred while installing ovirt-engine-sdk (4.6.0), and Bundler cannot continue.

In Gemfile:
  fog was resolved to 2.3.0, which depends on
    fog-ovirt was resolved to 2.0.2, which depends on
      ovirt-engine-sdk
```
jimmy8646 commented 7 months ago

I encountered the same issue, but I eventually switched to using the fog-aws gem instead of fog, which allowed me to successfully complete the bundle install.

jimmy8646 commented 7 months ago

@eremeyev I just successfully resolved this issue. Have you tried the command gem install ovirt-engine-sdk -- --with-cflags="-Wno-error=implicit-function-declaration" to check if the gem installs correctly? Make sure your clang version is 14. Here is the process that worked for me:

clang --version # Check that the version should be 14
gem install ovirt-engine-sdk -- --with-cflags="-Wno-error=implicit-function-declaration"
siddushar commented 7 months ago

@jimmy8646 the command gem install ovirt-engine-sdk -- --with-cflags="-Wno-error=implicit-function-declaration" works on mac x86_64 device but it does not work on mac ARM64 device

jimmy8646 commented 7 months ago

@siddushar Ummm strange I'm ARM 64 device do you have any error messages? CleanShot 2024-04-20 at 03 24 36

jrafanie commented 6 months ago

See https://github.com/oVirt/ovirt-engine-sdk-ruby/issues/11#issuecomment-2098807108

I had two types of warnings that were errors for me.

gem install ovirt-engine-sdk -v4.6.0 -- --with-cflags="-Wno-error=incompatible-function-pointer-types -Wno-error=implicit-function-declaration"
ahrechushkin commented 2 months ago

@jrafanie thanks!

❯ gem install ovirt-engine-sdk -v4.6.0 -- --with-cflags="-Wno-error=incompatible-function-pointer-types -Wno-error=implicit-function-declaration"  14:14:58
Building native extensions with: '--with-cflags=-Wno-error=incompatible-function-pointer-types -Wno-error=implicit-function-declaration'
This could take a while...
Successfully installed ovirt-engine-sdk-4.6.0
Parsing documentation for ovirt-engine-sdk-4.6.0
Installing ri documentation for ovirt-engine-sdk-4.6.0
Done installing documentation for ovirt-engine-sdk after 6 seconds
1 gem installed
kevin-archie commented 1 month ago

You saved my day! @jrafanie

This solution works perfectly on macOS ARM64 with Clang 15.

See #11 (comment)

I had two types of warnings that were errors for me.

gem install ovirt-engine-sdk -v4.6.0 -- --with-cflags="-Wno-error=incompatible-function-pointer-types -Wno-error=implicit-function-declaration"