ruby-vips: Could not open library 'libvips.so.42': libvips.so.42: cannot open shared object file: No such file or directory
Firstly thanks for vips and this gem! Great work.
Whilst writing this up, I’m not 100% sure this is the right place to ask for help but the error is the same as similar issues:
https://github.com/libvips/ruby-vips/issues/176 https://github.com/libvips/ruby-vips/issues/187
LoadError: Could not open library 'vips.so.42': vips.so.42: cannot open shared object file: No such file or directory.
Could not open library 'libvips.so.42': libvips.so.42: cannot open shared object file: No such file or directory
ruby-vips ‘2.0.17’ ruby ‘~> 2.5.7’ ffi - 1.11.3
I’ve tried multiple build packs to get ruby-vips deployed on heroku.
https://elements.heroku.com/buildpacks/brandoncc/heroku-buildpack-vips https://elements.heroku.com/buildpacks/alex88/heroku-buildpack-vips https://elements.heroku.com/buildpacks/verumex/heroku-buildpack-libvips
And building my own debian packages by following this blog
https://renchap.com/blog/post/building_recent_libvips_on_debian/
https://dronebase-buildpacks.s3.amazonaws.com/libvips-dev_8.6.3-1_amd64.deb https://dronebase-buildpacks.s3.amazonaws.com/libvips-tools_8.6.3-1_amd64.deb https://dronebase-buildpacks.s3.amazonaws.com/libvips42_8.6.3-1_amd64.deb
However this is the latest from heroku build logs…
-----> Detecting rake tasks
!
! Could not detect rake tasks
! ensure you can run `$ bundle exec rake -P` against your app
! and using the production group of your Gemfile.
! rake aborted!
! LoadError: Could not open library 'vips.so.42': vips.so.42: cannot open shared object file: No such file or directory.
! Could not open library 'libvips.so.42': libvips.so.42: cannot open shared object file: No such file or directory
I have got this running locally with ‘rails s’ and managed to tile my high res image. However if a try and launch my server with foreman and sidkiq workers it fails to launch with:
23:39:11 assets_worker.1 | /bundle/gems/ffi-1.11.3/lib/ffi/library.rb:145:in `block in ffi_lib': Could not open library 'vips.so.42': vips.so.42: cannot open shared object file: No such file or directory. (LoadError)
23:39:11 assets_worker.1 | Could not open library 'libvips.so.42': libvips.so.42: cannot open shared object file: No such file or directory
23:39:11 assets_worker.1 | from /bundle/gems/ffi-1.11.3/lib/ffi/library.rb:99:in `map'
23:39:11 assets_worker.1 | from /bundle/gems/ffi-1.11.3/lib/ffi/library.rb:99:in `ffi_lib'
23:39:11 assets_worker.1 | from /bundle/gems/ruby-vips-2.0.17/lib/vips.rb:528:in `<module:Vips>'
23:39:11 assets_worker.1 | from /bundle/gems/ruby-vips-2.0.17/lib/vips.rb:525:in `<top (required)>'
23:39:11 assets_worker.1 | from /bundle/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `require'
23:39:11 assets_worker.1 | from /bundle/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `block in require'
23:39:11 assets_worker.1 | from /bundle/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:in `load_dependency'
23:39:11 assets_worker.1 | from /bundle/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `require'
23:39:11 assets_worker.1 | from /bundle/gems/ruby-vips-2.0.17/lib/ruby-vips.rb:1:in `<top (required)>'
23:39:11 assets_worker.1 | from /var/lib/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `require'
23:39:11 assets_worker.1 | from /var/lib/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
23:39:11 assets_worker.1 | from /var/lib/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `each'
23:39:11 assets_worker.1 | from /var/lib/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `block in require'
23:39:11 assets_worker.1 | from /var/lib/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `each'
23:39:11 assets_worker.1 | from /var/lib/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `require'
23:39:11 assets_worker.1 | from /var/lib/gems/2.5.0/gems/bundler-1.17.3/lib/bundler.rb:114:in `require'
23:39:11 assets_worker.1 | from /home/app/Sake/config/application.rb:16:in `<top (required)>'
23:39:11 assets_worker.1 | from /bundle/gems/sidekiq-5.2.7/lib/sidekiq/cli.rb:280:in `require'
23:39:11 assets_worker.1 | from /bundle/gems/sidekiq-5.2.7/lib/sidekiq/cli.rb:280:in `boot_system'
23:39:11 assets_worker.1 | from /bundle/gems/sidekiq-5.2.7/lib/sidekiq/cli.rb:46:in `run'
23:39:11 assets_worker.1 | from /bundle/gems/sidekiq-5.2.7/bin/sidekiq:12:in `<top (required)>'
23:39:11 assets_worker.1 | from /bundle/bin/sidekiq:29:in `load'
23:39:11 assets_worker.1 | from /bundle/bin/sidekiq:29:in `<main>'
Any tips would be appreciated. THanks
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 35 (10 by maintainers)
So I had the same problem on Heroku, took me a couple of hours to get this running. I am not using Docker.
I added this buildpack to my app:
heroku buildpacks:add heroku-community/apt --index 1And the Aptfile in my root directory contains:
Note: This added 140MB to my slug size, but at least it runs now.
Hello @jrae,
Sorry, I’m not a Heroku expert 😦
Where does your
libvips.so.42end up? If it’s in one of the standard locations, you’ll need to runldconfigbefore ruby-vips can find it. If it’s in a non-standard location, you’ll need to setLD_LIBRARY_PATHto that directory.I’ve made a dockerfile which builds and tests ruby-vips with the latest libvips on heroku18, if that’s any help:
https://github.com/jcupitt/docker-builds/tree/master/ruby-vips-heroku18
You’ll probably want to add some other loaders. It makes a libvips installed to
/usr/local/vips, so it needsLD_LIBRARY_PATHto be set to/usr/local/vips/lib.Ran into this problem upgrading rails 6 to 7, this solved the problem. Followed the steps given with a little tweek to the Aptfile, I used:
Instead so the slug size would be smaller by about 40mb
Yes, the homebrew vips package installs every possible libvips dependency. I queried this and the homebrew devs said they don’t want it to fall back to building from source, so they don’t want to omit any options at all if possible.
It means you can’t use the homebrew binary on untrusted data, but probably no one does.
That message is definitely due to not having vips installed. One, does it work locally for you?
Regarding Heroku, what does your aptfile look like?
On Aug 17, 2022, at 10:06 AM, Walther Diechmann @.***> wrote:
wauw - that was fast 😃
% gem list | grep ffi ffi (1.15.5) public_suffix (4.0.7, 4.0.6) %
I use gem ‘image_processing’ which translates into
and what is even worse - doing a which vips on my MBAir M1 tells me that I don’t have one - 😮
that, however, should not hinder me deploying - or?
— Reply to this email directly, view it on GitHubhttps://github.com/libvips/ruby-vips/issues/219#issuecomment-1218058533, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADTGUW5QSZVB56C7YZMONV3VZTWXDANCNFSM4KFPCQIA. You are receiving this because you commented.Message ID: @.***>
I fixed up my docker build a bit:
https://github.com/jcupitt/docker-builds/tree/master/libvips-heroku18
It makes a 4MB tarball which runs on a bare heroku image and includes most useful file formats (including PDF, via PDFium) and disables all the dubious ones. The README has some notes.
With this test dockerfile:
I see:
Thanks @jcupitt — I’ve seen your wisdom and many comments across a multitude of Vips libraries, packages, adapters, etc. and just wanted to give a proper thank you for all of your efforts 🙂
With Rails 7 now defaulting active storage to Vips > ImageMagick I imagine there’s going to be a lot more uptake. I tried brandoncc’s buildpack but was getting errors from it (same as these) so ended up just going the full-apt route.
Thanks John, its work properly…
Finally found this buildpack which allows me to deploy with heroku-16 (behind due to other dependency issues).
https://github.com/zoras/heroku-buildpack-libvips
Thanks @zoras!
However I’m now seeing
At runtime. Tried installing
http://ftp.acc.umu.se/pub/GNOME/sources/libgsf/1.14/libgsf-1.14.46.tar.xz
with .vendor_urls based on this comment.
https://github.com/libvips/pyvips/issues/65#issuecomment-423081974
Still no joy. Will edit this comment when I find a solution.