1

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!!

Tom
  • 137
  • 1
  • 9
  • Here is an example of installing a binary in a custom buildpack: https://github.com/davidjrice/heroku-buildpack-couchbase-ruby/blob/72ec5da13131b799642f0d26fb85de595cb3d5ad/lib/language_pack/ruby.rb – Schneems Aug 09 '12 at 16:27
  • @Schneems so as I understand it, I fork this buildpack, replace the libvbucket binaries with GSL binaries, and the installation functions specific to libvbucket with some that are specific to GSL, and I should be getting closer? – Tom Aug 10 '12 at 18:32

1 Answers1

1

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).

Thomas Wolfe
  • 78
  • 1
  • 6
  • Awesome! This is totally sweet. – Tom Oct 01 '12 at 00:31
  • I cant seem to get it to work. Looking at the code. It seems like the ruby.rb file is using gsl 1.15 version. GSL_VENDOR_URL = "https://s3.amazonaws.com/gsl_bin/gsl-1.15.tgz" But I dont think rb-gsl is compatible with 1.15. See [this][1]. I forked your repository to add gsl 1.14. When I downloaded the gsl-1.15.tgz, it looks like a compiled linux package. Can you please confirm that to use 1.14, I will need to pre compile the gsl 1.14 package and then use it in the buildpack? [1]: http://stackoverflow.com/questions/7379729/problems-installing-gsl-gem – Kruttik Oct 14 '12 at 00:08
  • @Kruttik: Yes, but check out the [Packaging Binary Buildpack Dependencies](https://devcenter.heroku.com/articles/buildpack-binaries) article. Heroku makes it easy. – willglynn Oct 14 '12 at 00:27
  • @willglynn: Thanks for the input. I tried using the vulcan route but I am getting an error building GSL. I extracted the gsl-1.14 from GNU website and when i run vulcan build -v -s . -p /tmp/gsl -c "./configure --disable-shared --prefix=/tmp/gsl && make install", I get error-minmax.c:26:28: error: gsl/gsl_minmax.h: No such file or directory – Kruttik Oct 14 '12 at 01:18
  • @Thomas- How did you get the GSL to build through vulcan? Please advice. – Kruttik Oct 14 '12 at 01:42
  • temporarily I've been using rb-gsl from git since it works with gsl-1.15: github.com/romanbsd/rb-gsl/issues/7 though this is probably not the best solution. EDIT: building 1.15 using vulcan now gives me the same error as Kruttik (gsl/gsl_minmax.h: No such file or directory) and I'm pretty sure I'm doing everything the same as before... – Thomas Wolfe Oct 15 '12 at 18:53
  • @Thomas- I tried doing exactly that yesterday. I used the master from rb-gsl but I got an error while installing the gem on heroku. Have you tested the buildback with the gsl gem on heroku? If yes, can you please outline the exact steps you took. Thanks – Kruttik Oct 15 '12 at 19:35
  • @Kruttik, I just tested it for the first time and you're right, it's not working. I added /app/vendor/gsl/bin to the path in the buildpack and now... well gsl is installed (and gsl-config is in the PATH), and deploying to heroku starts the make process for rb-gsl from github.com/romanbsd/rb-gsl.git and it dies on a bunch of missing files (it looks like it's the same as http://stackoverflow.com/questions/7379729/problems-installing-gsl-gem). I'm not sure where to go from here. – Thomas Wolfe Oct 16 '12 at 01:51
  • So we are basically stuck. I needed this like crazy. Any ideas of leads? Anyone? – Kruttik Oct 16 '12 at 08:32
  • @Kruttik for new apps the LD_LIBRARY_PATH and PATH are set properly, but I've noticed on old apps the path is not set (via eg heroku config:add LD_LIBRARY_PATH=/app/vendor/gsl-1/lib). I'm still not sure why vulcan won't build gsl. – Thomas Wolfe Oct 17 '12 at 05:59