Installing Ruby / GSL in Heroku Application

2019-08-12 04:10发布

Context:

  • I have an application that makes heavy use of the GSL library and its Ruby bindings.
  • I'd like to deploy the app to Heroku. I'm very new to programming in general, much less deployment, and Heroku is very simple to use, especially for Rails apps.
  • I have GSL installed on my laptop. I am using the 'gsl' gem.

The Problem:

  • The gem requires that the GSL library already be installed.
  • GSL is not already installed in the Heroku environment.
  • So, unsurprisingly, I get this error from Heroku after I git push heroku master

    -----> Heroku receiving push
    -----> Removing .DS_Store files
    -----> Ruby/Rails app detected
    -----> Installing dependencies using Bundler version 1.2.0.rc
           Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
    
    ...
    Installing gsl (1.14.7) with native extensions
    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
    /usr/local/bin/ruby extconf.rb
    checking gsl version... *** 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/bin/ruby
    extconf.rb:237:in `rescue in <main>': Check GSL>=0.9.4 is installed, and the command "gsl-config" is in search path. (RuntimeError)
    from extconf.rb:138:in `<main>'
    

The (Probable) Solution:

  • It seems that working with Heroku's buildpacks is the likely route. This (packing binary buildpack dependencies) seems promising.
  • I just don't understand what is going on in the tutorial, or how to use vulcan.

What I am hoping for:

  • An easy-to-follow explanation of how to make the GSL library available to my application on Heroku.

Thank you so much!!

1条回答
Summer. ? 凉城
2楼-- · 2019-08-12 04:44

Hey Tom (what's the likelihood of two people named Tom needing to use ruby-gsl on heroku?) I've yet to test it out (I really don't exactly know what I'm doing and I don't really have an app ready yet to test it with) but maybe this'll work:

heroku-buildpack-gsl-ruby

if not, well, we'll keep at it ;)

It's gsl 1.15 which is currently the latest.

Though in the future something like: package_nodejs instead for gsl might be nice (see hacking section of the readme). I'll probably add that soon (copy/paste, shudder, so not DRY).

查看更多
登录 后发表回答