ankane / or-tools-ruby

Operations research tools for Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error installing gem

cokeito opened this issue · comments

after install the gem, i run the rails console and get this error :(

3:03 $ rails c

The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.

/usr/local/rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': libortools.so: cannot open shared object file: No such file or directory - /usr/local/rvm/gems/ruby-2.5.3/gems/or-tools-0.2.0/lib/or_tools/ext.so (LoadError)

the ext.so file exists
image

tried on a rvm version 2.5.3 and 2.4.1, same error

also installed the or-tools from source, without any problem.

Thanks in advance.

well, after a diggin, i ran an update with

ldconfig -v

and re-bundled the gem and did work!
thanks tho

Hey @cokeito, which operating system version are you on?

debian 9 x64
Thanks for answering

Did you get the Binary installation not available for this platform. error initially?

i had to install the lib for c++, and after that tried to install the gem with no success.

on one of the tries, (rvm 2.6.1)

got this

dont know if will help for your debug:
`nstalling or-tools 0.2.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /usr/local/rvm/gems/ruby-2.6.1/gems/or-tools-0.2.0/ext/or-tools

/usr/local/rvm/rubies/ruby-2.6.1/bin/ruby -I /usr/local/rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200714-20837-1fomnlp.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=/usr/local/rvm/rubies/ruby-2.6.1/bin/$(RUBY_BASE_NAME)
--with-libpath
--without-libpath
--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
/usr/local/rvm/gems/ruby-2.6.1/gems/or-tools-0.2.0/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:

/usr/local/rvm/gems/ruby-2.6.1/extensions/x86_64-linux/2.6.0/or-tools-0.2.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.6.1/gems/or-tools-0.2.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.6.1/extensions/x86_64-linux/2.6.0/or-tools-0.2.0/gem_make.out`

Great, that's expected to Debian 9. What commands did you run to get it to succeed?

ldconfig -v
and re-bundled, dunno if this was needed but it's working
Thanks again!

I'm not entirely sure what rebundled means, but glad it's working.

Commenting on a closed issue because reasons.

The ldconfig thing is the bit that makes OR Tools work when installing from source. From the man page:

ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld. so. conf, and in the trusted directories (/lib and /usr/lib). The cache is used by the run-time linker, ld.so or ld-linux.so.

Therfore, when installing OR Tools from source, you need to extract it to either /lib or /usr/lib and the run ldconfig -v. At least I think that's what you need to do?

This isn't made clear in the OR Tools installation guide, but now that I see mention of ldconfig I recall doing this previously to make everything work.

I do wish I remembered about ldconfig before I wiped my machine and installed Ubuntu 18.04 so that the gem would vendor OR Tools for me correctly... 😳

Hopefully that helps (someone, somewhen).

Hopefully that helps (someone, somewhen).

@rodreegez today is your lucky day...