Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku/Rails: How to install the GNU Scientific Library (GSL) on Heroku?

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:

  • Installing Ruby / GSL in Heroku Application: Heroku crashes after deploy. GSL gem is unable to find the lib. Trace: http://pastebin.com/CPcMUdCa
  • Tomwolfe's Heroku's Ruby buildpack adapted for using couchbase: Same issue.
  • Building Dependency Binaries for Heroku Applications: Vulcan is deprecated. More info on Heroku's Devcenter and on Github

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

  • GSL 1.15 downloaded from ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz
  • Uncompressed and cd gsl-1.15
  • ./configure
  • make clean
  • make
  • sudo make install

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.

like image 738
skozz Avatar asked Oct 01 '22 06:10

skozz


2 Answers

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.

like image 130
pitxon_net Avatar answered Oct 03 '22 10:10

pitxon_net


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

like image 25
metakungfu Avatar answered Oct 03 '22 11:10

metakungfu