1

To give a little background, I am using wkhtmltopdf to convert a local .html to a .pdf for use as evidence for our pipeline/release.

However this html that is generated has some remote scripts and sources. So wkhtmltopdf tries to get those in our Azure pipeline. Our pipeline runs RHEL.

Now the error I am getting with version 0.12.4 was some sort of SSL error which was fixed in version 0.12.5. So I tried to install version 0.12.6 which works, but when running I get the following error:

tools/wkhtmltopdf: error while loading shared libraries: libpng15.so.15: cannot open shared object file: No such file or directory

I found out that for CentOS/RHEL (YUM and RPM package managers) we need to install libpng-devel. So I tried to do that with:

yum --showduplicates list libpng-devel
yum -y install libpng-devel

This does install version libpng-devel-2:1.6.34-5.el8.x86_64 on the RHEL machine but I still get the same error when trying to parse the PDF.

I don't really have much experience with Linux and I don't really know how to solve this anymore, I also tried to search what other version there also are. But I have a Windows development machine, so trying anything has to go though the pipeline (which takes around 10 minutes each time).

I look on SE as well and found that this comes close: "error while loading shared libraries: libpng15.so.15: cannot open shared object file: No such file or directory"? But from the answer I am unsure of what to do next.

TLDR: So how can I fix this error? I need the library but this is not the right one I assume?

Edit: We run RHEL in Azure and someone else made an Artifact which has the wkhtmltopdf build 0.12.6.

Edit 2: Output from yum repolist

repo id repo name
ubi-8-appstream ubi-8-appstream
ubi-8-baseos ubi-8-baseos
ubi-8-codeready-builder Red Hat Universal Base Image 8 (RPMs) - CodeReady Builder
ubi-8-baseos 41 kB/s - 3.8 kB 00:00
ubi-8-baseos 3.9 MB/s - 798 kB 00:00
ubi-8-appstream 51 kB/s - 4.2 kB 00:00
ubi-8-appstream 8.0 MB/s - 2.6 MB 00:00
Red Hat Universal Base Image 8 (RPMs) - CodeRea 37 kB/s - 3.8 kB 00:00

Output from yum install wkhtmltopdf -y No match for argument: wkhtmltopdf Error: Unable to find a match: wkhtmltopdf

Solution:

The uploaded 0.12.6 package was broken, I uploaded a new rpm package and that straight up worked.

3 Answers 3

1

From the version of libpng-devel that you have installed, it looks like you are using RHEL 8.

With that being said, the version of the runtime library that you have installed is too old. You don't need the development package but just the regular package that provides the runtime library.

Assuming that you have the appstream repo enabled, you need libpng15.i686

yum install libpng15.i686 -y

After that you'll be able to see /usr/lib/libpng15.so.15 on the machine.

In the future, if you want to see the package that provides the library/header/binary, or anything else,

yum provides */file_name
3
  • How can I check if the appstream repo is enabled? If I run yum install libpng15 -y it can't find the package, so I assume it's not enabled then?
    – NLxDoDge
    Apr 4, 2022 at 12:24
  • 1
    @NLxDoDge Add the output of yum repolist to the question. Apr 4, 2022 at 19:11
  • Added the output in a markdown table in the question. As well as the output from yum install wkhtmltopdf -y to try that as well.
    – NLxDoDge
    Apr 5, 2022 at 9:10
0

This errors says "the library libpng15.so.15 is missing". Your installation description sounds like it's very likely you don't realize that you can't simply swap one library version for another.

Programs need their shared libraries in exactly the version they were built with (or an ABI-compatible version, but that's basically "the exact same version"). So can't just use a wkhtmltopdf that was built against a .15 version with any other version!

So, you need to re-install your wkhtmltopdf built exactly against the version of libpng you have.

The whole point of linux distros is to make sure the software you install brings in the library versions it needs. Hence,

So I tried to install version 0.12.6 which works

no, it doesn't, and this is exactly how it manifests. You must not just replace system libraries like libpng with ABI-incompatible version.

2
  • I edited my original question, but this RHEL image runs in Azure as a build container. And I get an artifact that I cannot edit myself. So I am trying to fix the issue in the pipeline with what I got. Should I then not continue trying to solve this and just raise and issue internally to re-upload the install package in my company?
    – NLxDoDge
    Apr 4, 2022 at 12:27
  • yes, it's still an RHEL image. So that changes nothing. You cannot just install some other version of a library and expect your software to be compatible. Apr 4, 2022 at 12:37
0

I found this and it worked for me:

sudo -i yum install compat-openssl10.x86_64
3
  • 1
    Welcome to Unix & Linux! Your answer is a bit terse and could be improved by explaining the issue, i.e., the underlying cause of the problem, and why your solution correctly would resolve it for the user in the question.
    – Kusalananda
    Oct 26, 2022 at 6:35
  • 1
    Particularly since you're recommending installing "compat-openssl10" while the OP mentions libpng being the library in question.
    – Jeff Schaller
    Oct 26, 2022 at 10:53
  • Context: after resolving the libpng15 issue, I also encountered this one. I'm running Amazon Linux 2023, based on Fedora (36?), and this package from Alma Linux fixed it for me: repo.almalinux.org/almalinux/8/AppStream/x86_64/os/Packages/… Aug 4, 2023 at 14:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .