Some details about my environment:
- Ruby version: ruby 3.2.0
- RubyGems version: 3.5.6
- rbenv version: 1.2.0
- MacOS: Sonoma 14.1.2 / M2
I'm trying to run bundle install to install the gems for my project but I'm getting the following error:
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)¶m,
^~~~~~~~~~~~~~~~~~~~~~~
/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)¶m,
^~~~~~~~~~~~~~~~~~~~~~~
/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.
I would really appreciate any help that you can provide. Thanks.
- I tried "xcode-select --install" to check if there was something missing
- I've tried with asdf version manager to check if the issue was related to rbenv
gem install unicode -- -Wno-incompatible-function-pointer-types
– Swimmingruby.h
path comes from, in my system is is/Users/mike/.rbenv/versions/3.2.0/include/ruby-3.2.0/ruby.h
and should be the same for you – Swimmingruby -rrbconfig -e 'puts RbConfig::CONFIG["rubyhdrdir"]'
? You can also try runningsudo xcode-select --switch /Library/Developer/CommandLineTools
but if you use XCode it can mess something up that I'm not familiar with – Swimming