gyunaev / kchmviewer

kchmviewer is a CHM (Winhelp) files viewer written on Qt/KDE. It can be build as a standalone Qt-based application, or a KDE application. The main point of kchmviewer is compatibility with non-English chm files, including most international charsets.
http://www.ulduzsoft.com/linux/kchmviewer/
GNU General Public License v3.0
70 stars 18 forks source link

[QWebEngine] qmake fails with Qt 5.6+ #8

Closed u-235 closed 3 years ago

u-235 commented 3 years ago

[QWebEngine] qmake fails with Qt 5.15

Qmake fails when building from RELEASE_8_0 with Qt 5.15.

Environment

Run qmake

base$ git clone https://github.com/gyunaev/kchmviewer.git
base$ mkdir build
base$ cd build
base/build$ qmake -r ../kchmviewer

Qmake output:

Reading $base$/kchmviewer/lib/lib.pro [$base$/build/lib]
 Reading $base$/kchmviewer/lib/libebook/libebook.pro [$base$/build/lib/libebook]
Reading $base$/kchmviewer/src/src.pro [$base$/build/src]
Project ERROR: Unknown module(s) in QT: webkit webkitwidgets
gyunaev commented 3 years ago

Gonna leave this open until someone bothers install Ubuntu and fix it.

gyunaev commented 3 years ago

You also submitted two different build errors in the same environment. Is this one still current? Did you invoke the right qmake?

base/build$ qmake -v output?

u-235 commented 3 years ago

base/build$ qmake -v output?

QMake version 3.1
Using Qt version 5.15.2 in /tools/sdk/Qt/5.15.2/gcc/lib
gyunaev commented 3 years ago

You also submitted two different build errors (and now a usage error, so it definitely builds) in the same environment. Is it being built or not?

u-235 commented 3 years ago

It is build after meaningless changes in src/src.pro.

diff --git a/src/src.pro b/src/src.pro
index f502259..6047d60 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -40,7 +40,6 @@ SOURCES += config.cpp \
     textencodings.cpp \
     treeitem_toc.cpp \
     treeitem_index.cpp
-LIBS += -lchm -lzip
 TARGET = ../bin/kchmviewer
 CONFIG += threads \
     warn_on \
@@ -60,11 +59,9 @@ FORMS += tab_bookmarks.ui \
     toolbareditor.ui
 RESOURCES += resources/images.qrc

-QT += webkit \
-   xml \
+QT += xml \
     network \
     widgets \
-    webkitwidgets \
     printsupport

 linux-g++*:{
@@ -112,6 +109,8 @@ unix:!macx: {
     POST_TARGETDEPS += ../lib/libebook/libebook.a
 }

+LIBS += -lchm -lzip
+
 greaterThan(QT_MAJOR_VERSION, 4) {
     # Qt 5
     greaterThan(QT_MINOR_VERSION, 5) {
gyunaev commented 3 years ago

Can you please post the gcc linker command before the changes and after?

u-235 commented 3 years ago

Yes, of course. But I can't do it until monday.

gyunaev commented 3 years ago

No worries, we aren't in hurry. Thank you for your help.

u-235 commented 3 years ago

Patch to fix qmake error.

diff --git a/src/src.pro b/src/src.pro
index f502259..000a7e4 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -60,11 +60,9 @@ FORMS += tab_bookmarks.ui \
     toolbareditor.ui
 RESOURCES += resources/images.qrc

-QT += webkit \
-   xml \
+QT += xml \
     network \
     widgets \
-    webkitwidgets \
     printsupport

 linux-g++*:{

Patch to fix linker errors.

diff --git a/src/src0.pro b/src/src.pro
index 000a7e4..6047d60 100644
--- a/src/src0.pro
+++ b/src/src.pro
@@ -40,7 +40,6 @@ SOURCES += config.cpp \
     textencodings.cpp \
     treeitem_toc.cpp \
     treeitem_index.cpp
-LIBS += -lchm -lzip
 TARGET = ../bin/kchmviewer
 CONFIG += threads \
     warn_on \
@@ -110,6 +109,8 @@ unix:!macx: {
     POST_TARGETDEPS += ../lib/libebook/libebook.a
 }

+LIBS += -lchm -lzip
+
 greaterThan(QT_MAJOR_VERSION, 4) {
     # Qt 5
     greaterThan(QT_MINOR_VERSION, 5) {

Linker command line before and after the second patch.

# before
g++ -Wl,-O1 -Wl,-rpath,/tools/sdk/Qt/5.15.2/gcc/lib -Wl,-rpath-link,/tools/sdk/Qt/5.15.2/gcc/lib -o ../bin/kchmviewer config.o dialog_chooseurlfromlist.o dialog_setup.o kde-qt.o main.o mainwindow.o recentfiles.o settings.o tab_bookmarks.o tab_contents.o tab_index.o tab_search.o viewwindowmgr.o navigationpanel.o checknewversion.o toolbarmanager.o toolbareditor.o textencodings.o treeitem_toc.o treeitem_index.o dbus_interface.o viewwindow_webengine.o dataprovider_qwebengine.o qrc_images.o moc_dialog_chooseurlfromlist.o moc_dialog_setup.o moc_mainwindow.o moc_recentfiles.o moc_tab_bookmarks.o moc_tab_contents.o moc_tab_index.o moc_tab_search.o moc_viewwindowmgr.o moc_navigationpanel.o moc_checknewversion.o moc_toolbarmanager.o moc_toolbareditor.o moc_dbus_interface.o moc_viewwindow_webengine.o   -lchm -lzip -lX11 ../lib/libebook/libebook.a libQt5WebEngineWidgets.so libQt5PrintSupport.so libQt5Widgets.so libQt5WebEngine.so libQt5WebEngineCore.so libQt5Quick.so libQt5Gui.so libQt5Xml.so libQt5QmlModels.so libQt5WebChannel.so libQt5Qml.so libQt5Network.so libQt5DBus.so libQt5Positioning.so libQt5Core.so -lGL -lpthread
# after
g++ -Wl,-O1 -Wl,-rpath,/tools/sdk/Qt/5.15.2/gcc/lib -Wl,-rpath-link,/tools/sdk/Qt/5.15.2/gcc/lib -o ../bin/kchmviewer config.o dialog_chooseurlfromlist.o dialog_setup.o kde-qt.o main.o mainwindow.o recentfiles.o settings.o tab_bookmarks.o tab_contents.o tab_index.o tab_search.o viewwindowmgr.o navigationpanel.o checknewversion.o toolbarmanager.o toolbareditor.o textencodings.o treeitem_toc.o treeitem_index.o dbus_interface.o viewwindow_webengine.o dataprovider_qwebengine.o qrc_images.o moc_dialog_chooseurlfromlist.o moc_dialog_setup.o moc_mainwindow.o moc_recentfiles.o moc_tab_bookmarks.o moc_tab_contents.o moc_tab_index.o moc_tab_search.o moc_viewwindowmgr.o moc_navigationpanel.o moc_checknewversion.o moc_toolbarmanager.o moc_toolbareditor.o moc_dbus_interface.o moc_viewwindow_webengine.o   -lX11 ../lib/libebook/libebook.a -lchm -lzip libQt5WebEngineWidgets.so libQt5PrintSupport.so libQt5Widgets.so libQt5WebEngine.so libQt5WebEngineCore.so libQt5Quick.so libQt5Gui.so libQt5Xml.so libQt5QmlModels.so libQt5WebChannel.so libQt5Qml.so libQt5Network.so libQt5DBus.so libQt5Positioning.so libQt5Core.so -lGL -lpthread
gyunaev commented 3 years ago

Fixed in 9ac73e7..e3b09ed

Indeed it does seem to make a difference. Thank you for reporting this and for pushing through. Newer linkers (gcc 7+) do not need this, because they do multiple passes. But for older gcc this seem to be needed.