ScanTailor-Advanced / scantailor-advanced

ScanTailor Advanced is the version that merges the features of the ScanTailor Featured and ScanTailor Enhanced versions, brings new ones and fixes.
GNU General Public License v3.0
204 stars 8 forks source link

Qt6 port, warning suppression #7

Closed kunzjacq closed 2 years ago

kunzjacq commented 2 years ago

In addition to changes required to port to Qt6, warnings related to boost bind and to deprecated types in Tiff{Reader,Writer}.cpp were eliminated. Note: this branch only compiles against Qt6, not Qt5. The code is probably 99% compatible with Qt5, but CMakeFiles only look for Qt6.

vigri commented 2 years ago

Thank you very much for the PR.

Do we need to update some information in scantailor-libs-build too? Or is it enough to point out that Qt6 is now the minimum version?

If we ditch Qt5 we will loose support for Windows XP, but this should tolerable theese days ;-) Is there anything against the plan to only support Qt6 from now on?

FriedrichFroebel commented 2 years ago

Ubuntu 20.04 is still shipping with Qt 5 in the official packages only. Dropping Qt 5 support completely will make building on Ubuntu 20.04 more cumbersome, which holds true for GitHub Actions as well where ubuntu-latest points to Ubuntu 20.04.

kunzjacq commented 2 years ago

I committed a new version that works both for Qt5 qnd Qt6. However it uses versionless Qt cmake commands ( https://doc.qt.io/qt-6/cmake-qt5-and-qt6-compatibility.html#versionless-commands) which are only available stqrting with Qt 5.15. Is it ok with ubuntu 20.04? Tested with Qt 5.15.2 and Qt 6.2.3, Ubuntu 21.10 and Windows 11, x86-64.

Le mer. 16 févr. 2022 à 15:20, FriedrichFroebel @.***> a écrit :

Ubuntu 20.04 is still shipping with Qt 5 in the official packages only. Dropping Qt 5 support completely will make building on Ubuntu 20.04 more cumbersome, which holds true for GitHub Actions as well where ubuntu-latest points to Ubuntu 20.04.

— Reply to this email directly, view it on GitHub https://github.com/vigri/scantailor-advanced/pull/7#issuecomment-1041540298, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKXMQCS4CY74MAYYGTXE63U3OXDXANCNFSM5OO5DVNA . You are receiving this because you authored the thread.Message ID: @.***>

FriedrichFroebel commented 2 years ago

qmake --version does report Using Qt version 5.12.8 in /usr/lib/x86_64-linux-gnu, see https://packages.ubuntu.com/search?suite=focal&searchon=names&keywords=qmake. Qt 5.15.2 is currently available starting with Ubuntu 21.04 only: https://packages.ubuntu.com/search?suite=hirsute&searchon=names&keywords=qmake

kunzjacq commented 2 years ago

New commit, works with 5.9, 5.15 and 6.2.3 under linux. Qt 5.15 and 6.2.3 work under windows / MinGW, I could not test older versions in that case.

yb85 commented 2 years ago

Installed fine on OS X (x64 bigsur) with homebrew qt6 package

kunzjacq commented 2 years ago

Indeed. Corrected, there were two more occurrences of this.

vigri commented 2 years ago

Perfect. Thank you.

So if you guys are okay with the PR i'll merge it to master.

Just to be sure: The new minimum version is now Qt 5.9 (instead of Qt 5.6) right?

kunzjacq commented 2 years ago

I don't know if it works with Qt < 5.9, since I was only able to test with Qt 5.9 (and 5.15 etc). It may very well compile with Qt 5.6.

vigri commented 2 years ago

@kunzjacq I've tried to compile the libs with qt6. While the libs are compiling with qt5, I get an error with qt6:

cmake

C:\Users\x\Downloads\scantailor_64\libs\scantailor-libs-build-master\build>cmake.exe -G "NMake Makefiles JOM" -D CMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is MSVC 19.16.27045.0
-- The CXX compiler identification is MSVC 19.16.27045.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/x/Downloads/scantailor_64/libs/scantailor-libs-build-master/build

jom

Configuring 'qtbase'
-- Check for feature set changes
-- Building architecture extraction project with the following CMake arguments:
    -DCMAKE_OBJCOPY=C:/Strawberry/c/bin/objcopy.exe
    -DCMAKE_C_STANDARD=11
    -DCMAKE_CXX_STANDARD=17
    -DCMAKE_MODULE_PATH:STRING=C:/Users/x/Downloads/scantailor_64/libs/qt-everywhere-src-6.2.3/qtbase/cmake/platforms
-- Extracting architecture info from C:/Users/x/Downloads/scantailor_64/libs/qt-everywhere-src-6.2.3/build/qtbase/config.tests/arch/architecture_test.exe.
-- CMAKE_VERSION: "3.22.2"
-- CMAKE_HOST_SYSTEM: "Windows-10.0.19044"
-- CMAKE_HOST_SYSTEM_NAME: "Windows"
-- CMAKE_HOST_SYSTEM_VERSION: "10.0.19044"
-- CMAKE_HOST_SYSTEM_PROCESSOR: "AMD64"
-- CMAKE_SYSTEM: "Windows"
-- CMAKE_SYSTEM_NAME: "Windows"
-- CMAKE_SYSTEM_VERSION: "10.0.19044"
-- CMAKE_SYSTEM_PROCESSOR: "AMD64"
-- CMAKE_CROSSCOMPILING: "FALSE"
-- CMAKE_C_COMPILER: "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe" (19.16.27045.0)
-- CMAKE_CXX_COMPILER: "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe" (19.16.27045.0)
-- MSVC_VERSION: "1916"
-- MSVC_TOOLSET_VERSION: "141"
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found suitable version "1.2.11", minimum required is "1.0.8")
-- Could NOT find WrapZLIB (missing: WrapZLIB_FOUND) (Required is at least version "1.0.8")
-- Could NOT find ZSTD: Found unsuitable version "", but required is at least "1.3" (found ZSTD_LIBRARY-NOTFOUND)
-- Could NOT find WrapDBus1 (missing: DBus1_LIBRARY DBus1_INCLUDE_DIR WrapDBus1_FOUND) (Required is at least version "1.2")
CMake Error at qtbase/cmake/QtBuildInformation.cmake:388 (message):
  Feature "system_zlib": Forcing to "ON" breaks its condition:

      WrapZLIB_FOUND

  Condition values dump:

      WrapZLIB_FOUND = "FALSE"

Call Stack (most recent call first):
  qtbase/cmake/QtFeature.cmake:281 (qt_configure_add_report_error)
  qtbase/cmake/QtFeature.cmake:403 (qt_feature_check_and_save_internal_value)
  qtbase/cmake/QtFeature.cmake:606 (qt_evaluate_feature)
  qtbase/cmake/QtBaseGlobalTargets.cmake:108 (qt_feature_module_end)
  qtbase/CMakeLists.txt:125 (include)

image

Before merging your PR: How to update the "building tutorial" (https://github.com/vigri/scantailor-libs-build) to fix this error?

kunzjacq commented 2 years ago

I managed to reproduce this error, which indicates that Qt does not find the external zlib. This can be overcome by compiling zlib through its own cmakefile, installing it in its own directory added to CMAKE_INSTALL_PREFIX, or in Qt/, which is already in CMAKE_INSTALL_PREFIX. I don't elaborate because other problems arise after that. First, Qt 6 cannot be built with jom: the use of Ninja is mandatory. Therefore even when the error about zlib is avoided, Qt build breaks aftewards. This in turn can be overcome too by using a standard build command (cmake --build qt-everywhere-...) instead of invoking jom directly. However after that there are other problems (related to Qt-dbus) which I was not able to diagnose (yet).

Long story short, I believe that scantailor-libs-build will need quite a few changes before working with Qt 6 (with MSVC, but probably also with MinGW). To build scantailor under Windows with MinGW, I followed a competely different route: I used the version of Qt 6.2.3 already built with MinGW, plus Strawberry perl that provides tiff, libpng, lijpeg zlib also compiled with a recent MinGW, and a standalone MinGW build of Boost. This works from Qt Creator or the command line, provided Boost_ROOT points to Boost and Strawberry_perl is in PATH. I think it can work without too much difficulty with MSVC with the added MSVC compilation stepof tiff and other libs.

As a first step I can write the steps to build scantailor with a precompiled MinGW build of Qt, without scantailor-libs-build.

Message ID: @.***>

vigri commented 2 years ago

As a first step I can write the steps to build scantailor with a precompiled MinGW build of Qt, without scantailor-libs-build.

That would be awesome. So in the first place we would have at least a separate "how to" for Qt6 and on the other hand the existing "tutorial" for folks using Qt5.

Could you then submit the PR to https://github.com/vigri/scantailor-libs-build ?

kunzjacq commented 2 years ago

Could you then submit the PR to https://github.com/vigri/scantailor-libs-build ?

done.

kunzjacq commented 2 years ago

Are there remaining issues to be solved? The Qt6 build instructions that were added to scantailor-libs-build only work with the modifications of this PR.

vigri commented 2 years ago

Are there remaining issues to be solved? The Qt6 build instructions that were added to scantailor-libs-build only work with the modifications of this PR.

shame on me. Sorry @kunzjacq I totally missed your answer.

I'll make a pre-release for the users next week so that they can check if everything is fine.