wkhtmltoimage-binary
wkhtmltoimage-binary copied to clipboard
Heroku stack-18 issue: error while loading shared libraries: libpng12.so.0: cannot open shared object file:
Hey guys.
Thanks for the great gem! It's been really helpful so far. Unfortunately, we've run into a bit of a snag. It looks like the binary used in this gem relies on libpng12
, however, this is not pre-installed on Heroku's new stack (Based on Ubtunu 18.04).
https://devcenter.heroku.com/articles/stack-packages
What is the best way to resolve this issue? Let me know if I can help out at all 👍
Let me do some investigation. Are you currently blocked by this?
Hey @nicholasklick thanks for the response!.
We've been blocked for a while (I don't raise a github issue unless I'm desperate 😆), but last night I tried embedding a binary with the project's bin
folder and configuring it in the IMGKit initializer and it looks like that did the trick! I had to try a few different versions (and getting a binary as opposed to a .deb
file was a pain. But I eventually found https://github.com/rposborne/wkhtmltopdf-heroku and used this one (version 0.12.5)
Would be great to help other folks with this, so let me know if I can provide any more insight.
I'll add some quick notes on this - our team uses Codeship, and the tests we have that rely on wkhtmltoimage
have started failing. Of course, it runs fine locally, but when ssh'd into Codeship's build to debug, we get a collection of errors, printed below for your edification:
IMGKit::CommandFailedError: Command failed: /home/rof/cache/bundler/bin/wkhtmltoimage --height 400 --quality 75 --width 400 --crop-h 400 --zoom 0.7 --format jpg - -: /home/rof/cache/bundler/gems/wkhtmltoimage-binary-0.12.5/libexec/wkhtmltoimage-amd64: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
/home/rof/cache/bundler/gems/imgkit-1.3.10/lib/imgkit/imgkit.rb:111:in `to_img'
.
.
.
rest of stack trace
When on the box:
$ gem install wkhtmltoimage-binary
Fetching wkhtmltoimage-binary-0.12.5.gem
Successfully installed wkhtmltoimage-binary-0.12.5
1 gem installed
$ wkhtmltoimage
/home/rof/cache/bundler/gems/wkhtmltoimage-binary-0.12.5/libexec/wkhtmltoimage-amd64: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
gem list | grep wk
wkhtmltoimage-binary (0.12.5)
I think dropping to 0.12.4
might do it. I'll try it and update here!
Update: That did it. no errors with:
# Gemfile
gem "wkhtmltoimage-binary", "0.12.4"
I see there are updated binaries for other ubuntu versions: https://wkhtmltopdf.org/downloads.html I will see if I can get those added. Likely I will deprecate Ubuntu trusty since that is EOL.
libpng12 has been replaced with libpng16 on heroku-18 (https://devcenter.heroku.com/articles/stack-packages)
any update on this ? has someone been able to run this on heroku-18 ?
@MathieuDerelle read the above comments, I've gotten it to work on heroku-18
thanks @abury but it did not work for me
I've replaced
gem 'wkhtmltoimage-binary
by
gem 'wkhtmltopdf-heroku'
and added an initializer :
IMGKit.configure do |config|
config.wkhtmltoimage = Gem.bin_path('wkhtmltopdf-heroku', 'wkhtmltopdf-linux-amd64')
end
the error went away but the images exported from HTML were always trash : 15 bytes
0A0A0A0A 0A0A0A0A 0A0A0A0A 0A0A0A
removing this gem and using the buildpack https://github.com/chap/wkhtmltopdf-heroku-18-buildpack
worked for me
removing this gem and using the buildpack
https://github.com/chap/wkhtmltopdf-heroku-18-buildpack
worked for me
I spent hours on this. I tried using the buildpack, but never crossed my mind removing the gems. Thanks!
You can use the build pack heroku-buildpack-dpkg
and add Debfile
in the root with content:
http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb
It will install the missing library on the server on deploy
Hello guys I'm having the following error using heroku tesseract, does anyone know how to solve I'm using stack 20
pytesseract.pytesseract.TesseractError: (127, 'tesseract: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory')