# Qt6 tracking thread

**URL:** <https://discuss.avogadro.cc/t/qt6-tracking-thread/5592>\
**Category:** Development\
**Created:** [September 16, 2024, 8:21pm UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592 "2024-09-16T20:21:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![matterhorn103](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/matterhorn103/32/1751_2.png) [@matterhorn103](https://discuss.avogadro.cc/u/matterhorn103)\
**Post date:** [September 16, 2024, 8:21pm UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/1 "2024-09-16T20:21:53Z")

</div>

I wanted to have a thread where we could specifically track and discuss the progress on switching to Qt6, so here we are. This way we have somewhere to list build problems, outstanding blocking issues etc.

I’ve tried to collect together references to known things that need to be done, it would be great if people can leave comments with additions and corrections.

## Previous work and discussion

- [The original GitHub port issue](https://github.com/OpenChemistry/avogadrolibs/issues/854), long closed
- [This thread](https://discuss.avogadro.cc/t/avogadro-1-97-0-doesnt-run-on-windows-11-arm/4018/21) features my initial attempts to compile with Qt6 as well as some discussion

## Build status

- Linux
  - Binary builds successfully
  - AppImage builds successfully via GitHub actions
  - Flatpak builds successfully

- Windows
  - x86
  - ARM

- Mac
  - x86
  - ARM
  - Universal

## Known issues

(and users who observed/reported/experienced said issue)

- @matterhorn103 According to terminal output, only formatScripts are checked for, not energy, commands, inputGenerators, or charges scripts
- @matterhorn103 No menu options for inserting molecules/crystals (presumably both this and the above are to do with Python)

## To Do

- Include `Qt:Core5Compat` where needed
- Port QRegExp to QRegularExpression
- Investigate compilation on ARM Windows when Qt 6.8 is released (3rd October) – @matterhorn103 has a machine to do this on
- Get the GitHub actions bot to return the Qt6 binaries from the automated tests so that people can test them out on their hardware
- Change release script/config so that Qt6 builds are included, or take the place of the Qt5 ones

---

<div class="post-metadata">

**Author:** ![matterhorn103](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/matterhorn103/32/1751_2.png) [@matterhorn103](https://discuss.avogadro.cc/u/matterhorn103)\
**Post date:** [September 16, 2024, 8:28pm UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/2 "2024-09-16T20:28:12Z")

</div>

It has to be said, a remarkable amount seems to work fine.

@ghutchis I’m keen to work on the remaining stuff where I can and help to push this through, so would be especially good to hear from you what the “easy but tediously time-consuming” things are, because that’s exactly the sort of thing I can take care of. 🙂

As a first thing I’ll try and get the regex stuff moved over, that’s eminently doable for me.

@brockdyer03 Once you’ve got Avogadro successfully compiling on Windows, would you mind giving a build with Qt6 a go sometime? I no longer have admin rights to any x86 Windows machines, sadly.

---

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [September 16, 2024, 8:47pm UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/3 "2024-09-16T20:47:20Z")

</div>

If we get everything moved over to Qt6 as far as compiles, I will happily investigate getting binaries “shipped.”

The main pain point is moving to the new Qt6 deployment mechanism, but it’s a solvable problem.

---

<div class="post-metadata">

**Author:** ![matterhorn103](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/matterhorn103/32/1751_2.png) [@matterhorn103](https://discuss.avogadro.cc/u/matterhorn103)\
**Post date:** [September 16, 2024, 8:53pm UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/4 "2024-09-16T20:53:08Z")

</div>

> [@ghutchis](#):
>
> The main pain point is moving to the new Qt6 deployment mechanism, but it’s a solvable problem.

Is that something I can look at and put time into helping with?

You’ve mentioned the deployment thing [before](https://discuss.avogadro.cc/t/avogadro-1-97-0-doesnt-run-on-windows-11-arm/4018/9), but I’ve never really understood what the deploy script _is_, what it does that the CMake files + the GitHub actions don’t already do, and where the current script can be found in the repo.

---

<div class="post-metadata">

**Author:** ![matterhorn103](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/matterhorn103/32/1751_2.png) [@matterhorn103](https://discuss.avogadro.cc/u/matterhorn103)\
**Post date:** [September 17, 2024, 11:23am UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/5 "2024-09-17T11:23:56Z")

</div>

Having read [Qt's CMake deployment API](https://www.qt.io/blog/cmake-deployment-api), I guess what you are talking about is running `qt_generate_deploy_app_script` within the main `CMakeLists.txt` file?

I guess the key to my lack of understanding is that I don’t understand what system/process is currently handling the things that the Qt6 deployment tools would take over – some brief enlightenment would be much appreciated.

---

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [September 17, 2024, 2:20pm UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/6 "2024-09-17T14:20:46Z")

</div>

> [@matterhorn103](#):
>
> I guess the key to my lack of understanding is that I don’t understand what system/process is currently handling the things that the Qt6 deployment tools would take over – some brief enlightenment would be much appreciated.

There are various pieces in `avogadroapp` including `cmake/DeployQt5.cmake`, `avogadro/CMakeLists.txt` and `avogadro/lastinstall/CMakeLists.txt` that fix up the bundles.

The main point is to take bits in the build `prefix` directory, and put the necessary binaries, libraries, etc. together, setting relative paths, etc. On Mac, this is a bit complicated, since binaries and libraries default to tracking the absolute paths of their dependencies.

---

<div class="post-metadata">

**Author:** ![matterhorn103](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/matterhorn103/32/1751_2.png) [@matterhorn103](https://discuss.avogadro.cc/u/matterhorn103)\
**Post date:** [October 24, 2024, 10:33am UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/7 "2024-10-24T10:33:56Z")

</div>

As an update on progress, everything should be pretty much there now. [This PR](https://github.com/OpenChemistry/avogadrolibs/pull/1748) ports all the `QRegExp` stuff and reenables the plugin stuff that was being excluded; this solves both the mentioned “known issues”, and all the scripts, fragments, and crystals stuff works.

Part of the merge request is also a change to the GitHub Actions workflows so that Qt6 binaries are uploaded for testing. Hopefully then Windows people can help out with checking for issues.

---

<div class="post-metadata">

**Author:** ![matterhorn103](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/matterhorn103/32/1751_2.png) [@matterhorn103](https://discuss.avogadro.cc/u/matterhorn103)\
**Post date:** [October 24, 2024, 10:34am UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/8 "2024-10-24T10:34:11Z")

</div>

For people interested on compiling against Qt6 themselves, the main things to note are:

1. You will need the `QtOpenGL` and `QtOpenGLWidgets` libraries in addition to the usual ones
2. You need to build with the cmake flags `-DQT_VERSION=6 -DBUILD_MOLEQUEUE=OFF` (though the latter shouldn’t be necessary, it should be the default, but it is worth making sure)

---

<div class="post-metadata">

**Author:** ![matterhorn103](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/matterhorn103/32/1751_2.png) [@matterhorn103](https://discuss.avogadro.cc/u/matterhorn103)\
**Post date:** [October 24, 2024, 10:38am UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/9 "2024-10-24T10:38:39Z")

</div>

Now that Qt 6.8 is out, I did also briefly check out building on Windows ARM as I mentioned in the original post. I’ll write in more detail about that either here or in [this old thread](https://discuss.avogadro.cc/t/avogadro-1-97-0-doesnt-run-on-windows-11-arm/4018/25) at some point. Even though full Qt support is now there, the prospects of Avogadro on the platform sadly aren’t looking promising due to issues related to OpenGL support on WinARM.

---

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [October 24, 2024, 2:29pm UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/10 "2024-10-24T14:29:30Z")

</div>

> [@matterhorn103](#):
>
> OpenGL support on WinARM

Is there a way to bundle the [OpenGL Compatibility Pack](https://devblogs.microsoft.com/directx/announcing-the-opencl-and-opengl-compatibility-pack-for-windows-10-on-arm/) with the installer?

---

<div class="post-metadata">

**Author:** ![matterhorn103](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/matterhorn103/32/1751_2.png) [@matterhorn103](https://discuss.avogadro.cc/u/matterhorn103)\
**Post date:** [October 24, 2024, 3:17pm UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/11 "2024-10-24T15:17:20Z")

</div>

Actually, the point I got stuck on was that the Qt libraries that Qt have made available to download simply don’t include `QtOpenGL` and `QtOpenGLWidgets` in the ARM version.

Presumably it would be possible to compile Qt with those libraries myself, but I haven’t looked at that yet. Would compiling Qt ourselves even be a viable option for distribution?

> [@ghutchis](#):
>
> Is there a way to bundle the [OpenGL Compatibility Pack](https://devblogs.microsoft.com/directx/announcing-the-opencl-and-opengl-compatibility-pack-for-windows-10-on-arm/) with the installer?

Yeah, I installed this too as one of things I did to try and help (it’s available from the MS store, for any future readers). I assume it would be essential to run the program. But no, I haven’t looked into that possibility. It’s something like 200 MB.

Also only up to OpenGL 3.3 is explicitly supported, though “OpenGL apps using versions up to 4.6 may work as well.”

---

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [October 24, 2024, 3:27pm UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/12 "2024-10-24T15:27:05Z")

</div>

> [@matterhorn103](#):
>
> Presumably it would be possible to compile Qt with those libraries myself, but I haven’t looked at that yet. Would compiling Qt ourselves even be a viable option for distribution?

Yeah. I looked at it with Qt5 and a universal build for Mac. We could certainly have a separate action that builds Qt (e.g. one a week or so) and provides the binaries to the current code.

> [@matterhorn103](#):
>
> Also only up to OpenGL 3.3 is explicitly supported

Yeah, as part of the port to the core profile / OpenGL 4 this summer, I think we’ll need to have some conditional code anyway. Mac only supports up to 4.1, and some features (e.g. compute shaders) would be really nice when available.

---

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [October 24, 2024, 7:46pm UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/13 "2024-10-24T19:46:26Z")

</div>

This looks far enough along, I’ll switch my laptop to test out the Qt6 version. This will hopefully give me some incentive to fixup the deploy scripts. My guess is if I can get the Mac version, the Windows and AppImage versions should be similar.

---

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [October 25, 2024, 12:27am UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/14 "2024-10-25T00:27:30Z")

</div>

So good news from that front – I built the Qt 6.8 version on my laptop and there’s already a `prefix/Avogadro2.app` which runs correctly. I’ll check out various features over the next few days, but it looks promising.

---

<div class="post-metadata">

**Author:** ![matterhorn103](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/matterhorn103/32/1751_2.png) [@matterhorn103](https://discuss.avogadro.cc/u/matterhorn103)\
**Post date:** [November 6, 2024, 1:44pm UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/15 "2024-11-06T13:44:24Z")

</div>

As a small update, the new beta flatpak builds successfully against Qt 6.7 (the current default KDE SDK). 😁

> [@ghutchis](#):
>
> I’ll switch my laptop to test out the Qt6 version.

Have you indeed been using Qt 6 for your recent development work? If so, how’s it been going?

---

<div class="post-metadata">

**Author:** ![matterhorn103](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/matterhorn103/32/1751_2.png) [@matterhorn103](https://discuss.avogadro.cc/u/matterhorn103)\
**Post date:** [December 28, 2024, 6:11pm UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/16 "2024-12-28T18:11:48Z")

</div>

@ghutchis Have you had a chance amongst all the other stuff you’ve been doing to have a look at the Qt6 Windows/Mac packaging?

---

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [December 29, 2024, 2:32am UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/17 "2024-12-29T02:32:37Z")

</div>

I looked a bit at the Mac packaging, but I don’t think I’m going to tweak that until _after_ a release. It’s a combination of software engineering (don’t mess with packaging right before a release) and time commitments this time of year.

(Pitt starts the spring semester in early January, so I’m also prepping.)

Don’t worry, I’ll revisit soon, along with the QTAIM plugin.

---

<div class="post-metadata">

**Author:** ![matterhorn103](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/matterhorn103/32/1751_2.png) [@matterhorn103](https://discuss.avogadro.cc/u/matterhorn103)\
**Post date:** [December 29, 2024, 10:37am UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/18 "2024-12-29T10:37:42Z")

</div>

Hmm ok, I understand where you’re coming from but I’d personally be more in favour of releasing a few, or several, weeks later in order to make sure the release is against Qt6.

A small delay wouldn’t be a big deal imo given the length of time between Avogadro releases. It seems a shame to have another release with the SSH and plugin dialog issues when we know how to fix them.

If your view is absolutely fixed, can we at least switch to Qt6 for all the Linux builds since they are ready to go? Basically every distro has now moved, or will imminently move, to shipping Plasma 6 and Qt6, and Linux is where it makes the biggest difference.

---

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [December 29, 2024, 2:17pm UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/19 "2024-12-29T14:17:06Z")

</div>

I have no problem switching Linux to Qt6 (assuming we can fix at least the [symmetry plugin](https://github.com/OpenChemistry/avogadrolibs/pull/1880) which had some linking problems).

To a large degree, I suspect package maintainers will switch to Qt6 anyway - and they support a large part of the user base.

I’m worried about releasing a 1.100 with Qt6 for Windows since there’s clearly a launch bug with some fraction of Win10 users … and it’s hard to get anyone experiencing it to test nightly builds. I don’t blame them – who wants to run a program that crashes on startup?

So I want a _lot_ of time to test Qt6 deployment on Windows (e.g., the OpenSSL bits will need testing / updating there)

Qt6 on Mac is do-able, but it’s a slog because all the libraries, plugins, etc. need to be properly run through `install_name_tool` to make sure they look with relative paths for each other. The default `macdeployqt` gets most of the way, but nailing down the pieces will take time. (Obviously the big bonus is being able to ship an ARM / x86-64 universal binary.)

So if you’re asking a release plan - it would be to have a 1.100.1 or a 1.101 maybe February or March. I wouldn’t be surprised if there are a pile of other minor bug reports that crop up. That gives time to test Qt6 on Mac and Windows.

---

<div class="post-metadata">

**Author:** ![brockdyer03](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/brockdyer03/32/2015_2.png) [@brockdyer03](https://discuss.avogadro.cc/u/brockdyer03)\
**Post date:** [January 13, 2025, 2:32am UTC](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592/20 "2025-01-13T02:32:10Z")

</div>

I have downloaded Qt6 on my desktop along with Qt5, so if you’d like to do some testing, I am more than willing.

My first attempt to go with Qt6 was less than successful, I didn’t even get past compiling, much less building. I used this command:

```
cmake ../openchemistry -DQt6_DIR=~/Qt6/6.8.1/msvc2022_64/lib/cmake/Qt6 -DCMAKE_TOOLCHAIN_FILE=C:/Qt6/6.8.1/msvc2022_64/lib/cmake/Qt6/Qt6Config.cmake

```

Comparing this to my Qt5 compile command:

```
cmake ../openchemistry -DQt5_DIR=~/Qt/5.15.2/msvc2019_64/lib/cmake/Qt5 -DCMAKE_TOOLCHAIN_FILE=C:/Qt/5.15.2/msvc2019_64/lib/cmake/Qt5/Qt5Config.cmake

```

I also made sure to double check that `CMAKE_PREFIX_PATH` was set to the correct directory (it was set to a Qt5 path before, so I updated it).

The error I got is:

```
C:\Users\Brock\Desktop\avogadro_qt6>cmake ../openchemistry -DQt6_DIR=~/Qt6/6.8.1/msvc2022_64/lib/cmake/Qt6 -DCMAKE_TOOLCHAIN_FILE=C:/Qt6/6.8.1/msvc2022_64/lib/cmake/Qt6/Qt6Config.cmake
-- Building for: Visual Studio 17 2022
CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/FindThreads.cmake:66 (message):
  FindThreads only works if either C or CXX language is enabled
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
  C:/Qt6/6.8.1/msvc2022_64/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:36 (find_dependency)
  C:/Qt6/6.8.1/msvc2022_64/lib/cmake/Qt6/Qt6Dependencies.cmake:34 (_qt_internal_find_third_party_dependencies)
  C:/Qt6/6.8.1/msvc2022_64/lib/cmake/Qt6/Qt6Config.cmake:136 (include)
  C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeDetermineSystem.cmake:146 (include)
  CMakeLists.txt:2 (project)

-- Configuring incomplete, errors occurred!

```

I am down to test anything to help speed up the transition to Qt6!

[Next page](https://discuss.avogadro.cc/t/qt6-tracking-thread/5592.md?page=2)
