This seems so simple but I can't seem to close this final gap. I recently added GSL to my Heroku based app via the Heroku buildpack for GSL/Ruby. Both the buildpack and related GSL gem appear to install just fine per the abbreviated push output below:
$git push staging master
Fetching repository, done.
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 476 bytes, done.
Total 4 (delta 3), reused 0 (delta 0)
-----> Fetching custom git buildpack... done
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-1.9.3
-----> Installing gsl
-----> Installing dependencies using 1.5.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 -- deployment
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Using builder (3.0.4)
<...snip...>
Installing narray (0.6.0.8)
Installing gsl (1.15.3)
Your bundle is complete!
Gems in the groups development and test were not installed.
It was installed into ./vendor/bundle
Bundle completed (76.10s)
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
Running: rake assets:precompile
Compiled jquery.js (2ms) (pid 1884)
<...snip...>
Asset precompilation completed (63.31s)
-----> Discovering process types
-----> Compressing... done, 87.4MB
-----> Launching... done, v9
The Heroku log shows a missing file, libgsl.so.0
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require': libgsl.so.0: cannot open shared object file: No such file or directory - /app/vendor/bundle/ruby/1.9.1/gems/gsl-1.15.3/lib/rb_gsl.so (LoadError)
However, the missing file does exist in ~/vendor/gsl-1/lib
:
~/vendor/gsl-1/lib $ ls -l
total 23256
-rw------- 1 u58334 58334 13351772 2012-09-18 02:29 libgsl.a
-rw------- 1 u58334 58334 1781834 2012-09-18 02:26 libgslcblas.a
-rwx------ 1 u58334 58334 954 2012-09-18 02:26 libgslcblas.la
lrwxrwxrwx 1 u58334 58334 20 2014-04-03 17:34 libgslcblas.so -> libgslcblas.so.0.0.0
lrwxrwxrwx 1 u58334 58334 20 2014-04-03 17:34 libgslcblas.so.0 -> libgslcblas.so.0.0.0
-rwx------ 1 u58334 58334 1052844 2012-09-18 02:26 libgslcblas.so.0.0.0
-rwx------ 1 u58334 58334 922 2012-09-18 02:29 libgsl.la
lrwxrwxrwx 1 u58334 58334 16 2014-04-03 17:34 libgsl.so -> libgsl.so.0.16.0
lrwxrwxrwx 1 u58334 58334 16 2014-04-03 17:34 libgsl.so.0 -> libgsl.so.0.16.0
-rwx------ 1 u58334 58334 7603609 2012-09-18 02:29 libgsl.so.0.16.0
drwx------ 2 u58334 58334 4096 2012-09-18 02:29 pkgconfig
I have tried heroku config:set PATH=/vendor/gsl-1/lib --app vp-staging
but then I get the Error: No such file or directory
error from Heroku.
I have looked through Heroku docs and stackoverflow but can't figure out which environment variable should be set to direct Heroku to the vendor library location. Thanks in advance for helping close this gap...
EDIT
Also note that the rb_gsl.so file exists as follows:
~/vendor/bundle/ruby/1.9.1/gems/gsl-1.15.3/lib $ ls -l
total 3968
drwx------ 2 u13339 13339 4096 2014-04-03 18:00 gsl
-rw------- 1 u13339 13339 59 2014-04-03 18:00 gsl.rb
drwx------ 2 u13339 13339 4096 2014-04-03 18:00 ool
-rw------- 1 u13339 13339 797 2014-04-03 18:00 ool.rb
-rw------- 1 u13339 13339 59 2014-04-03 18:00 rbgsl.rb
-rwx------ 1 u13339 13339 4039311 2014-04-03 18:01 rb_gsl.so
So it appears that I have both the GSL gem and the GSL binary libraries installed correctly and the Heroku linker can't find the binary...
EDIT: Yes, I am still at this one...Here's the new information.
I found this potential answer and set my library path to the location of the libgsl.so.0 file like so:
$heroku config:add LD_LIBRARY_PATH=/app/vendor/gsl-1
No bueno. Same crash.
Then I noticed that the "missing" library file is also located in the /usr/lib32
directory. Thinking that Heroku might not be loading lib32 (and just loading lib) I found a great post (apparently I don't have the reputation to post the link) on the difference between autoload and eager_load paths, leading me to add the following eager_load_path to my application.rb file:
config.eager_load_paths += %W(#{config.root}/lib #{config.root}/lib32)
No good.
I'll keep searching and appreciate any help.
EDIT
With some quick help from Heroku, it turns out that I was very close to the solution, which was to set the config variable LD_LIBRARY_PATH=/app/vendor/gsl-1/lib
I was just missing the /lib
directory. Sometimes you can be so close but so far. Hopefully this answer will help someone in the future...
The answer is to set the config variable as follows:
LD_LIBRARY_PATH=/app/vendor/gsl-1/lib
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With