wkhtmltopdf / packaging

Packaging of wkhtmltopdf releases
https://wkhtmltopdf.org/downloads.html#stable
301 stars 136 forks source link

Error building for Amazon Linux 2023: QPageSetupWidget has no member named ... #154

Closed davidreedernst closed 1 year ago

davidreedernst commented 1 year ago

I'm trying to get wkhtmltopdf installed on Amazon Linux 2023. (We've used it on Amazon Linux 2 for years, but we're migrating to a newer virtual server). I was disappointed that the precompiled binaries page didn't have one already. But, ok, I'm trying to compile from source, even though this is outside my comfort zone. I got all of the prerequisites installed. I was pleasantly surprised (but a bit confused) that amazonlinux2023 was one of the targets in build.yaml. I eventually ran the build script as

./build package-docker amazonlinux2023-x86_64 ../wkhtmltopdf/

It did a lot of things seemingly successfully, but eventually crashed with

/src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp: In constructor 'QPageSetupWidget::QPageSetupWidget(QWidget*)': /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:276:12: error: 'class Ui::QPageSetupWidget' has no member named 'topMargin' 276 | widget.topMargin->setSuffix(suffix);

followed by lots of other lines citing other members that aren't present (bottom, left, & right margin; paper Width & Height; etc).

Can anyone offer any guidance on what to do from here? And/or, since the Amazon Linux 2023 OS is a recognized target, could we get a precompiled binary on that downloads page?

Thank you to anyone who can offer any help!

ashkulz commented 1 year ago

Please confirm that you used the 0.12.6.x branch of the main repository.

davidreedernst commented 1 year ago

Ah, no, I didn't. I used this to get the code:

git clone --recurse-submodules https://github.com/wkhtmltopdf/wkhtmltopdf.git

but the VERSION file says that I have 0.12.7-dev. I just tried again, checking out the main repo with

git clone --recurse-submodules --branch 0.12.6 https://github.com/wkhtmltopdf/wkhtmltopdf.git

the resulting VERSION file says 0.12.6. I tried to build against that, but .... still died with the same errors. :( Other thoughts?

ashkulz commented 1 year ago

I meant this branch -- it should work.

davidreedernst commented 1 year ago

Thank you very much for your impressively quick replies! This time I did

git clone --recurse-submodules --branch 0.12.6.x https://github.com/wkhtmltopdf/wkhtmltopdf.git

and tried to build against that. I think we did get past the QPageSetupWidget errors that were the problem before. However, it still ended with an error:

compiling qrc_wkhtmltopdf.cpp
rm -f libwkhtmltox.so.0.12.6 libwkhtmltox.so libwkhtmltox.so.0 libwkhtmltox.so.0.12   
linking ../../bin/libwkhtmltox.so.0.12.6
/usr/bin/ld: cannot find -lQtWebKit: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: Leaving directory '/tgt/app/src/lib'
make[1]: *** [Makefile:166: ../../bin/libwkhtmltox.so.0.12.6] Error 1
make: *** [Makefile:61: sub-src-lib-install_subtargets-ordered] Error 2
docker run --rm -v/home/ec2-user/unzip/wkhtmltopdf:/src -v/home/ec2-user/unzip/packaging-master/targets/amazonlinux2023-x86_64:/tgt -v/home/ec2-user/unzip/packaging-master:/pkg -w/tgt/app --user 1000:1000 wkhtmltopdf/0.12:amazonlinux2023-x86_64 make install INSTALL_ROOT=/tgt/wkhtmltox
command failed: exit code 2

I wondered if I needed to install a package to get the QtWebKit support, but if so, I don't know what package. Also, I would have thought that this would have happened inside of the docker container, so it wouldn't depend on the library being on the build machine. Any guidance?

ashkulz commented 1 year ago

I'm not sure what you did, but I ran it locally and it works

[lots of output snipped]
Unable to find image 'wkhtmltopdf/fpm:1.10.2-20221124' locally
1.10.2-20221124: Pulling from wkhtmltopdf/fpm
a603fa5e3b41: Pull complete 
824cc1987b4c: Pull complete 
36e7129cddea: Pull complete 
de3e10db531f: Pull complete 
479dda4422d3: Pull complete 
0cbd5c2fc6ce: Pull complete 
c2006d0524d1: Pull complete 
Digest: sha256:01d321510c80104c860987f21ce9ea8da4de1aca16663cbbfbf49e8b73e969d0
Status: Downloaded newer image for wkhtmltopdf/fpm:1.10.2-20221124
Doing `require 'backports'` is deprecated and will not load any backport in the next major release.
Require just the needed backports instead, or 'backports/latest'.
{:timestamp=>"2023-06-21T02:04:55.690538+0000", :message=>"Created package", :path=>"wkhtmltox-0.12.6.1-1.amazonlinux2023.x86_64.rpm"}
davidreedernst commented 1 year ago

I wondered if something from previous builds was mucking things up, so I ran again with

./build package-docker --clean amazonlinux2023-x86_64 ../wkhtmltopdf/

And it worked! Thank you very much for your guidance.