wkhtmltopdf/packaging

Package for Ubuntu 22.04 (jammy)

WolfgangBalzer opened this issue ยท 31 comments

I am trying to build a docker container from Ubuntu 22.04 (jammy), which needs to include wkhtml2pdf installed. When trying to install the old bionic package, I receive the following error message:

dpkg: dependency problems prevent configuration of wkhtmltox:
wkhtmltox depends on libssl1.1; however:
Package libssl1.1 is not installed.

Ubuntu 22.04 uses the package libssl3, but the distribution doesn't contain libssl1.1 anymore.

Please provide a new wkhtml2pdf package for Ubuntu 22.04. Thank you very much in advance.

Does the focal (Ubuntu 20.04) package work?

No, not directly, as explained above. It even may not be installed due to the missing dependency of the libssl1.1 package.

But after installing a the libssl1.1 package from a different source as the distributions repository, I was able to install it and it seems to work. I received the package from here:

https://mirror.sit.fraunhofer.de/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.2_amd64.deb

Whether to provide a new version of wkhtml2pdf for jammy is a different question. I found a workaround for my problem.

OK, after sending my message above, I saw your point. No, I didn't tried focal, just bionic, because I am moving from Ubuntu 18.04 to 22.04 directly. But for now even bionic seems to work.

Please reopen if it doesn't work ๐Ÿคทโ€โ™‚๏ธ

Here is an extract of docker build log for installing wkhtml2pdf focal. The same problem as for bionic:

Step 8/48 : ADD ADDs/wkhtmltox_0.12.6-1.focal_amd64.deb /opt/wkhtmltox.deb
 ---> 8b0914cde829
Step 9/48 : RUN dpkg -i /opt/wkhtmltox.deb
 ---> Running in f1dfc1306ae5
Selecting previously unselected package wkhtmltox.
(Reading database ... 55593 files and directories currently installed.)
Preparing to unpack /opt/wkhtmltox.deb ...
Unpacking wkhtmltox (1:0.12.6-1.focal) ...
dpkg: dependency problems prevent configuration of wkhtmltox:
 wkhtmltox depends on libssl1.1; however:
  Package libssl1.1 is not installed.

... and libssl1.1 is not available in Ubuntu jammy.

Did you try apt-get install -f? Never mind, I see the problem.

I used the force option for dpkg like below and the installation is forced and the container created:

RUN dpkg -i --force-depends /opt/wkhtmltox.deb

But when running the command in the container, it says:

# wkhtmltopdf 
wkhtmltopdf: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

I try with jammy and version 0.12.5, but it fails. I'v changed libssl1.1 for libssl3, but it think that is another error.

make[1]: *** [Makefile:129120: .obj/release-static/qfiledialog.o] Error 1
make[1]: Leaving directory '/tgt/qt/src/gui'
make: *** [Makefile:375: sub-gui-make_default-ordered] Error 2
docker run --rm -v/home/igallart/pdf/wkhtmltopdf:/src -v/home/igallart/pdf/packaging/targets/jammy-amd64:/tgt -v/home/igallart/pdf/packaging:/pkg -w/tgt/qt --user 1000:1000 wkhtmltopdf/0.12:jammy-amd64 make -j8
command failed: exit code 2

In line of docker of focal, it sais "RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 10 --slave /usr/bin/g++ g++ /usr/bin/g++-7 --slave /usr/bin/cpp cpp /usr/bin/cpp-7", in jammy, what should it be?

So the issue is, the patched Qt in wkhtmltopdf uses very old code and doesn't work with the latest gcc versions. In 20.04, an older version of gcc was used which isn't available in jammy. Need to figure out how to get it fixed there ๐Ÿคทโ€โ™‚๏ธ

In jammy, the minimal version of gcc is 9
https://packages.ubuntu.com/jammy/amd64/gcc-9

I fear there will be no build for Ubuntu 22.04 any time soon, which is absolut understandable when reading the status page.

Back in 2014, wkhtmltopdf was ahead of its time. It took me two days to migrate everything to Puppeteer and I feel a bit sad about it. How ever, I think in the long term it's the right decision.

All left to say is, thank you @ashkulz and all contributors. Thank you very much for your time and effort. It was a great time.

Sorry for asking silly questions, but wkhtmltopdf is available from the distribution repositories of Ubuntu 22.04 (jammy) as version 0.12.6. Who has provided this package, if not you?

$ apt show wkhtmltopdf
Package: wkhtmltopdf
Version: 0.12.6-2
Priority: extra
Section: universe/utils
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Emmanuel Bouthenot <kolter@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 632 kB
Depends: libc6 (>= 2.34), libgcc-s1 (>= 3.3.1), libqt5core5a (>= 5.15.1), libqt5gui5 (>= 5.2.0) | libqt5gui5-gles (>= 5.2.0), libqt5network5 (>= 5.14.1), libqt5printsupport5 (>= 5.2.0), libqt5svg5 (>= 5.6.0~beta), libqt5webkit5 (>= 5.212.0~alpha3), libqt5widgets5 (>= 5.0.2), libstdc++6 (>= 5.2)
Recommends: xserver | xvfb
Homepage: https://wkhtmltopdf.org/
Download-Size: 173 kB
APT-Manual-Installed: yes
APT-Sources: http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
Description: Command line utilities to convert html to pdf or image using WebKit
 wkhtmltopdf is a command line program which permits one to create a
 pdf or an image from an url, a local html file or stdin. It produces a pdf or
 an image like rendered with the WebKit engine.
 .
 This program requires an X11 server to run.
 .
 It is not built against a forked version of Qt hence some options are not
 supported.

See "It is not built against a forked version of Qt hence some options are not supported" -- it's built by Debian/Ubuntu without patches.

Hello, I can do work in ubuntu 22.04 compiled from ubuntu impished.
I do this, I did changed the file Dockerfile.focal and build.yml and it worked in 22.04. But only with version 0.12.1.4.
files.zip

@igallart i really would owe you more then one beer if you could also compile 12.6.1. for jammy against the patched Qt version... that would be awesome!

Hi @preeco-privacy , I have created the package of version 0.12.6, although I have not tested it. It created fine, but I have not been able to test it. If it works well, you will send me an invitation to a good restaurant!
wkhtmltox_0.12.6-1.jammy_amd64.zip

Hi @igallart!

works like a charm... including header/footer and ToC.. Thx!

PS: Pls give a a private message and let me know where you are located and i'll do my best regarding the restaurant

I'm glad it works, and no invitation is necessary, in any case it would have to be to @ashkulz, I haven't really done much, just some little trick to make it functional.

Builds have been published to the website: see wkhtmltopdf/wkhtmltopdf@e59bfcc.

I've deleted the comment, the links were not working for a period of time, all good now. Sorry for the noise.

With Ubuntu Impished it compile.

wkhtmltox_0.12.5-1.jammy_amd64.zip wkhtmltox_0.12.1.4-1.jammy_amd64.zip

Thanks, It's working on Ubuntu 22.04 amd64

In my case, I was able to get version 0.12.1.6-2 working with jammy after looking at the current releases - thanks everyone for your attention to this.

Hi @igallart, can I ask what your final setup is for building on jammy, I hve used your files but am getting stuck. On the same build machine (20.04) I can run the packager to create a focal distribution, wkhtml and qt get compiled and linked and all good I get a .deb produced. But if I then try for a jammy dist using the way you mention by noting impish etc. or just using the packager Docker.debian I get tons of errors produced

make[1]: Entering directory '/tgt/qt/src/gui'
compiling /src/qt/src/gui/dialogs/qprintdialog_unix.cpp
/src/qt/src/gui/dialogs/qprintdialog_unix.cpp: In destructor 'virtual QPrintPropertiesDialog::~QPrintPropertiesDialog()':
/src/qt/src/gui/dialogs/qprintdialog_unix.cpp:281:19: error: 'class Ui::QPrintPropertiesWidget' has no member named 'cupsPropertiesPage'
281 | delete widget.cupsPropertiesPage;
| ^~~~~~~~~~~~~~~~~~

I'm not sure if these are related to the gcc version issue in the pulled dockerimage or there is something not right with my qt in the wkhtmlto pdf source directory.

Any help woudl be appreciated. I am running 20.04 as a virtual machine in esxi.

@arborrow - when you say you got it working with jammy di you manage to build it using the packager and if so could you share your setup?

Many thanks to both

P.

@igallart & @arborrow

OK I managed to get it sorted. It was indeed the gcc version on the docker image that was the problem. I needed to force the install of gcc7 on a jammy docker image and to do that I had to create a new Dockerfile.jammy with the below contents and reference it from build.yml. I attach both files here for future reference.

Dockerfile_and_build_yml.zip

Note the need to add the focal repository to get gcc7 as it is not available in the jammy (22.04) repository, and then the line at the end to tell 22.04 to use gcc7.

Start Dockerfile.jammy

ARG from
FROM ${from}

ARG jpeg=libjpeg-dev
ARG ssl=libssl-dev
ENV CFLAGS=-w CXXFLAGS=-w

RUN apt-get update -y

RUN apt-get install -y software-properties-common
RUN add-apt-repository -y 'deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe'

RUN apt-get install -y -q --no-install-recommends
dpkg-dev
libc6-dev
make
gcc-7
g++-7
libfontconfig1-dev
libfreetype6-dev
$jpeg
libpng-dev [](url)
$ssl
libx11-dev
libxext-dev
libxrender-dev
python
zlib1g-dev
&& rm -rf /var/lib/apt/lists/*

RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 10 --slave /usr/bin/g++ g++ /usr/bin/g++-7

End here

Finally for those who are reading this and not familiar with docker, if you edit the build python file and find and change the docker build line to:

shell('docker build --no-cache --progress=plain -f %s %s -t %s docker/' % (params['source'], args, image))

you will get some good debug to the console to help you figure out where you are at, you can also set the force variable to 1 inline!

For anyone interested ( @jerbob92 ) I also attach my build of WKHTMLTOPDF with the Portrait and Landscape command line arguments as described in Page Orientation V.2019 #4439

wkhtmltox_0.12.6-0.20230212.dev.jammy_amd64.zip

Thanks for the previous contributions and pointers to get this solved,

P.

@PerlTester you just need to cherry-pick the necessary Qt commits -- that's the same thing that the 0.12.6.x branch does, which was used for the recent releases.

With Ubuntu Impished it compile.

wkhtmltox_0.12.5-1.jammy_amd64.zip wkhtmltox_0.12.1.4-1.jammy_amd64.zip

Thanks a lot.. It worked finally

I can confirm that the latest package taken from the download page (0.12.6.1-2 at the moment), works on Ubuntu 22.04, it has the QT patch inside

ganzo commented

With Ubuntu Impished it compile.

wkhtmltox_0.12.5-1.jammy_amd64.zip wkhtmltox_0.12.1.4-1.jammy_amd64.zip

TY, It's works on Ubuntu 22.04 amd64