Mac ARM 设备:Rails 损坏 - 捆绑包无法工作 - ovirt-engine-sdk

问题描述 投票:0回答:1

我正在尝试在我的 Rails(6) 应用程序中使用 ovirt-engine-sdk gem。在我的 mac ARM64 机器上捆绑安装失败。根据 gem 文档,gem 应该与 ruby 3.x 版本一起使用,但是当我进行捆绑安装时,我收到以下错误

gem install ovirt-engine-sdk 
Building native extensions with: '--with-opt-dir=/opt/homebrew/opt/openssl@3 --with-ldflags=-L/opt/homebrew/opt/zstd/lib --with-cflags=-Wno-error=implicit-function-declaration'
This could take a while...
ERROR:  Error installing ovirt-engine-sdk:
  ERROR: Failed to build gem native extension.

    current directory: /Users/ljehle/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
/Users/ljehle/.rbenv/versions/3.0.0/bin/ruby -I /Users/ljehle/.rbenv/versions/3.0.0/lib/ruby/3.0.0 -r ./siteconf20240416-66199-2y5wag.rb extconf.rb --with-opt-dir\=/opt/homebrew/opt/openssl@3 --with-ldflags\=-L/opt/homebrew/opt/zstd/lib --with-cflags\=-Wno-error\=implicit-function-declaration
checking for xml2-config... yes
checking for curl-config... yes
creating Makefile

current directory: /Users/ljehle/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/ovirt-engine-sdk-4.6.0/ext/ovirtsdk4c
make "DESTDIR=" clean

current directory: /Users/ljehle/.rbenv/versions/3.0.0/lib/ruby/gems/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: warning: 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: error: 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/ljehle/.rbenv/versions/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

Gem files will remain installed in /Users/ljehle/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/ovirt-engine-sdk-4.6.0 for inspection.
Results logged to /Users/ljehle/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/extensions/arm64-darwin-23/3.0.0/ovirt-engine-sdk-4.6.0/gem_make.out
ruby-on-rails ruby rubygems ovirt
1个回答
0
投票

显然,Ruby 3 对这个 gem 的支持仍在进行中,请参阅以下拉取请求:https://github.com/oVirt/ovirt-engine-sdk-ruby/pull/10。事实上,如果您查看更改,C 扩展中存在一些更改,这些更改与

ruby_thread_has_gvl_p
函数的使用有关。

同时,您可以在 Gemfile 中指向该 GitHub 分支,这样您就可以测试修复:

gem "ovirt-engine-sdk", github: "jhernand/ovirt-engine-sdk-ruby", branch: "update_to_ruby_3"
© www.soinside.com 2019 - 2024. All rights reserved.