zakird / wkhtmltopdf_binary_gem

Ruby gem containing easily installable access to wkhtmltopdf application
https://rubygems.org/gems/wkhtmltopdf-binary
Apache License 2.0
182 stars 347 forks source link

New binary is a need to install the dependent libraries #19

Closed rewish closed 4 years ago

rewish commented 10 years ago

Ubuntu 14.04 64-bit

sudo apt-get install libjpeg62 libfontconfig-dev

Ubuntu 14.04 32-bit

sudo apt-get install libjpeg-dev libfontconfig-dev

CentOS 7.0

sudo yum install libjpeg libpng12 libXrender libXext fontconfig

CentOS 6.3 64-bit

sudo yum install libjpeg libpng libXrender libXext fontconfig

CentOS 6.3 32-bit

wkhtmltopdf_linux_x86 -V
#=> wkhtmltopdf_linux_x86: error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory

sudo yum install libjpeg.so.8
#=> No package libjpeg.so.8 available.

Dependent libraries for 32-bit does not exist in the standard RPM repositories of CentOS.

I've tried creating a symlink, but it doesn't work:

ln -s /usr/lib/libjpeg.so.62 /usr/lib/libjpeg.so.8

wkhtmltopdf_linux_x86 -V
#=> /path/to/wkhtmltopdf_linux_x86: /usr/lib/libjpeg.so.8: version `LIBJPEG_8.0' not found (required by /path/to/wkhtmltopdf_linux_x86)
#=> /path/to/wkhtmltopdf_linux_x86: /lib/libc.so.6: version `GLIBC_2.15' not found (required by /path/to/wkhtmltopdf_linux_x86)

Do you have a solution?

zakird commented 10 years ago

Has anyone compiled it this with statically linked dependencies? What's the size of the executable? This would avoid the OS nonsense.

rewish commented 10 years ago

@tbugai How did you build?

tbugai commented 10 years ago

The latest binaries were downloaded from the wkhtmltopdf project page.

Keep in mind, the more libraries that get statically built into the binary the larger the binary is going to be. They already weigh in at about 40MB each. Systems like heroku limit the deployed project size so this becomes an issue as all three binaries are included in the gem.

rewish commented 10 years ago

Hmmm.

Since it does not support 32-bit from the CentOS 7 or later, the 32-bit CentOS 6 may not be a big problem...

richardarosenthal commented 9 years ago

Was a workaround for this ever figured out on Centos 32 bit?

anazar commented 9 years ago

this is also an issue on the new heroku cedar-14 stack

richardarosenthal commented 9 years ago

I solved this by grabbing the v8 file out of another distro's repository (found through a simple google search for the file itself) and manually scp'ing it into the usr/library folder. As long as you don't change any existing symlinks (v6 or whatever it is) you shouldn't disrupt anything else.

oboxodo commented 9 years ago

Hi there.

Could you please post here (or in a README file) what exact commands are you using to compile these binaries? That way it would be easier for us to send pull-requests with updated files for you to consider.

In my particular case, I'm deploying a project with this gem in Heroku and upgrading from cedar stack to cedar-14 is not possible because libjpeg62 is not there anymore. @anazar mentioned this issue too.

My approach to workaround this would be to compile a new binary called wkhtmltopdf_linux_amd64_jpeg8 and use that one if libjpeg8 is detected.

unixmonkey commented 9 years ago

As mentioned above, right now the binaries are the compiled binaries from http://wkhtmltopdf.org

If you can compile them to include the necessary stuff and send a pull request, I'd be glad to merge it in.

maikelvl commented 9 years ago

Running apt-get install libjpeg-dev on Ubuntu 14.04 64-bit worked in my case

unixmonkey commented 4 years ago

Closing this now that we have sorted out the process of incorporating official wkhtmltopdf releases into this project.

Thanks everyone for your tips and suggestions!

equivalent commented 4 years ago

noticing somethnig simmilar in ubuntu 18.04

    IMGKit::CommandFailedError:
       Command failed: /home/t/.rvm/gems/ruby-2.7.1@projectname/bin/wkhtmltoimage --height 0 --quality 50 --width 600 --format jpg - -: /home/t/.rvm/gems/ruby-2.7.1@projectname/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

using

 wkhtmltoimage-binary (0.12.5)
imgkit (1.6.2)
ruby-2.7.1
rails 6.0.3.2

rvm 1.29

I've tried apt-get install libjpeg-dev and didn't work