如何在Rails 5应用程序的Heroku上安装rb-gsl
gem所需的GSL绑定?
我假设一个人需要多个buildpack,一次是gsl,一次是Ruby。为此,我尝试使用最近(3年前)更新过的buildpack https://github.com/gregory/heroku-gsl-buildpack,该软件包在不久前也曾在这里引用:Heroku/Rails: How to install the GNU Scientific Library (GSL) on Heroku? –那里的注释提到需要设置LD_LIBRARY_PATH
。但是自从回答该问题以来,某些事情一定已经发生了变化,不幸的是,我找不到最新的信息:
$ heroku buildpacks:clear
$ heroku buildpacks:add git://github.com/gregory/heroku-gsl-buildpack.git#gsl-1.16
$ heroku buildpacks:add heroku/ruby
$ heroku config:set LD_LIBRARY_PATH=/app/vendor/gsl/lib
两个buildpack都能正确显示:
$ heroku buildpacks
=== appname Buildpack URLs
1. git://github.com/gregory/heroku-gsl-buildpack.git#gsl-1.16
2. heroku/ruby
不幸的是,git push heroku master
失败了,尽管我不知道安装的外观,但感觉gsl绑定只是下载并解压缩了,却没有构建?看到这里:
$ git push heroku master
…
remote: Building source:
remote:
remote: -----> GSL 1.15 app detected
remote: -----> Installing GSL 1.16
remote: --2018-08-28 11:31:25-- https://github.com/gregory/heroku-gsl-buildpack/raw/gsl-1.16/gsl-1.16.tar.gz
…
remote: HTTP request sent, awaiting response... 200 OK
…
remote: 2018-08-28 11:31:26 (74.5 MB/s) - ‘gsl-1.16.tar.gz’ saved [8214058/8214058]
remote:
remote: ./
remote: ./include/
remote: ./include/gsl/
…
remote: ./lib/
…
remote: ./bin/
remote: ./bin/gsl-histogram
remote: ./bin/gsl-config
remote: ./bin/gsl-randist
remote: ./share/
…
remote: ./share/man/man1/gsl-histogram.1
remote: ./share/man/man1/gsl-randist.1
remote: ./share/man/man1/gsl-config.1
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.5.0
remote: -----> Installing dependencies using bundler 1.15.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: Fetching gem metadata from https://rubygems.org/.........
remote: Fetching version metadata from https://rubygems.org/..
remote: Fetching dependency metadata from https://rubygems.org/.
…
remote: Fetching gsl 2.1.0.3
remote: Installing gsl 2.1.0.3 with native extensions
…
remote: Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:
remote: current directory:
remote: /tmp/build_a16a258cc52f9887719444fc25fc24ba/vendor/bundle/ruby/2.5.0/gems/gsl-2.1.0.3/ext/gsl_native
remote: /tmp/build_a16a258cc52f9887719444fc25fc24ba/vendor/ruby-2.5.0/bin/ruby -r
remote: ./siteconf20180828-229-x5tnap.rb extconf.rb
remote: *** ERROR: missing required library to compile this module: No such file or
remote: directory - gsl-config
remote: *** extconf.rb failed ***
remote: Could not create Makefile due to some reason, probably lack of necessary
remote: libraries and/or headers. Check the mkmf.log file for more details. You may
remote: need configuration options.
remote:
remote: Provided configuration options:
remote: --with-opt-dir
remote: --without-opt-dir
remote: --with-opt-include
remote: --without-opt-include=${opt-dir}/include
remote: --with-opt-lib
remote: --without-opt-lib=${opt-dir}/lib
remote: --with-make-prog
remote: --without-make-prog
remote: --srcdir=.
remote: --curdir
remote: --ruby=/tmp/build_a16a258cc52f9887719444fc25fc24ba/vendor/ruby-2.5.0/bin/$(RUBY_BASE_NAME)
remote: --with-gsl-version
remote:
remote: extconf failed, exit code 1
remote:
remote: Gem files will remain installed in
remote: /tmp/build_a16a258cc52f9887719444fc25fc24ba/vendor/bundle/ruby/2.5.0/gems/gsl-2.1.0.3
remote: for inspection.
remote: Results logged to
remote: /tmp/build_a16a258cc52f9887719444fc25fc24ba/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/gsl-2.1.0.3/gem_make.out
remote:
remote: An error occurred while installing gsl (2.1.0.3), and Bundler cannot continue.
remote: Make sure that `gem install gsl -v '2.1.0.3'` succeeds before bundling.
…
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
我们非常感谢您的帮助。