I am upgrading my servers to Amazon Linux 2023 from AL2. My application needs wkhtmltopdf and now while trying to install it I see that is not officially released on my specific OS version. I have already tried to install the version for AL2 but after installing all dependencies it still missing libpng.
I tried downloading the .rpm file from https://wkhtmltopdf.org/downloads.html under the AL2 aarch64 and ran sudo yum install wkhtmltox-0.12.6-1.amazonlinux2.aarch64.rpm
. It seems to install correctly but executing a sample wkhtmltopdf google.com google.pdf
fails. Any ideas on how to build wkhtmltopdf in Amazon Linux 2023?
On a side question. I see the Github repositories associated to this library are Archived, should I consider migrating my application's PDF generation to a different lib?
[ec2-user@backoffice ~]$ sudo yum install wkhtmltox-0.12.6-1.amazonlinux2.aarch64.rpm
Last metadata expiration check: 1:02:21 ago on Mon Nov 20 20:13:06 2023.
Dependencies resolved.
===========================================================================================================================================
Package Architecture Version Repository Size
===========================================================================================================================================
Installing:
wkhtmltox aarch64 1:0.12.6-1.amazonlinux2 @commandline 13 M
Installing dependencies:
cairo aarch64 1.17.6-2.amzn2023.0.1 amazonlinux 669 k
fontconfig aarch64 2.13.94-2.amzn2023.0.2 amazonlinux 278 k
fonts-filesystem noarch 1:2.0.5-12.amzn2023.0.2 amazonlinux 9.5 k
freetype aarch64 2.13.0-2.amzn2023.0.1 amazonlinux 412 k
google-noto-fonts-common noarch 20201206-2.amzn2023.0.2 amazonlinux 15 k
google-noto-sans-vf-fonts noarch 20201206-2.amzn2023.0.2 amazonlinux 492 k
graphite2 aarch64 1.3.14-7.amzn2023.0.2 amazonlinux 93 k
harfbuzz aarch64 7.0.0-2.amzn2023.0.1 amazonlinux 843 k
langpacks-core-font-en noarch 3.0-21.amzn2023.0.4 amazonlinux 10 k
libX11 aarch64 1.7.2-3.amzn2023.0.4 amazonlinux 648 k
libX11-common noarch 1.7.2-3.amzn2023.0.4 amazonlinux 152 k
libXau aarch64 1.0.9-6.amzn2023.0.2 amazonlinux 32 k
libXext aarch64 1.3.4-6.amzn2023.0.2 amazonlinux 40 k
libXrender aarch64 0.9.10-14.amzn2023.0.2 amazonlinux 27 k
libfontenc aarch64 1.1.3-15.amzn2023.0.2 amazonlinux 31 k
libjpeg-turbo aarch64 2.1.4-2.amzn2023.0.5 amazonlinux 191 k
libpng aarch64 2:1.6.37-10.amzn2023.0.6 amazonlinux 121 k
libxcb aarch64 1.13.1-7.amzn2023.0.2 amazonlinux 231 k
mkfontscale aarch64 1.2.1-2.amzn2023.0.3 amazonlinux 33 k
pixman aarch64 0.40.0-3.amzn2023.0.3 amazonlinux 194 k
ttmkfdir aarch64 3.0.9-63.amzn2023.0.2 amazonlinux 51 k
xml-common noarch 0.6.3-56.amzn2023.0.2 amazonlinux 32 k
xorg-x11-fonts-75dpi noarch 7.5-31.amzn2023.0.2 amazonlinux 2.7 M
xorg-x11-fonts-Type1 noarch 7.5-31.amzn2023.0.2 amazonlinux 500 k
Transaction Summary
===========================================================================================================================================
Install 25 Packages
Trying:
[ec2-user@backoffice ~]$ wkhtmltopdf
/home/ec2-user/.rvm/gems/ruby-3.2.2/gems/wkhtmltopdf-binary-0.12.6.6/bin/wkhtmltopdf_centos_6_i386: /home/ec2-user/.rvm/gems/ruby-3.2.2/gems/wkhtmltopdf-binary-0.12.6.6/bin/wkhtmltopdf_centos_6_i386: cannot execute binary file
[ec2-user@backoffice ~]$ wkhtmltoimage
wkhtmltoimage: error while loading shared libraries: libpng15.so.15: cannot open shared object file: No such file or directory
[ec2-user@backoffice ~]$ which wkhtmltoimage
/usr/local/bin/wkhtmltoimage
[ec2-user@backoffice ~]$ cd /usr/local/bin/
[ec2-user@backoffice bin]$ ls
wkhtmltoimage wkhtmltopdf
[ec2-user@backoffice bin]$ ./wkhtmltopdf
./wkhtmltopdf: error while loading shared libraries: libpng15.so.15: cannot open shared object file: No such file or directory
Not sure whether you are looking for a solution still, but leaving this here to help someone else potentially.
This solution is not intended for aarch64, but could likely be modified to work on aarch64. wkhtmltox
is dependant on specific versions of openssl
and libpng
which are not the versions installed by default on the Amazon Linux 2 machines. In order to make this work on aarch64 the openssl
, libpng
and wkhtmltox
would have to be swapped for aarch64 versions:
commands:
01_install_dependencies:
command: yum install --assumeyes zlib fontconfig freetype libX11 libXext libXrender xorg-x11-fonts-75dpi xorg-x11-fonts-Type1
02_install_libpng15:
command: yum localinstall -y https://repo.almalinux.org/almalinux/8/AppStream/x86_64/os/Packages/libpng15-1.5.30-7.el8.x86_64.rpm
03_install_libssl10:
command: yum localinstall -y https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/compat-openssl10-1.0.2o-4.el8.x86_64.rpm
04_install_wkhtmltox:
command: yum localinstall -y https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.amazonlinux2.x86_64.rpm
If you are using docker, the linux generic available on version 12.3 is working for amd64:
RUN mkdir wkhtmltopdf && \
wget -O wkhtmltox-0.12.3_linux-generic-amd64.tar.xz "https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz" && \
tar -xJf "wkhtmltox-0.12.3_linux-generic-amd64.tar.xz" -C wkhtmltopdf --strip-components=1 && \
mv wkhtmltopdf/bin/wkhtmltopdf /usr/bin && \
rm "wkhtmltox-0.12.3_linux-generic-amd64.tar.xz" -r wkhtmltopdf
If you're using locally a mac M1 that will not work because of the processor architecture, so I use this for development:
RUN mkdir wkhtmltopdf && \
wget -O /tmp/wkhtmltox.rpm https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox-0.12.6.1-2.almalinux9.aarch64.rpm && \
yum localinstall -y /tmp/wkhtmltox.rpm
I discovered this by trial and error, so hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With