ankane / or-tools-ruby

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

Installing with Dokku #16

Closed DigitalBoxMobile closed 3 years ago

DigitalBoxMobile commented 3 years ago

Hi I am trying to install or-tools 0.4.2 on a server using Dokku. I am using this heroku buildpack.

And I get this error:

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

       current directory:
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/or-tools-0.4.2/ext/or-tools
       /tmp/build/vendor/ruby-2.7.0/bin/ruby -I
       /tmp/build/vendor/ruby-2.7.0/lib/ruby/2.7.0 -r ./siteconf20210326-371-180bap0.rb
       extconf.rb
       checking for -lstdc++... yes
       *** 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=/tmp/build/vendor/ruby-2.7.0/bin/$(RUBY_BASE_NAME)
--with-libpath
--without-libpath
--with-stdc++-dir
--without-stdc++-dir
--with-stdc++-include
--without-stdc++-include=${stdc++-dir}/include
--with-stdc++-lib
--without-stdc++-lib=${stdc++-dir}/lib
--with-stdc++lib
--without-stdc++lib
--with-or-tools-dir
--without-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
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/or-tools-0.4.2/ext/or-tools/vendor.rb:29:in
       `<top (required)>': Binary installation not available for this platform.
       (RuntimeError)

       Build the OR-Tools C++ library from source, then run:
       bundle config build.or-tools --with-or-tools-dir=/path/to/or-tools

       from extconf.rb:17:in `require_relative'
       from extconf.rb:17:in `<main>'

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

       /tmp/build/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/or-tools-0.4.2/mkmf.log

       extconf failed, exit code 1

       Gem files will remain installed in
       /tmp/build/vendor/bundle/ruby/2.7.0/gems/or-tools-0.4.2 for inspection.
       Results logged to
       /tmp/build/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/or-tools-0.4.2/gem_make.out

       An error occurred while installing or-tools (0.4.2), and Bundler cannot
       continue.
       Make sure that `gem install or-tools -v '0.4.2' --source
       'https://rubygems.org/'` succeeds before bundling.

Can you help me? Thanks!

ankane commented 3 years ago

Hey @DigitalBoxMobile, what do you get if you run this Ruby code in the container?

p %x[lsb_release -is].chomp
p %x[lsb_release -rs].chomp

(these values are used to find the correct binary distribution of OR-Tools)

https://github.com/ankane/or-tools/blob/5f4c5d30f41e753a26ee7c49e664872b635fc30e/ext/or-tools/vendor.rb#L12-L13

DigitalBoxMobile commented 3 years ago

You answer with lightning speed :)

irb(main):001:0> p %x[lsb_release -is].chomp
"Ubuntu"
irb(main):002:0> p %x[lsb_release -rs].chomp
"16.04"
ankane commented 3 years ago

OR-Tools no longer releases binaries for Ubuntu 16.04, so you'll need to use gem version 0.3.4 or earlier (or update to Ubuntu 18.04).

DigitalBoxMobile commented 3 years ago

Thanks @ankane, downgrading helped me