wkhtmltopdf / packaging

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

How can I use the full version of wkhtmltopdf on Ubuntu 22.04 with s390x architecture? #145

Closed Winnie0408 closed 1 year ago

Winnie0408 commented 1 year ago

I need to use the full version of wkhtmltopdf on an Ubuntu 22.04 system with s390x architecture. I found that I can use 'sudo apt-get install wkhtmltopdf' to install it, but it seems to not be the full version. When I try to use it, it prompts 'This version of wkhtmltopdf has been compiled against a version of QT without the wkhtmltopdf patches.' I also looked for installation packages for s390x architecture on the official website and Github's Release page, but couldn't find any. I also tried to compile from source code, but the '--list-target' in the build file doesn't have the s390x option. 😭😭😭 What should I do? If you could help me solve this problem, I would be very grateful! 🙏🙏🙏

The screenshot of that prompts: image

ashkulz commented 1 year ago

@Winnie0408 try changing this line to include s390x. You'll probably also need to add a mapping for the architecture in Debian/Ubuntu to the one used in Docker. After that, try a build :crossed_fingers:

Winnie0408 commented 1 year ago

@Winnie0408 try changing this line to include s390x. You'll probably also need to add a mapping for the architecture in Debian/Ubuntu to the one used in Docker. After that, try a build 🤞

@ashkulz Thank you very much for your help! 😃😃😃 I have successfully entered the compilation process by using the method you mentioned to modify the file.

However, I have encountered a new problem: when compiling Qt, there are many error messages saying "class Ui::QPageSetupWidget' has no member named XXX". 😵‍💫😵‍💫😵‍💫 I have also searched for solutions to the problem on the Internet, but none of them can fix the problem I encountered. I have also tried to downgrade Ubuntu from version 22.04 to 16.04, but it still doesn't work. 😢😢😢 What should I do next? Looking forward to your reply!

I use git clone git@github.com:wkhtmltopdf/wkhtmltopdf.git git clone git@github.com:wkhtmltopdf/packaging.git to clone the source files of wkhtmltopdf and packaging, and use git submodule update --init --recursive to download the Qt source code

The command I used to compile the source code: ./build --use-qemu linux/amd64 package-docker jammy-s390x ../wkhtmltopdf

Part of the error prompts: compiling /src/qt/src/gui/dialogs/qwizard.cpp moc /src/qt/src/gui/dialogs/qprintpreviewdialog.cpp compiling /src/qt/src/gui/itemviews/qabstractitemview.cpp /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); | ^~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:277:12: error: 'class Ui::QPageSetupWidget' has no member named 'bottomMargin' 277 | widget.bottomMargin->setSuffix(suffix); | ^~~~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:278:12: error: 'class Ui::QPageSetupWidget' has no member named 'leftMargin' 278 | widget.leftMargin->setSuffix(suffix); | ^~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:279:12: error: 'class Ui::QPageSetupWidget' has no member named 'rightMargin' 279 | widget.rightMargin->setSuffix(suffix); | ^~~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:280:12: error: 'class Ui::QPageSetupWidget' has no member named 'paperWidth' 280 | widget.paperWidth->setSuffix(suffix); | ^~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:281:12: error: 'class Ui::QPageSetupWidget' has no member named 'paperHeight' 281 | widget.paperHeight->setSuffix(suffix); | ^~~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:283:47: error: 'class Ui::QPageSetupWidget' has no member named 'preview' 283 | QVBoxLayout *lay = new QVBoxLayout(widget.preview); | ^~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:284:12: error: 'class Ui::QPageSetupWidget' has no member named 'preview' 284 | widget.preview->setLayout(lay); | ^~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:285:45: error: 'class Ui::QPageSetupWidget' has no member named 'preview' 285 | m_pagePreview = new QPagePreview(widget.preview); | ^~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:294:12: error: 'class Ui::QPageSetupWidget' has no member named 'paperSourceLabel' 294 | widget.paperSourceLabel->setVisible(false); | ^~~~~~~~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:295:12: error: 'class Ui::QPageSetupWidget' has no member named 'paperSource' 295 | widget.paperSource->setVisible(false); | ^~~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:298:12: error: 'class Ui::QPageSetupWidget' has no member named 'reverseLandscape' 298 | widget.reverseLandscape->setVisible(false); | ^~~~~~~~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:299:12: error: 'class Ui::QPageSetupWidget' has no member named 'reversePortrait' 299 | widget.reversePortrait->setVisible(false); | ^~~~~~~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:301:31: error: 'class Ui::QPageSetupWidget' has no member named 'paperSize' 301 | populatePaperSizes(widget.paperSize); | ^~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:305:12: error: 'class Ui::QPageSetupWidget' has no member named 'unit' 305 | widget.unit->addItems(units); | ^~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:306:20: error: 'class Ui::QPageSetupWidget' has no member named 'unit' 306 | connect(widget.unit, SIGNAL(activated(int)), this, SLOT(unitChanged(int))); | ^~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:307:12: error: 'class Ui::QPageSetupWidget' has no member named 'unit' 307 | widget.unit->setCurrentIndex((QLocale::system().measurementSystem() == QLocale::ImperialSystem) ? 2 : 1); | ^~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:309:20: error: 'class Ui::QPageSetupWidget' has no member named 'paperSize' 309 | connect(widget.paperSize, SIGNAL(currentIndexChanged(int)), this, SLOT(_q_paperSizeChanged())); | ^~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:310:20: error: 'class Ui::QPageSetupWidget' has no member named 'paperWidth' 310 | connect(widget.paperWidth, SIGNAL(valueChanged(double)), this, SLOT(_q_paperSizeChanged())); | ^~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:311:20: error: 'class Ui::QPageSetupWidget' has no member named 'paperHeight' 311 | connect(widget.paperHeight, SIGNAL(valueChanged(double)), this, SLOT(_q_paperSizeChanged())); | ^~~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:313:20: error: 'class Ui::QPageSetupWidget' has no member named 'leftMargin' 313 | connect(widget.leftMargin, SIGNAL(valueChanged(double)), this, SLOT(setLeftMargin(double))); | ^~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:314:20: error: 'class Ui::QPageSetupWidget' has no member named 'topMargin' 314 | connect(widget.topMargin, SIGNAL(valueChanged(double)), this, SLOT(setTopMargin(double))); | ^~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:315:20: error: 'class Ui::QPageSetupWidget' has no member named 'rightMargin' 315 | connect(widget.rightMargin, SIGNAL(valueChanged(double)), this, SLOT(setRightMargin(double))); | ^~~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:316:20: error: 'class Ui::QPageSetupWidget' has no member named 'bottomMargin' 316 | connect(widget.bottomMargin, SIGNAL(valueChanged(double)), this, SLOT(setBottomMargin(double))); | ^~~~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:318:20: error: 'class Ui::QPageSetupWidget' has no member named 'portrait' 318 | connect(widget.portrait, SIGNAL(clicked()), this, SLOT(_q_pageOrientationChanged())); | ^~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:319:20: error: 'class Ui::QPageSetupWidget' has no member named 'landscape' 319 | connect(widget.landscape, SIGNAL(clicked()), this, SLOT(_q_pageOrientationChanged())); | ^~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp: In member function 'void QPageSetupWidget::setPrinter(QPrinter*)': /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:328:24: error: 'class Ui::QPageSetupWidget' has no member named 'unit' 328 | unitChanged(widget.unit->currentIndex()); | ^~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:331:12: error: 'class Ui::QPageSetupWidget' has no member named 'paperWidth' 331 | widget.paperWidth->setValue(m_paperSize.width() / m_currentMultiplier); | ^~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:332:12: error: 'class Ui::QPageSetupWidget' has no member named 'paperHeight' 332 | widget.paperHeight->setValue(m_paperSize.height() / m_currentMultiplier); | ^~~~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:334:12: error: 'class Ui::QPageSetupWidget' has no member named 'landscape' 334 | widget.landscape->setChecked(printer->orientation() == QPrinter::Landscape); | ^~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp: In member function 'void QPageSetupWidget::setupPrinter() const': /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:347:48: error: 'const class Ui::QPageSetupWidget' has no member named 'portrait' 347 | QPrinter::Orientation orientation = widget.portrait->isChecked() | ^~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:352:27: error: 'const class Ui::QPageSetupWidget' has no member named 'paperSize' 352 | QVariant val = widget.paperSize->itemData(widget.paperSize->currentIndex()); | ^~~~~~~~~ /src/qt/src/gui/dialogs/qpagesetupdialog_unix.cpp:352:54: error: 'const class Ui::QPageSetupWidget' has no member named 'paperSize' 352 | QVariant val = widget.paperSize->itemData(widget.paperSize->currentIndex()); BalaBala...

ashkulz commented 1 year ago

@Winnie0408 please use the 0.12.6.x branch and see if that helps.

Winnie0408 commented 1 year ago

@Winnie0408 please use the 0.12.6.x branch and see if that helps.

@ashkulz Thank you very much, I have successfully compiled it!!! 🤩🤩🤩 Previously, I have been using "git clone ..." to clone the repository without specifying which branch to use. After seeing your reply today, I re-cloned the 3 repositories needed for compilation using "git clone -b master ...", and successfully compiled the complete version of wkhtmltopdf! However, it was not automatically packaged in deb format, and there was an error message in the terminal as shown in the following codes. But I have successfully installed it "manually" by placing the binary files in /usr/local/bin/, /usr/local/include/, etc. Now when I run wkhtmltopdf in the terminal, it is already "with patched qt"! 🥳🥳🥳 Thank you again for your help! (It would be even better if the binary files could be packaged into a deb package😊😊😊)

install -m 755 -p "../../bin/wkhtmltoimage" "/tgt/wk
strip "/tgt/wkhtmltox/bin/wkhtmltoimage"
make[1]: Leaving directory '/tgt/app/src/image'
Unable to find image 'wkhtmltopdf/fpm:1.10.2-2022112
1.10.2-20221124: Pulling from wkhtmltopdf/fpm
docker: no matching manifest for linux/s390x in the 
See 'docker run --help'.
docker run --rm -v/opt/packaging/targets:/tgt -w/tgtpdf/fpm:1.10.2-20221124 -a s390x -f -s dir -C jammy-on "0.12.7" --iteration "0.20230321.31.dev.024b2b2.jption "convert HTML to PDF and various image formats3" --vendor "wkhtmltopdf" --maintainer "Ashish Kulka"https://wkhtmltopdf.org/" --prefix "/usr/local" --ctificates" --depends "fontconfig" --depends "libc6" s "libjpeg-turbo8" --depends "libpng16-16" --depends --depends "libx11-6" --depends "libxcb1" --depends " --depends "xfonts-75dpi" --depends "xfonts-base" -mpression xz --provides wkhtmltopdf --conflicts wkhtdeb-shlibs "libwkhtmltox 0 wkhtmltox (>= 0.12.0)"
command failed: exit code 125
ashkulz commented 1 year ago

@Winnie0408 you should probably use the command from df03e8f2eed9dea7670938502686cf84cf75571c to build that image locally:

docker buildx build --platform linux/s390x -t wkhtmltopdf/fpm:1.10.2-20221124 -f docker/Dockerfile.fpm docker/
Winnie0408 commented 1 year ago

@Winnie0408 you should probably use the command from df03e8f2eed9dea7670938502686cf84cf75571c to build that image locally:

docker buildx build --platform linux/s390x -t wkhtmltopdf/fpm:1.10.2-20221124 -f docker/Dockerfile.fpm docker/

@ashkulz Thank you! I have successfully obtained the deb package! You did me a big favor! Thank you again!

ashkulz commented 1 year ago

Awesome, @Winnie0408! Would appreciate a PR with your changes to build.yml :+1: