Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Qt6 #775

Closed
yukawa opened this issue Jul 21, 2023 · 1 comment
Closed

Switch to Qt6 #775

yukawa opened this issue Jul 21, 2023 · 1 comment

Comments

@yukawa
Copy link
Collaborator

yukawa commented Jul 21, 2023

Description

As we did in #327, it's time to consider switching from Qt5 to Qt6. Actual timeline is still TBD though.

References

Version or commit-id

0cf3e92

Environment

  • OS: All desktop platforms
hiroyuki-komatsu pushed a commit that referenced this issue Jul 22, 2023
<QTextCodec> is no longer used there thus can be removed.

Furthermore Qt6 even doesn't have it (#775).

#codehealth

PiperOrigin-RevId: 549885061
hiroyuki-komatsu pushed a commit that referenced this issue Jul 22, 2023
QTextStream::setCodec() needs to be replaced with
QTextStream::setEncoding() in Qt6.

This is a preparation to switch to Qt6 (#775).

PiperOrigin-RevId: 549885239
hiroyuki-komatsu pushed a commit that referenced this issue Jul 22, 2023
It turns out that '-skip' option is supported only for the top-level
build thus does not work for submodules such as qtbase.  Moreover
having such '-skip' options results in a hard failure in Qt6.

Also '-nomake tools' is also turned out to have no effect.  Having
this results in a warning message for Qt6.

#codehealth

PiperOrigin-RevId: 550116309
hiroyuki-komatsu pushed a commit that referenced this issue Jul 26, 2023
Without this option '__cplusplus' preprocessor macro remains to be
199711L even when '/std:c++20' is specified.

  https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus

To enable libraries to take full advantage of C++20, let's also specify
this option.

Qt6 also requires this compiler option (#775).

PiperOrigin-RevId: 550135462
hiroyuki-komatsu pushed a commit that referenced this issue Jul 26, 2023
As this is a newly introduced file, let's simply follow PEP 8.

#codehealth

PiperOrigin-RevId: 550741071
hiroyuki-komatsu pushed a commit that referenced this issue Jul 26, 2023
This is a mechanical change that moves the responsibility of extracting
Qt source code from update_deps.py to build_mozc.py.  There must be no
observable change in the final artifacts.

While there are several motivations, the biggest one is that every time
we update update_deps.py, GitHub Action cache will be invalidated in our
current configuration. By moving logic that is likely to change in the
near future to build_qt.py makes unnecessary cache invalidations less
likely to happen.

#codehealth

PiperOrigin-RevId: 550777257
hiroyuki-komatsu pushed a commit that referenced this issue Jul 27, 2023
As a preparation for Qt6 migration (#775), this commit aims to remove
the configure option `-mp` with an assumption that jom.exe is always
available when building Qt in Windows.

#codehealth

PiperOrigin-RevId: 551398431
hiroyuki-komatsu pushed a commit that referenced this issue Jul 29, 2023
As a preparation for Qt6 migration (#775), this commit aims to clean up
build command handling in build_qt.py.

This is a mechanical cleanup.  There must be no change in the artifacts.

#codehealth

PiperOrigin-RevId: 551468250
hiroyuki-komatsu pushed a commit that referenced this issue Jul 29, 2023
With this commit we can start using build_qt.py to build not only Qt5
but also Qt6 in macOS and Windows.

So far tested only with the following versions.

 * qtbase-everywhere-opensource-src-5.15.10.tar.xz
 * qtbase-everywhere-src-6.5.2.tar.xz

PiperOrigin-RevId: 551584494
hiroyuki-komatsu pushed a commit that referenced this issue Jul 29, 2023
While we are working on the transition to Qt6 (#775), it would be
useful if update_deps.py can fetch both Qt5 and Qt6 source archive
files for a while.

PiperOrigin-RevId: 551725304
hiroyuki-komatsu pushed a commit that referenced this issue Jul 31, 2023
This introduces a utility function 'exec_command' to abstract out
dryrun handling in 'build_qt.py` a preparation for Qt6 migration (#775).

This is mechanical cleanup. There must be no behavior change.

#codehealth

PiperOrigin-RevId: 552271025
hiroyuki-komatsu pushed a commit that referenced this issue Jul 31, 2023
This is a mechanical cleanup of installer.gyp.

As Qt DLL locations are predictable, WXS files can locate required Qt
DLL paths only from Qt root dir.  There is no need to specify all the
DLL paths to candle.exe.

There must be no behavior change.

#codehealth

PiperOrigin-RevId: 552278522
hiroyuki-komatsu pushed a commit that referenced this issue Jul 31, 2023
This is a preparation for Qt6 migration (#775).

In order to make *.wxs files compatible with both Qt5 and Qt6, it'd make more sense to not have Qt version '5' in MSI component names.  Let's simply drop '5' there, e.g. from 'Qt5CoreDll' to 'QtCoreDll'.

There must be no behavior change in this commit.

PiperOrigin-RevId: 552284979
hiroyuki-komatsu pushed a commit that referenced this issue Jul 31, 2023
This is a preparation for Qt6 migration (#775).

As Qt DLL names repeatedly appear in *.wxs, it'd make more sense to
define them as constants so that we can easily switch them between
Qt5 and Qt6.

This is still a mechanical cleanup. There must be no behavior change.

#codehealth

PiperOrigin-RevId: 552291853
hiroyuki-komatsu pushed a commit that referenced this issue Jul 31, 2023
This is a preparation of Qt6 migration (#775).

With this commit, Qt6 debug DLLs will be correctly installed even when
configured with '-debug-and-release' for Windows.

Previously only release DLLs were installed, which resulted in a build
failure when trying to build Mozc with '-c Debug'.

PiperOrigin-RevId: 552338014
hiroyuki-komatsu pushed a commit that referenced this issue Aug 2, 2023
As a preparation of Qt6 migration, this commit introduces 'qt_ver' GYP
variable, which is still set to '5' by default into GYP builds.

This is a mechanical cleanup, and there must be no behavior change.
Also there must be no impact on Bazel builds.

#codehealth

PiperOrigin-RevId: 552690457
hiroyuki-komatsu pushed a commit that referenced this issue Aug 2, 2023
With this commit 'build_mozc.py' starts passing 'qt_ver=6' to GYP as
needed.

For Windows and macOS, 'qt_ver=6' will be set when the Qt binaries
specified with '--qtdir' looks to be Qt6.

For Linux, 'qt_ver=6' will be set when the following command returns
exit code 0.

 pkg-config --exists Qt6Core Qt6Gui Qt6Widgets

There must be no behavior change in Bazel build.

PiperOrigin-RevId: 552727349
hiroyuki-komatsu pushed a commit that referenced this issue Aug 2, 2023
This follows up to bb52df2.

With this commit we use Ubuntu 22.04 as the reference build environment
for Mozc for Linux and Android.

This commit also updates NDK version from 'r21b' to 'r25c' as otherwise
Android build fails.

Also the default Clang version in Ubuntu 22.04 is '14' thus we do not
need to explicitly set them in 'CC' and 'CXX'.

This is also a preparation of Qt6 migration (#775), as Ubuntu 20.04 does
not have Qt6 in their official repository.

Closes #763.

PiperOrigin-RevId: 552728127
hiroyuki-komatsu pushed a commit that referenced this issue Aug 2, 2023
*** Reason for rollback ***

It turns out that there remain many usages of __FILE__ macros in both
Qt and other 3rd party libraries.  Hiding only PDB paths does not make
much sense.

With that, I'm basically giving up trying to not embed our directory
structure, at least for Windows.

Let's drop our local patches to simplify our migration to Qt6 (#775).

#codehealth

*** Original change description ***

Do not embed build paths in Qt DLL for Windows

With this CL build paths will not be embedded into Qt DLL files.

***

PiperOrigin-RevId: 553076521
hiroyuki-komatsu pushed a commit that referenced this issue Aug 4, 2023
This is a preparation of Qt6 migration (#775).

When building Qt6 'jom.exe' is not necessary. Qt6 uses 'cmake' instead.

PiperOrigin-RevId: 553149994
hiroyuki-komatsu pushed a commit that referenced this issue Aug 4, 2023
With this commit, Windows build starts using Qt6 by default.

You can still use Qt5 by explicitly specifying Qt5 source archive with
'--qt_archive_path' option in 'build_qt.py'.  You can also find Qt5
build status in GitHub Actions.

PiperOrigin-RevId: 553162054
shitamo pushed a commit to shitamo/mozc that referenced this issue Aug 5, 2023
This is a preparation of Qt6 migration (google#775).

When building Qt6 'jom.exe' is not necessary. Qt6 uses 'cmake' instead.

PiperOrigin-RevId: 553149994
hiroyuki-komatsu pushed a commit that referenced this issue Aug 7, 2023
Unlike Qt 5.15.9, which uses '/std:latest' that has ABI compatibility
risk when specifying '-c++std c++2a' as seen in #769, Qt 6 simply uses
'/std:c++20' when '-c++std c++20' is set.

Let's enable C++20 only for Qt6 as part of C++ migration (#769) and Qt6
migration (#775). This should allow Qt6 code to rely on optional code
optimizations that are available only in C++20 without introducing ABI
compatibility risk.

There must be no user observable behavior change anyway.

PiperOrigin-RevId: 554343071
hiroyuki-komatsu pushed a commit that referenced this issue Aug 9, 2023
This is a preparation of Qt6 migration in mac (#775).

With this commit, Ninja 1.11.0 executable will be downloaded into

  src/third_party/ninja

not only for Windows but also for macOS, as Qt6 officially supports only
ninja as the cmake generator.

PiperOrigin-RevId: 554852739
hiroyuki-komatsu pushed a commit that referenced this issue Aug 12, 2023
This commit updates build_qt.py so that we can stop relying on
shell=True in 'exec_command' as suggested in the API doc [1].

This commit is basically about how to build Qt in Windows.
There must be no difference in the final artifacts.

This is a preparation of Qt6 migration in mac (#775).

#codehealth

 [1]: https://docs.python.org/3/library/subprocess.html#security-considerations

PiperOrigin-RevId: 555996264
hiroyuki-komatsu pushed a commit that referenced this issue Aug 12, 2023
Then we no longer need to maintain 'run_or_dir' in build_qt.py.

This is a preparation of Qt6 migration in mac (#775).

#codehealth

PiperOrigin-RevId: 556024285
hiroyuki-komatsu pushed a commit that referenced this issue Aug 12, 2023
With this commit build_qt.py starts trying to add ninja executable into
PATH environment variable when building Qt6 with cmake/ninja.

By default src/third_party/ninja [1] will be used but you can customize
it with --ninja_dir option.

This is a preparation of Qt6 migration in mac (#775).

 [1]: 8ffb915

PiperOrigin-RevId: 556053894
hiroyuki-komatsu pushed a commit that referenced this issue Aug 12, 2023
With this commit we can continuously verifies that build_qt.py works
fine with Qt6 in macOS (#775).

PiperOrigin-RevId: 556069080
hiroyuki-komatsu pushed a commit that referenced this issue Aug 13, 2023
This is a follow up to 155ad0e.

There was a bug that GYP variable `qt_ver=6' can never be set in Linux.
With this commit `qt_ver=6' will be correctly set for Qt6.

PiperOrigin-RevId: 556545280
hiroyuki-komatsu pushed a commit that referenced this issue Aug 15, 2023
Qt Tools like moc/rcc/uic are moved from 'bin' to 'libexec' in Qt6. This
commit introduces 'qt_tool_dir.gypi' to take care of this difference.

There must be no impact on the Qt5 builds.

#codehealth

PiperOrigin-RevId: 556554516
hiroyuki-komatsu pushed a commit that referenced this issue Aug 15, 2023
This is a follow up to 155ad0e.

As Qt6 puts 'moc' executable under $QTDIR/libexec/ instead of
$QTDIR/bin/, 'GetQtMajorVersion' in build_qt.py also needs to search
there as a fallback. Otherwise, 'qt_ver' won't be set for Qt6 in mac.

PiperOrigin-RevId: 556632445
hiroyuki-komatsu pushed a commit that referenced this issue Aug 18, 2023
As a preparation to make 'copy_qt_frameworks_mac.py' compatible with
Qt6 (#775), this commit factors it out without changing the behavior.

Note that Bazel build does not use copy_qt_frameworks_mac.py. Thus there
must be no behavior change in Bazel build.

#codehealth

PiperOrigin-RevId: 556998481
hiroyuki-komatsu pushed a commit that referenced this issue Aug 18, 2023
With this commit 'build_and_sign_pkg_mac.py' becomes compatible with not
only Qt5 but also Qt6 (#775).

Note that Bazel build does not use build_and_sign_pkg_mac.py. Thus there
must be no behavior change in Bazel build.

#codehealth

PiperOrigin-RevId: 557035997
hiroyuki-komatsu pushed a commit that referenced this issue Aug 18, 2023
As of Qt 6.5.2, only macOS 11 and later releases are supported [1].
To make Qt6 migration happen (#775), this commit updates the macOS
deployment target to 'macOS 11'.

 [1]: https://doc.qt.io/qt-6/macos.html#supported-versions

Closes #786.

PiperOrigin-RevId: 557172153
hiroyuki-komatsu pushed a commit that referenced this issue Aug 18, 2023
Version names used for mac framework differ between Qt5 and Qt6 as
follows.

 Qt5: QtCore.framework/Versions/5/QtCore
 Qt6: QtCore.framework/Versions/A/QtCore

This commit takes care of such a difference so that
copy_qt_frameworks_mac.py can work both of them.

This is a preparation of Qt6 migration for mac (#775).

There must be no impact on existing Qt5 build.

Bazel build should have no impact as copy_qt_frameworks_mac.py is used
only for GYP build.

#codehealth

PiperOrigin-RevId: 557174117
hiroyuki-komatsu pushed a commit that referenced this issue Aug 18, 2023
With this commit, Linux build starts linking to Qt6.

Here are things needed to use Qt6 in Ubuntu 22.04.

 * Qt6 uses 'libexec' rather than 'bin' to host tools like 'uic'.
 * Qt6 requires 'libgl-dev' in Ubuntu 22.04.
 * Ubuntu 22.04 uses Qt 6.2.4, where you cannot use pkg-config for Qt6
   due to QTBUG-86080 [1]. This commit works around it by injecting
   files like Qt6Core.pc files with 'PKG_CONFIG_PATH' environment
   variable.

 [1]: https://bugreports.qt.io/browse/QTBUG-86080

PiperOrigin-RevId: 558016590
hiroyuki-komatsu pushed a commit that referenced this issue Aug 26, 2023
With this commit, macOS Bazel build starts linking to Qt6.

Here are things needed to use Qt6:

 * Qt6 uses 'libexec' rather than 'bin' to host tools like 'uic'.
 * Qt6 uses 'Frameworks/QtCore.framework/Versions/A' rather than
   'Frameworks/QtCore.framework/Versions/5'.

PiperOrigin-RevId: 558715583
@yukawa
Copy link
Collaborator Author

yukawa commented Aug 26, 2023

All the desktop builds (Windows, Linux, and macOS) have successfully migrated from Qt5 to Qt6.

Closing as complete.

@yukawa yukawa closed this as completed Aug 26, 2023
hiroyuki-komatsu pushed a commit that referenced this issue Aug 31, 2023
This is a cleanup after #775.

As Qt6 migration has been successfully completed, let's simplify our
Windows CI by removing build configurations with Qt5.

By doing this, we can start further cleaning up other scripts such as
'update_deps.py' and 'build_qt.py'.

#codehealth

PiperOrigin-RevId: 561083677
hiroyuki-komatsu pushed a commit that referenced this issue Aug 31, 2023
This is a cleanup after #775.

As Qt6 migration has been successfully completed, we no longer need to
download Qt5 source archive and jom.exe.

#codehealth

PiperOrigin-RevId: 561551977
hiroyuki-komatsu pushed a commit that referenced this issue Aug 31, 2023
This is a cleanup after #775.

As Qt6 migration has been successfully completed, 'build_qt.py' no
longer needs to support Qt5.  Let's simplify it.

#codehealth

PiperOrigin-RevId: 561554932
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
This is a follow up to 155ad0e.

There was a bug that GYP variable `qt_ver=6' can never be set in Linux.
With this commit `qt_ver=6' will be correctly set for Qt6.

PiperOrigin-RevId: 556545280
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
Qt Tools like moc/rcc/uic are moved from 'bin' to 'libexec' in Qt6. This
commit introduces 'qt_tool_dir.gypi' to take care of this difference.

There must be no impact on the Qt5 builds.

#codehealth

PiperOrigin-RevId: 556554516
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
This is a follow up to 155ad0e.

As Qt6 puts 'moc' executable under $QTDIR/libexec/ instead of
$QTDIR/bin/, 'GetQtMajorVersion' in build_qt.py also needs to search
there as a fallback. Otherwise, 'qt_ver' won't be set for Qt6 in mac.

PiperOrigin-RevId: 556632445
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
As a preparation to make 'copy_qt_frameworks_mac.py' compatible with
Qt6 (google#775), this commit factors it out without changing the behavior.

Note that Bazel build does not use copy_qt_frameworks_mac.py. Thus there
must be no behavior change in Bazel build.

#codehealth

PiperOrigin-RevId: 556998481
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
With this commit 'build_and_sign_pkg_mac.py' becomes compatible with not
only Qt5 but also Qt6 (google#775).

Note that Bazel build does not use build_and_sign_pkg_mac.py. Thus there
must be no behavior change in Bazel build.

#codehealth

PiperOrigin-RevId: 557035997
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
As of Qt 6.5.2, only macOS 11 and later releases are supported [1].
To make Qt6 migration happen (google#775), this commit updates the macOS
deployment target to 'macOS 11'.

 [1]: https://doc.qt.io/qt-6/macos.html#supported-versions

Closes google#786.

PiperOrigin-RevId: 557172153
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
Version names used for mac framework differ between Qt5 and Qt6 as
follows.

 Qt5: QtCore.framework/Versions/5/QtCore
 Qt6: QtCore.framework/Versions/A/QtCore

This commit takes care of such a difference so that
copy_qt_frameworks_mac.py can work both of them.

This is a preparation of Qt6 migration for mac (google#775).

There must be no impact on existing Qt5 build.

Bazel build should have no impact as copy_qt_frameworks_mac.py is used
only for GYP build.

#codehealth

PiperOrigin-RevId: 557174117
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
With this commit, Linux build starts linking to Qt6.

Here are things needed to use Qt6 in Ubuntu 22.04.

 * Qt6 uses 'libexec' rather than 'bin' to host tools like 'uic'.
 * Qt6 requires 'libgl-dev' in Ubuntu 22.04.
 * Ubuntu 22.04 uses Qt 6.2.4, where you cannot use pkg-config for Qt6
   due to QTBUG-86080 [1]. This commit works around it by injecting
   files like Qt6Core.pc files with 'PKG_CONFIG_PATH' environment
   variable.

 [1]: https://bugreports.qt.io/browse/QTBUG-86080

PiperOrigin-RevId: 558016590
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
With this commit, macOS Bazel build starts linking to Qt6.

Here are things needed to use Qt6:

 * Qt6 uses 'libexec' rather than 'bin' to host tools like 'uic'.
 * Qt6 uses 'Frameworks/QtCore.framework/Versions/A' rather than
   'Frameworks/QtCore.framework/Versions/5'.

PiperOrigin-RevId: 558715583
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
This is a cleanup after google#775.

As Qt6 migration has been successfully completed, let's simplify our
Windows CI by removing build configurations with Qt5.

By doing this, we can start further cleaning up other scripts such as
'update_deps.py' and 'build_qt.py'.

#codehealth

PiperOrigin-RevId: 561083677
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
This is a cleanup after google#775.

As Qt6 migration has been successfully completed, we no longer need to
download Qt5 source archive and jom.exe.

#codehealth

PiperOrigin-RevId: 561551977
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
This is a cleanup after google#775.

As Qt6 migration has been successfully completed, 'build_qt.py' no
longer needs to support Qt5.  Let's simplify it.

#codehealth

PiperOrigin-RevId: 561554932
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant