ankane / or-tools-ruby

Operations research tools for Ruby
Apache License 2.0
171 stars 20 forks source link

Not compatible with or-tools v9.5? #41

Closed johnnymo87 closed 1 year ago

johnnymo87 commented 1 year ago

Hi @ankane thanks for all your support on this gem.

The google or-tools team released version 9.5, and homebrew picked it up, and since homebrew only has the latest version of or-tools, there's no way to get prior version from it. And I think people need a prior version to use this library? (This may be only be true for people using Apple Silicon computers, not sure.)

Here's the error I see when my colleague tries to use the latest version (0.9.0) of this gem with or-tools v9.5.

Installing or-tools 0.9.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/or-tools-0.9.0/ext/or-tools
/Users/tapesh.nagarwal/.rbenv/versions/2.7.5/bin/ruby -I /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/site_ruby/2.7.0 extconf.rb
--with-or-tools-dir\=/opt/homebrew
checking for rice/rice.hpp in /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/rice-4.0.4/include... yes
checking for -lc++... yes
checking for -lortools... 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=/Users/tapesh.nagarwal/.rbenv/versions/2.7.5/bin/$(RUBY_BASE_NAME)
    --with-c++-dir
    --without-c++-dir
    --with-c++-include
    --without-c++-include=${c++-dir}/include
    --with-c++-lib
    --without-c++-lib=${c++-dir}/lib
    --with-c++lib
    --without-c++lib
    --with-or-tools-dir
    --with-or-tools-include
    --without-or-tools-include=${or-tools-dir}/include
    --with-or-tools-lib
    --without-or-tools-lib=${or-tools-dir}/lib
    --with-ortools-dir
    --without-ortools-dir
    --with-ortools-include
    --without-ortools-include=${ortools-dir}/include
    --with-ortools-lib
    --without-ortools-lib=${ortools-dir}/lib
    --with-ortoolslib
    --without-ortoolslib
extconf.rb:30:in `<main>': OR-Tools not found (RuntimeError)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/or-tools-0.9.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/or-tools-0.9.0 for inspection.
Results logged to /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/or-tools-0.9.0/gem_make.out

  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:102:in `run'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems/ext/ext_conf_builder.rb:28:in `build'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:171:in `build_extension'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:205:in `block in build_extensions'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:202:in `each'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:202:in `build_extensions'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems/installer.rb:843:in `build_extensions'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.7/lib/bundler/rubygems_gem_installer.rb:71:in `build_extensions'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.7/lib/bundler/rubygems_gem_installer.rb:28:in `install'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.7/lib/bundler/source/rubygems.rb:204:in `install'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.7/lib/bundler/installer/gem_installer.rb:54:in `install'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.7/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.7/lib/bundler/installer/parallel_installer.rb:186:in `do_install'
/Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.7/lib/bundler/installer/parallel_installer.rb:177:in `block in
worker_pool'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.7/lib/bundler/worker.rb:62:in `apply_func'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.7/lib/bundler/worker.rb:57:in `block in process_queue'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.7/lib/bundler/worker.rb:54:in `loop'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.7/lib/bundler/worker.rb:54:in `process_queue'
  /Users/tapesh.nagarwal/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.7/lib/bundler/worker.rb:91:in `block (2 levels) in create_threads'

An error occurred while installing or-tools (0.9.0), and Bundler cannot continue.

In Gemfile:
  or-tools

We're working around this by building or-tools 9.4 from source, which we have no problems with when using this gem.

ankane commented 1 year ago

Hey @johnnymo87, try removing --with-or-tools-dir. It's no longer needed for Mac ARM as of version 0.8.0+ (and you no longer need to install or-tools with Homebrew). Version 0.9.0 requires OR-Tools 9.5, but it'll be downloaded automatically.

johnnymo87 commented 1 year ago

@ankane oh, I totally missed that! OK, we tried again without the --with-or-tools-dir, and version 0.9.0 of the gem worked liked a charm. Thank you!