wkhtmltopdf_binary_gem icon indicating copy to clipboard operation
wkhtmltopdf_binary_gem copied to clipboard

not working on Rocky Linux 9.x

Open makhomed opened this issue 8 months ago • 4 comments

can you please make wkhtmltopdf-binary working without any problems and workarounds on the Rocky Linux 9.x and Rocky Linux 10.x ?

bug:

$ /home/www/bin/wkhtmltopdf --help
/home/www/.local/share/gem/ruby/gems/wkhtmltopdf-binary-0.12.6.9/bin/wkhtmltopdf:96:in `<top (required)>': Invalid platform, must be running on Ubuntu 16.04/18.04/20.04/22.04, CentOS 6/7/8, Debian 9/10/11/12, Archlinux amd64, Debian 9/10/11/12 arm64, or Intel-based Cocoa macOS (missing binary: /home/www/.local/share/gem/ruby/gems/wkhtmltopdf-binary-0.12.6.9/bin/wkhtmltopdf_rocky_9.6_amd64). (RuntimeError)
        from ./wkhtmltopdf:25:in `load'
        from ./wkhtmltopdf:25:in `<main>'

workaround:

$ cd /home/www/.local/share/gem/ruby/gems/wkhtmltopdf-binary-0.12.6.9/bin
$ ln -s wkhtmltopdf_debian_12_amd64.gz wkhtmltopdf_rocky_9.6_amd64.gz

makhomed avatar Aug 11 '25 11:08 makhomed

The code to handle a new distribution variant is fairly simple, and there is support for Rocky 8 here: https://github.com/zakird/wkhtmltopdf_binary_gem/blob/master/bin/wkhtmltopdf#L58

I don't run Rocky. Are version 9 and 10 now Debian-based instead of CentOS?

unixmonkey avatar Aug 11 '25 12:08 unixmonkey

The code to handle a new distribution variant is fairly simple, and there is support for Rocky 8 here: https://github.com/zakird/wkhtmltopdf_binary_gem/blob/master/bin/wkhtmltopdf#L58

I don't run Rocky. Are version 9 and 10 now Debian-based instead of CentOS?

All Rocky Linux versions 8, 9, 10 are RHEL-based only.

CentOS 7 distro already EOL. CentOS Linux 7 reached end of life (EOL) on June 30, 2024. CentOS Stream 8, 9, 10 distro is upstream for RHEL, but is is not stable and not for production use.

Rocky Linux, AlmaLinux and all other RHEL clones are RHEL-based, not CentOS-based.

As I understand, all shared libraries, required by wkhtmltopdf_debian_12_amd64 binary also are are present in the Rocky Linux 9.6 system, so I can use debian binary on the Rocky Linux 9.6 to workaround bug with pdf generation after migrating to redmine 6.0.6 with Invoice PRO plugin from RedmineUp:

$ cat /home/www/redmine/plugins/redmine_contacts_invoices/Gemfile
gem 'wicked_pdf', '~> 1.1.0'
gem 'wkhtmltopdf-binary'

generated buggy file invoice-20190114_0034-77-3.pdf content:

Failed to execute:
["/home/www/bin/wkhtmltopdf", "-q", "--encoding", "UTF-8", "--page-size", "A4", "--margin-top", "20", "--margin-bottom", "20", "--margin-left", "20", "--margin-right", "20", "--footer-left", "20190114/0034-77", "--footer-right", "[page]/[topage]", "file:////tmp/wicked_pdf20250811-1207-ikk3vo.html", "/tmp/wicked_pdf_generated_file20250811-1207-t1g9up.pdf"]
Error: PDF could not be generated!
 Command Error: /home/www/.local/share/gem/ruby/gems/wkhtmltopdf-binary-0.12.6.9/bin/wkhtmltopdf:96:in `<top (required)>': Invalid platform, must be running on Ubuntu 16.04/18.04/20.04/22.04, CentOS 6/7/8, Debian 9/10/11/12, Archlinux amd64, Debian 9/10/11/12 arm64, or Intel-based Cocoa macOS (missing binary: /home/www/.local/share/gem/ruby/gems/wkhtmltopdf-binary-0.12.6.9/bin/wkhtmltopdf_rocky_9.6_amd64). (RuntimeError)
	from /home/www/bin/wkhtmltopdf:25:in `load'
	from /home/www/bin/wkhtmltopdf:25:in `<main>'

with workaround from previous message applied - all works fine.

P.S.

[[email protected] ~/.local/share/gem/ruby/gems/wkhtmltopdf-binary-0.12.6.9/bin]$ ldd wkhtmltopdf_debian_12_amd64
        linux-vdso.so.1 (0x00007ffd34350000)
        libjpeg.so.62 => /lib64/libjpeg.so.62 (0x00007fe7c007b000)
        libpng16.so.16 => /lib64/libpng16.so.16 (0x00007fe7c0044000)
        libXrender.so.1 => /lib64/libXrender.so.1 (0x00007fe7c0037000)
        libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x00007fe7bd3b1000)
        libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007fe7bd2ee000)
        libX11.so.6 => /lib64/libX11.so.6 (0x00007fe7bd1a6000)
        libssl.so.3 => /lib64/libssl.so.3 (0x00007fe7bd0c0000)
        libcrypto.so.3 => /lib64/libcrypto.so.3 (0x00007fe7bca00000)
        libz.so.1 => /lib64/libz.so.1 (0x00007fe7c001b000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fe7bc600000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fe7bcfe5000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fe7c0001000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fe7bc200000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe7c0105000)
        libxml2.so.2 => /lib64/libxml2.so.2 (0x00007fe7bc877000)
        libbz2.so.1 => /lib64/libbz2.so.1 (0x00007fe7bcfd0000)
        libharfbuzz.so.0 => /lib64/libharfbuzz.so.0 (0x00007fe7bc531000)
        libbrotlidec.so.1 => /lib64/libbrotlidec.so.1 (0x00007fe7bcfc2000)
        libxcb.so.1 => /lib64/libxcb.so.1 (0x00007fe7bcf97000)
        liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fe7bcf69000)
        libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007fe7bc0c6000)
        libgraphite2.so.3 => /lib64/libgraphite2.so.3 (0x00007fe7bcf48000)
        libbrotlicommon.so.1 => /lib64/libbrotlicommon.so.1 (0x00007fe7bcf25000)
        libXau.so.6 => /lib64/libXau.so.6 (0x00007fe7bcf1f000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fe7bc4b9000)

makhomed avatar Aug 11 '25 16:08 makhomed

other possible (and preferred) workaround - is to use binary from official site

https://wkhtmltopdf.org/downloads.html

for AlmaLinux 9

because AlmaLinux is also RHEL-based fork and binary for AlmaLinux should work normally for Rocky Linux 9 and RHEL 9.

makhomed avatar Aug 12 '25 05:08 makhomed

@zakird can you, please, include "AlmaLinux" binary from https://wkhtmltopdf.org/downloads.html into gem for 9 and 8 versions of system?

"AlmaLinux" is RHEL fork binary compatible with Rocky Linux and RHEL.

makhomed avatar Oct 15 '25 20:10 makhomed