ankane / faiss-ruby

Efficient similarity search and clustering for Ruby
MIT License
128 stars 5 forks source link

Should required `rice` version be bumped? #4

Closed sambostock closed 1 year ago

sambostock commented 1 year ago

I noticed Dependabot PRs bumping faiss from 0.2.5 to 0.2.6, and later to 0.2.7 were failing to build the gem in CI due to the following error:

...
Using rice 4.0.4
...
Installing faiss 0.2.7 with native extensions
--
  | Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
  |  
...
  | (required)>': Could not find rice/rice.hpp header (RuntimeError)
...
Extended output ``` ... Using rice 4.0.4 ... Installing faiss 0.2.7 with native extensions --   | Gem::Ext::BuildError: ERROR: Failed to build gem native extension.   |     | current directory: /tmp/bundle/ruby/3.2.0/gems/faiss-0.2.7/ext/faiss   | /usr/local/ruby/bin/ruby extconf.rb   | checking for rice/rice.hpp in /tmp/bundle/ruby/3.2.0/gems/rice-4.0.4/include...   | no   | *** extconf.rb failed ***   | Could not create Makefile due to some reason, probably lack of necessary   | libraries and/or headers. Check the mkmf.log file for more details. You may   | need configuration options.   |     | Provided configuration options:   | --with-opt-dir   | --without-opt-dir   | --with-opt-include   | --without-opt-include=${opt-dir}/include   | --with-opt-lib   | --without-opt-lib=${opt-dir}/lib   | --with-make-prog   | --without-make-prog   | --srcdir=.   | --curdir   | --ruby=/usr/local/ruby/bin/$(RUBY_BASE_NAME)   | /tmp/bundle/ruby/3.2.0/gems/rice-4.0.4/lib/mkmf-rice.rb:120:in `': Could not find rice/rice.hpp header (RuntimeError)   | from   | :159:in   | `require'   | from   | :159:in   | `rescue in require'   | from   | :39:in   | `require'   | from extconf.rb:1:in `
'   | :85:in   | `require': cannot load such file -- mkmf-rice (LoadError)   | from   | :85:in   | `require'   | from extconf.rb:1:in `
'   |     | To see why this extension failed to compile, please check the mkmf.log which can   | be found here:   |     | /tmp/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0-static/faiss-0.2.7/mkmf.log   |     | extconf failed, exit code 1   |     | Gem files will remain installed in /tmp/bundle/ruby/3.2.0/gems/faiss-0.2.7 for   | inspection.   | Results logged to   | /tmp/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0-static/faiss-0.2.7/gem_make.out   |     | /usr/local/ruby/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:119:in `run'   | /usr/local/ruby/lib/ruby/site_ruby/3.2.0/rubygems/ext/ext_conf_builder.rb:27:in   | `build'   | /usr/local/ruby/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:187:in   | `build_extension'   | /usr/local/ruby/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:221:in `block   | in build_extensions'   | /usr/local/ruby/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:218:in `each'   | /usr/local/ruby/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:218:in   | `build_extensions'   | /usr/local/ruby/lib/ruby/site_ruby/3.2.0/rubygems/installer.rb:843:in   | `build_extensions'   | /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/rubygems_gem_installer.rb:72:in   | `build_extensions'   | /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/rubygems_gem_installer.rb:28:in   | `install'   | /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/source/rubygems.rb:200:in   | `install'   | /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/installer/gem_installer.rb:54:in   | `install'   | /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/installer/gem_installer.rb:16:in   | `install_from_spec'   | /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/installer/parallel_installer.rb:155:in   | `do_install'   | /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/installer/parallel_installer.rb:146:in   | `block in worker_pool'   | /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/worker.rb:62:in   | `apply_func'   | /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/worker.rb:57:in   | `block in process_queue'   | /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/worker.rb:54:in   | `loop'   | /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/worker.rb:54:in   | `process_queue'   | /usr/local/ruby/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/lib/bundler/worker.rb:90:in   | `block (2 levels) in create_threads'   |     | An error occurred while installing faiss (0.2.7), and Bundler cannot   | continue.   |     | In Gemfile:   | faiss ```

Oddly enough, it installs fine on my machine. In any case, after bumping rice from 4.0.4 to 4.1.0 it build just fine.

...
  | Fetching rice 4.1.0
  | Installing numo-narray 0.9.2.1 with native extensions
  | Installing rice 4.1.0
...
  | Fetching faiss 0.2.7
  | Installing faiss 0.2.7 with native extensions
  | Bundle complete! 37 Gemfile dependencies, 206 gems now installed.
...

Did something change in faiss 0.2.6 that requires rice > 4.0.4, and should the required version be updated?

ankane commented 1 year ago

Hi @sambostock, can you paste the contents of /tmp/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0-static/faiss-0.2.7/mkmf.log?

sambostock commented 1 year ago

I was trying to extract that artifact from CI, but I can't seem to reproduce this anymore. Perhaps something was cached in CI which has since been blown away.

I'll close this for now. If something similar happens on the next update and I'm able to reproduce consistently, I'll let you know. Sorry about the noise!