5

I need to install the GSL library on Heroku running a Rails (4.0.2) app to use some gems that depend on it.

Goal: Install the GSL library to work with GSL and Similarity gems in Heroku.

Tried approaches:

I've tried following these steps (compiling binaries):

It works on my local environment but not in Heroku. Heroku doesn't allow sudo but it allows access with heroku run. The problem is that the file system is ephemeral and the dyno will only live as long as your console session.

Update:

I've also tried building my own Heroku Buildpack but I couldn't make it work. I tried using multipacks. I'm not a Heroku Buildpack expert so maybe it's the problem, I'm learning more about it to make a simple repository with an example and an extended explanation of this issue.

skozz
  • 2,662
  • 3
  • 26
  • 37

3 Answers3

2

I had to use gsl1.16 on heroku and here is how I solved it:

First added gsl1.16 buildpack to the lists of buildpacks like

heroku buildpacks:add --index:3 git://github.com/gregory/heroku-gsl-buildpack.git#gsl-1.16

Which adds to my list of buildpacks, in my case got nodejs and ruby already. Hence --index=3

Then had to set LD_LIBRARY_PATH on heroku like

heroku config:set LD_LIBRARY_PATH=/app/vendor/gsl/lib

which points to 1.16. Seen around that some people use /app/vendor/gsl1/lib but wasn't my case.

and that's it.

pitxon_net
  • 104
  • 8
1

You'll need to use a custom buildpack. Buildpacks allow you to define any additional dependencies outside of your project and package them with your slug which is used by the dynos. The buildpack you linked to (https://github.com/tomwolfe/heroku-buildpack-gsl-ruby) would be your best bet in getting everything working. I would open issues on their github repo if you are having issues, hopefully they can help you out

Dan McClain
  • 11,780
  • 9
  • 47
  • 67
  • Thank you Dan. Actually I'm newbie with Heroktu Buildpacks so I'll try it first on my own (to learn) and notice you. – skozz Jul 22 '14 at 16:04
  • Hi again Dan. Now I know how it works (Buildpacks) but how I can implement it in my (started) current project? Thank you! – skozz Jul 22 '14 at 16:32
  • You may be able to switch buildpacks, but it is probably easier to just create a new app with the heroku and destroy your old one. It looks as though if you set the `BUILDPACK_URL` heroku will use that: https://devcenter.heroku.com/articles/buildpacks#using-a-custom-buildpack – Dan McClain Jul 22 '14 at 16:53
  • Yes! adding BUILDPACK_URL works to deploy/install: `heroku config:set BUILDPACK_URL=https://github.com/skozz/heroku-buildpack-gsl-ruby.git --app <>` (I forked to change the GSL version to 1.14). Now the problem is after deploy: `/app/vendor/bundle/ruby/2.0.0/gems/gsl-1.15.3/lib/gsl.rb:2:in `require': libgsl.so.0: cannot open shared object file: No such file or directory - /app/vendor/bundle/ruby/2.0.0/gems/gsl-1.15.3/lib/rb_gsl.so (LoadError)` can't find the lib. – skozz Jul 22 '14 at 17:42
  • @skozz did you ever figure this one out? – Sixty4Bit Jul 23 '14 at 04:16
  • @Sixty4Bit i'm working on my own Buildpack supporting a updated GSL – skozz Jul 23 '14 at 07:51
1

I made a heroku buildpack a couple months ago for 1.15 and 1.16

just do:

heroku buildpacks:set git://github.com/gregory/heroku-gsl-buildpack.git#gsl-1.16

or

heroku buildpacks:set git://github.com/gregory/heroku-gsl-buildpack.git#gsl-1.15

magicgregz
  • 7,471
  • 3
  • 35
  • 27