Gem::Ext::BuildError:错误:无法构建gem本机扩展unicode.c:1058:20:[-Win兼容函数指针类型]

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

有关我的环境的一些详细信息:

  • Ruby版本:Ruby 3.2.0
  • RubyGems 版本:3.5.6
  • rbenv版本:1.2.0
  • MacOS:索诺玛 14.1.2 / M2

我正在尝试运行 bundle install 为我的项目安装 gem,但出现以下错误:

Installing unicode 0.4.4.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/unicode-0.4.4.4/ext/unicode
/Users/john.doe/.rbenv/versions/3.2.0/bin/ruby -I /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0 extconf.rb --with-cflags\=-Wno-error\=implicit-function-declaration
creating Makefile

current directory: /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/unicode-0.4.4.4/ext/unicode
make DESTDIR\= sitearchdir\=./.gem.20240308-48017-ak1bt1 sitelibdir\=./.gem.20240308-48017-ak1bt1 clean

current directory: /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/unicode-0.4.4.4/ext/unicode
make DESTDIR\= sitearchdir\=./.gem.20240308-48017-ak1bt1 sitelibdir\=./.gem.20240308-48017-ak1bt1
compiling unicode.c
unicode.c:37:7: warning: 'RB_OBJ_TAINTED' is deprecated: taintedness turned out to be a wrong idea. [-Wdeprecated-declarations]
  if (OBJ_TAINTED(src))
      ^
/Users/john.doe/.rbenv/versions/3.2.0/include/ruby-3.2.0/ruby/internal/fl_type.h:151:25: note: expanded from macro 'OBJ_TAINTED'
#define OBJ_TAINTED     RB_OBJ_TAINTED     /**< @old{RB_OBJ_TAINTED} */
                        ^
/Users/john.doe/.rbenv/versions/3.2.0/include/ruby-3.2.0/ruby/internal/fl_type.h:118:30: note: expanded from macro 'RB_OBJ_TAINTED'
#define RB_OBJ_TAINTED       RB_OBJ_TAINTED
                             ^
/Users/john.doe/.rbenv/versions/3.2.0/include/ruby-3.2.0/ruby/internal/fl_type.h:812:1: note: 'RB_OBJ_TAINTED' has been explicitly marked deprecated here
RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea."))
^
/Users/john.doe/.rbenv/versions/3.2.0/include/ruby-3.2.0/ruby/internal/attr/deprecated.h:36:53: note: expanded from macro 'RBIMPL_ATTR_DEPRECATED'
# define RBIMPL_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg))
                                                    ^
unicode.c:38:5: warning: 'RB_OBJ_TAINT' is deprecated: taintedness turned out to be a wrong idea. [-Wdeprecated-declarations]
    OBJ_TAINT(obj);
    ^
/Users/john.doe/.rbenv/versions/3.2.0/include/ruby-3.2.0/ruby/internal/fl_type.h:149:25: note: expanded from macro 'OBJ_TAINT'
#define OBJ_TAINT       RB_OBJ_TAINT       /**< @old{RB_OBJ_TAINT} */
                        ^
/Users/john.doe/.rbenv/versions/3.2.0/include/ruby-3.2.0/ruby/internal/fl_type.h:116:30: note: expanded from macro 'RB_OBJ_TAINT'
#define RB_OBJ_TAINT         RB_OBJ_TAINT
                             ^
/Users/john.doe/.rbenv/versions/3.2.0/include/ruby-3.2.0/ruby/internal/fl_type.h:843:1: note: 'RB_OBJ_TAINT' has been explicitly marked deprecated here
RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea."))
^
/Users/john.doe/.rbenv/versions/3.2.0/include/ruby-3.2.0/ruby/internal/attr/deprecated.h:36:53: note: expanded from macro 'RBIMPL_ATTR_DEPRECATED'
# define RBIMPL_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg))
                                                    ^
unicode.c:1039:20: error: incompatible function pointer types passing 'VALUE (get_categories_param *)' (aka 'unsigned long (struct _get_categories_param *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
  return rb_ensure(get_categories_internal, (VALUE)&param,
                   ^~~~~~~~~~~~~~~~~~~~~~~
/Users/john.doe/.rbenv/versions/3.2.0/include/ruby-3.2.0/ruby/internal/iterator.h:425:25: note: passing argument to parameter 'b_proc' here
VALUE rb_ensure(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*e_proc)(VALUE), VALUE data2);
                        ^
unicode.c:1040:20: error: incompatible function pointer types passing 'VALUE (WString *)' (aka 'unsigned long (struct _WString *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
                   get_categories_ensure, (VALUE)&wstr);
                   ^~~~~~~~~~~~~~~~~~~~~
/Users/john.doe/.rbenv/versions/3.2.0/include/ruby-3.2.0/ruby/internal/iterator.h:425:62: note: passing argument to parameter 'e_proc' here
VALUE rb_ensure(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*e_proc)(VALUE), VALUE data2);
                                                             ^
unicode.c:1057:20: error: incompatible function pointer types passing 'VALUE (get_categories_param *)' (aka 'unsigned long (struct _get_categories_param *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
  return rb_ensure(get_categories_internal, (VALUE)&param,
                   ^~~~~~~~~~~~~~~~~~~~~~~
/Users/john.doe/.rbenv/versions/3.2.0/include/ruby-3.2.0/ruby/internal/iterator.h:425:25: note: passing argument to parameter 'b_proc' here
VALUE rb_ensure(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*e_proc)(VALUE), VALUE data2);
                        ^
unicode.c:1058:20: error: incompatible function pointer types passing 'VALUE (WString *)' (aka 'unsigned long (struct _WString *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
                   get_categories_ensure, (VALUE)&wstr);
                   ^~~~~~~~~~~~~~~~~~~~~
.
.
.
2 warnings and 6 errors generated.
make: *** [unicode.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/unicode-0.4.4.4 for inspection.
Results logged to /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/extensions/arm64-darwin-23/3.2.0/unicode-0.4.4.4/gem_make.out

  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:102:in `run'
  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:51:in `block in make'
  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:43:in `each'
  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:43:in `make'
  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/ext/ext_conf_builder.rb:42:in `build'
  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:170:in `build_extension'
  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:204:in `block in build_extensions'
  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:201:in `each'
  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:201:in `build_extensions'
  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/installer.rb:843:in `build_extensions'
  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/rubygems_gem_installer.rb:76:in `build_extensions'
  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/rubygems_gem_installer.rb:28:in `install'
  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/source/rubygems.rb:205:in `install'
  /Users/john.doe/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-.
.
.
An error occurred while installing unicode (0.4.4.4), and Bundler cannot continue.

我非常感谢您提供的任何帮助。 谢谢。

  • 我尝试“xcode-select --install”来检查是否缺少某些内容
  • 我尝试使用 asdf 版本管理器来检查问题是否与 rbenv 相关
ruby rubygems bundler rubymine rbenv
2个回答
-1
投票

检查这是否有帮助。这里指出了类似的问题

https://github.com/blackwinter/unicode/issues/4


-1
投票

您可能会发现这很有用:https://bugs.ruby-lang.org/issues/19403

就我而言,我决定使用 ruby 3.2.3

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