ankane / or-tools-ruby

Operations research tools for Ruby
Apache License 2.0
179 stars 25 forks source link

or-tools fails to build. #18

Closed stevenshack closed 3 years ago

stevenshack commented 3 years ago

Rice 4.0.2 seems to change where headers are placed which causes or-tools builds to fail..

The error log below is from macOS 10.15.7 with ruby 3.0.1 installed via rbenv.

Looking at the rice package is a single header file now?

% gem install or-tools

Building native extensions. This could take a while... ERROR: Error installing or-tools: ERROR: Failed to build gem native extension.

current directory: /Users/stevenshack/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/or-tools-0.5.0/ext/or-tools

/Users/stevenshack/.rbenv/versions/3.0.1/bin/ruby -I /Users/stevenshack/.rbenv/versions/3.0.1/lib/ruby/3.0.0 -r ./siteconf20210520-25873-7tqtcn.rb extconf.rb checking for rice/rice.hpp in /Users/stevenshack/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rice-4.0.2/include... yes checking for -lc++... yes checking for -lstdc++... yes checking for -lortools... yes creating Makefile

current directory: /Users/stevenshack/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/or-tools-0.5.0/ext/or-tools make DESTDIR\= clean

current directory: /Users/stevenshack/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/or-tools-0.5.0/ext/or-tools make DESTDIR\= compiling assignment.cpp assignment.cpp:3:10: fatal error: 'rice/Array.hpp' file not found

include <rice/Array.hpp>

     ^~~~~~~~~~~~~~~~

1 error generated. make: *** [assignment.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/stevenshack/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/or-tools-0.5.0 for inspection. Results logged to /Users/stevenshack/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/extensions/x86_64-darwin-19/3.0.0/or-tools-0.5.0/gem_make.out

ankane commented 3 years ago

Hey @stevenshack, thanks for reporting. Will push a new release in the next few days, but for now, you can use gem "rice", "~> 3".

ankane commented 3 years ago

Just pushed 0.5.1 that uses Rice 4

stevenshack commented 3 years ago

Sorry for the slow reply. Thanks for this! I'm currently dealing with how to run or-tools under ruby 2.5.x ... Only transitionally though. Any ideas there? any rice < 4 refuses to build.

stevenshack commented 3 years ago

I figured this out. If multiple versions of rice are installed the build scripts will happily use the wrong version. Automake picking the wrong libs/include directory? I'm not sure how to make gem/bundler use the correct gem regardless.

Also, rice has an undeclared dependency on automake.

ankane commented 3 years ago

If you're using Bundler, it should use the Rice version in your Gemfile, and yeah, Rice < 4 depends on automake.