DEV Community

sugiarto
sugiarto

Posted on

Got error msgpack on mac M2

gem install msgpack -v '1.2.10' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
ERROR:  Error installing msgpack:
    ERROR: Failed to build gem native extension.

    current directory: /Users/sugiarto/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/msgpack-1.2.10/ext/msgpack
/Users/sugiarto/.rbenv/versions/3.2.2/bin/ruby extconf.rb
checking for ruby/st.h... yes
checking for st.h... no
checking for rb_str_replace() in ruby.h... yes
checking for rb_intern_str() in ruby.h... yes
checking for rb_sym2str() in ruby.h... yes
checking for rb_str_intern() in ruby.h... yes
checking for rb_block_lambda() in ruby.h... yes
checking for rb_hash_dup() in ruby.h... yes
checking for rb_hash_clear() in ruby.h... yes
creating Makefile

current directory: /Users/sugiarto/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/msgpack-1.2.10/ext/msgpack
make DESTDIR\= sitearchdir\=./.gem.20260311-13292-21e99l sitelibdir\=./.gem.20260311-13292-21e99l clean

current directory: /Users/sugiarto/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/msgpack-1.2.10/ext/msgpack
make DESTDIR\= sitearchdir\=./.gem.20260311-13292-21e99l sitelibdir\=./.gem.20260311-13292-21e99l
compiling buffer.c
compiling buffer_class.c
buffer_class.c:261:17: error: incompatible function pointer types passing 'VALUE (VALUE)' (aka 'unsigned long (unsigned long)') to parameter of type 'VALUE (*)(VALUE, VALUE)' (aka 'unsigned long (*)(unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
  261 |                 read_until_eof_error, (VALUE)(void*) args,
      |                 ^~~~~~~~~~~~~~~~~~~~
/Users/sugiarto/.rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/iterator.h:388:63: note: passing argument to parameter 'r_proc' here
  388 | VALUE rb_rescue2(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*r_proc)(VALUE, VALUE), VALUE data2, ...);
      |                                                               ^
1 error generated.
make: *** [buffer_class.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/sugiarto/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/msgpack-1.2.10 for inspection.
Results logged to /Users/sugiarto/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/extensions/arm64-darwin-24/3.2.0/msgpack-1.2.10/gem_make.out

A new release of RubyGems is available: 3.4.10 → 4.0.7!
Run `gem update --system 4.0.7` to update your installation.
Enter fullscreen mode Exit fullscreen mode

And here the fix:

gem install msgpack -v '1.2.10' -- --with-cflags="-Wno-error=incompatible-function-pointer-types"
Building native extensions with: '--with-cflags=-Wno-error=incompatible-function-pointer-types'
This could take a while...
Successfully installed msgpack-1.2.10
Parsing documentation for msgpack-1.2.10
Installing ri documentation for msgpack-1.2.10
Done installing documentation for msgpack after 0 seconds
1 gem installed

Enter fullscreen mode Exit fullscreen mode

Top comments (0)