Larry Martell
Larry Martell

Reputation: 3756

missing Qt libs with wkhtmltopdf in docker on debian buster

I have a docker container running debian buster and I want to run wkhtmltopdf in it. I have 2 host machines, both identical, both running the same container build with the same Dockerfile. Both are running the same version of docker. On one machine wkhtmltopdf works fine, but on the other I get:

wkhtmltopdf: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory

On the machine where it works:

# ldd /usr/bin/wkhtmltopdf | grep libQt5Core
 libQt5Core.so.5 => /lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f8da6f2f000)

# ls -l /lib/x86_64-linux-gnu/libQt5Core.so.5*
lrwxrwxrwx. 1 root root      19 Dec  4  2017 /lib/x86_64-linux-gnu/libQt5Core.so.5 -> libQt5Core.so.5.9.2
lrwxrwxrwx. 1 root root      19 Dec  4  2017 /lib/x86_64-linux-gnu/libQt5Core.so.5.9 -> libQt5Core.so.5.9.2
-rw-r--r--. 1 root root 5138560 Dec  4  2017 /lib/x86_64-linux-gnu/libQt5Core.so.5.9.2

And on the machine where it doesn't work:

# ldd /usr/bin/wkhtmltopdf | grep libQt5Core
 libQt5Core.so.5 => not found

# ls -l /lib/x86_64-linux-gnu/libQt5Core.so.5*
lrwxrwxrwx. 1 root root      20 Nov 18 16:36 /lib/x86_64-linux-gnu/libQt5Core.so.5 -> libQt5Core.so.5.11.2
lrwxrwxrwx. 1 root root      20 Nov 18 16:36 /lib/x86_64-linux-gnu/libQt5Core.so.5.11 -> libQt5Core.so.5.11.2
-rw-r--r--. 1 root root 5196040 Nov 18 16:36 /lib/x86_64-linux-gnu/libQt5Core.so.5.11.2

Now I do not explicitly install Qt - I assume it gets installed as a dependency of wkhtmltopdf.

Here are the versions of everything, same on both machines:

Inside container:

# cat /etc/debian_version 
buster/sid
# wkhtmltopdf -V          
wkhtmltopdf 0.12.4

Outside container:

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.6 (Maipo)
# docker -v
Docker version 17.06.2-ee-18, build c78b5e1

Anyone have any clue what is going on and how I can get it working?

Why are the version of libQt5Core different? Why doesn't it find it on the non working machine.

I did try copying and linking libQt5Core.so.5.9 from the working machine to the non working but that did not fix it.

This is really vexing me.

Upvotes: 4

Views: 2102

Answers (1)

Patrick W. Barnes
Patrick W. Barnes

Reputation: 21

The problem is a compatibility issue between the libQt5Core shared library and the running kernel. The RHEL system where wkhtmltopdf doesn't work is running a kernel version older than 3.17.

In the Docker container, strip the .note.ABI-tag ELF section from the shared library, and wkhtmltopdf will work:

strip -R .note.ABI-tag /lib64/libQt5Core.so.5.11.3

The strip tool is probably not included in your Docker container. You may need to install the binutils package.

Upvotes: 2

Related Questions