Skip to content

Unable to use the gem with Ruby 3.2.1 #16

Description

@borisano

Describe the bug
When trying to install the gem with Ruby 3.2.1, the installation is unsuccessful and the error is shown (below).

To Reproduce
Steps to reproduce the behavior:

  1. Install Ruby 3.2.1, for example rbenv install 3.2.1
  2. Set 3.2.1 as local version rbenv local 3.2.1
  3. Install bundler gem install bundler
  4. Run bundle install

Expected behavior
Gem is expected to be installed

Additional context
Here's the stacktrace of the error:

Installing spatial_stats 1.0.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /home/borisano/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/spatial_stats-1.0.4/ext/spatial_stats

/home/borisano/.rbenv/versions/3.2.1/bin/ruby -I /home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0 extconf.rb
creating extconf.h
creating Makefile

current directory: /home/borisano/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/spatial_stats-1.0.4/ext/spatial_stats
make DESTDIR= sitearchdir=./.gem.20230310-273214-ynst78 sitelibdir=./.gem.20230310-273214-ynst78 clean

current directory: /home/borisano/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/spatial_stats-1.0.4/ext/spatial_stats
make DESTDIR= sitearchdir=./.gem.20230310-273214-ynst78 sitelibdir=./.gem.20230310-273214-ynst78
compiling csr_matrix.c
compiling spatial_stats.c
spatial_stats.c: In function ‘Init_spatial_stats’:
spatial_stats.c:14:6: warning: old-style function definition [-Wold-style-definition]
14 | void Init_spatial_stats()
| ^~~~~~~~~~~~~~~~~~
spatial_stats.c:18:78: error: ‘rb_cData’ undeclared (first use in this function)
18 | VALUE csr_matrix_class = rb_define_class_under(weights_mod, "CSRMatrix", rb_cData);
| ^~~~~~~~
spatial_stats.c:18:78: note: each undeclared identifier is reported only once for each function it appears in
spatial_stats.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
make: *** [Makefile:248: spatial_stats.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/borisano/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/spatial_stats-1.0.4 for inspection.
Results logged to /home/borisano/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/spatial_stats-1.0.4/gem_make.out

/home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:102:in run' /home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:51:in block in make'
/home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:43:in each' /home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:43:in make'
/home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/ext/ext_conf_builder.rb:42:in build' /home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:170:in build_extension'
/home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:204:in block in build_extensions' /home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:201:in each'
/home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:201:in build_extensions' /home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/installer.rb:843:in build_extensions'
/home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/bundler/rubygems_gem_installer.rb:72:in build_extensions' /home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/bundler/rubygems_gem_installer.rb:28:in install'
/home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/bundler/source/rubygems.rb:200:in install' /home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/bundler/installer/gem_installer.rb:54:in install'
/home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/bundler/installer/gem_installer.rb:16:in install_from_spec' /home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/bundler/installer/parallel_installer.rb:156:in do_install'
/home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/bundler/installer/parallel_installer.rb:147:in block in worker_pool' /home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:62:in apply_func'
/home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:57:in block in process_queue' /home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:54:in loop'
/home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:54:in process_queue' /home/borisano/.rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:90:in block (2 levels) in create_threads'

An error occurred while installing spatial_stats (1.0.4), and Bundler cannot continue.

In Gemfile:
spatial_stats

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions