Mac os:Rails 损坏 - 捆绑包无法工作 - ovirt-engine-sdk - 错误:无法构建 gem 本机扩展

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

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

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

如何在我的 Rails 应用程序中安装/集成 ovirt-engine-sdk?预先感谢您的任何帮助。如果您需要帮助任何其他文件或信息,请告诉我。

ruby-on-rails ruby rubygems ovirt
1个回答
0
投票

我有一个与此非常相似的问题。我跑了

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

随后

bundle install

一切顺利。

© www.soinside.com 2019 - 2024. All rights reserved.