zakird / wkhtmltopdf_binary_gem

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

Failure on Rocky 8 build #135

Closed Alfeezy closed 2 years ago

Alfeezy commented 2 years ago

I am getting the following error:

.../rvm/gems/ruby-3.0.2/gems/wkhtmltopdf-binary-0.12.6.5/bin/wkhtmltopdf:61:in `<top (required)>': Invalid platform, must be running on Ubuntu 16.04/18.04/20.04 CentOS 6/7/8, Debian 9/10, archlinux amd64, or intel-based Cocoa macOS (missing binary: .../rvm/gems/ruby-3.0.2/gems/wkhtmltopdf-binary-0.12.6.5/bin/wkhtmltopdf_rocky_8.5_amd64). (RuntimeError)
    from .../rvm/gems/ruby-3.0.2/bin/wkhtmltopdf:23:in `load'
    from .../rvm/gems/ruby-3.0.2/bin/wkhtmltopdf:23:in `<main>'

Currently, our systems are running rocky 8, hence why wkhtmltopdf_rocky_8.5_amd64 is what is being searched for. What is confusing me is the following lines in bin/wkhtmltopdf would suggest that we should in fact be looking a file by the name of wkhtmltopdf_centos_8_amd64, which is present in wkhtmltopdf-binary-0.12.6.5/bin/.

os = 'centos_8' if os.start_with?('rocky_8') || os.start_with?('rhel_8.')
...
architecture = RbConfig::CONFIG['host_cpu'] == 'x86_64' ? 'amd64' : 'i386'
"#{os}_#{architecture}"

Am I misunderstanding something here, or is it looking for the wrong filename? The only place where is seems like the prefix could be incorrectly set is in the line:

suffix = ENV['WKHTMLTOPDF_HOST_SUFFIX'] unless ENV['WKHTMLTOPDF_HOST_SUFFIX'].to_s.empty?

Where, when, and how does ENV['WKHTMLTOPDF_HOST_SUFFIX'] get defined?