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

Dependency and documentation changes for a Qt6 build on Ubuntu 23.10 or upcoming 24.04 LTS (Noble Numbat) #912

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

tim-littlefair
Copy link

@tim-littlefair tim-littlefair commented Mar 15, 2024

I'm running a laptop on a recent pre-release nightly build of Noble Numbat (as well as a day-to-day machine running non-LTS 23.10 Mantic).

I picked up OpenBoard a couple of weeks back as a medium for some notes I was preparing for myself, thought I'd build it from source, and given the support situation with Qt5, and KDE5, I decided to build against Qt6 rather than follow the instructions dating back a couple of LTS's for building against Qt5.15.X.

I found the build went through fairly easily once I'd worked out the correct dependencies to bring in with apt. The only change to the original source in the code repository I needed was a 2-line change to OpenBoard.pro related to the libquazip library for which the recommendation seems to be that Qt6 builds should depend on a different major version with different install path conventions:
[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019507].

Note that the 2-line change mentioned above does not retain the ability to build with the same file against Qt5, as I am choosing not to install any Qt5 components side-by-side with Qt6 on my machines and would not be able to test it - however I think it would be fairly simple for the OpenBoard.org team to wrap the change in conditional logic to assure that either build remains supported.

Apart from that, I felt the effort I had put into discovering a viable set of dependencies for the Qt6 build might be useful to other users, so I copied the Markdown document describing the Ubuntu Qt5 build process into new directory suggested-wiki-changes and created a variant of this document listing the dependencies which worked for me with Qt6. The dependencies listed in this document as of the commit used for this merge include libquazip5-dev - I suspect that this dependency is not required as libquazip1-qt6-dev probably supersedes it, and I will update the PR to remove the older package when I have had an opportunity to test this next time I do a clean OS install.

Obviously the document chnages included in this PR are not intended by me to be merged into the code repository, they are offered for transfer to the project's wiki if the project team chooses to take them up.

Regardless of whether this PR is accepted, rejected or ignored, I am grateful for the work of the OpenBoard.org team on this interesting and useful product.

Once the right packages were installed, and qmake6 was run instead of Qt5's
qmake, the only change required was to change the library and include
paths associated with the libqua package, as conventions for these
have changed radically since Ubuntu LTS versions 2020.04 and 2024.04.
Copy link
Collaborator

@letsfindaway letsfindaway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR and the general proof that OpenBoard will most likely also work with the upcoming Ubuntu release!

I added some comments which you should probably take a look at.

As the author of the cmake based build system I would also be interested whether the build succeeds with that build system. You can find general information about this here: https://github.com/OpenBoard-org/OpenBoard/wiki/CMake-Build-System-for-Linux

In short, here are the instructions after installing all build dependencies and additionally installing cmake, downloading the sources, going to the project directory and checking out the dev branch:

# start in the project directory
mkdir build
cmake -S . -B build -DCMAKE_INSTALL_PREFIX:PATH=/usr -DQT_VERSION=6
cd build
cmake --build .
cpack -G DEB

This should create a debug build of OpenBoard and a .deb package of it. For further details see the link above.

Comment on lines +465 to +466
LIBS += -lquazip1-qt6
INCLUDEPATH += "/usr/include/QuaZip-Qt6-1.4/quazip"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to extend the surrounding version check and use the Qt6 dependencies if the qt major version number is >= 6 and use the previous definitions when it is >= 5. This would allow to use the project file with Qt 6 AND Qt 5.

Copy link
Author

@tim-littlefair tim-littlefair Mar 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I looked again today I found that I was wrong to have said that the Qt5 build was broken by this change, it was already inside a condition block gated on the value of QT_MAJOR_VERSION.

When I tried the cmake build as suggested, I ran it first to a clean checkout of dev without re-applying these changes to OpenBoard.pro, and found that for cmake this change is not required - but both lines need to change for qmake6/make build to work.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I looked again today I found that I was wrong to have said that the Qt5 build was broken by this change, it was already inside a condition block gated on the value of QT_MAJOR_VERSION.

When I tried the cmake build as suggested, I ran it first to a clean checkout of dev without re-applying these changes to OpenBoard.pro, and found that for cmake this change is not required - but both lines need to change for qmake6/make build to work.

Ok, I see. So the question is whether there are Ubuntu versions where quazip6 is installed to the paths used before, and whether your change would break the build on those versions.

The cmake build can cope with that, because it uses the cmake or pkgconfig mechanisms for finding the correct path, but here in the qmake project file the paths are hardcoded.

Copy link
Author

@tim-littlefair tim-littlefair Mar 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was googling around trying to work out why OpenBoard didn't build
against the older quazip package I found a page explaining that 'quazip1'
was intended to be treated as a separate package from the previous 'quazip'
(with 0.X version numbers), installable side by side, so Ubuntu/Debian
should not treat quazip[0] packages as obsolete just because quazip1 was
available. The follow on from this was that it was OK for quazip1 to have different install
location and library name conventions from quazip[0].

stachenov/quazip#92

On Ubuntu 23.10, the following variants on the quazip package exist:

tim@tim-OptiPlex-7450-AIO:~$ apt list libquazip*
Listing... Done
libquazip-doc/mantic,mantic 0.9.1-3 all
libquazip1-qt5-1/mantic 1.4-1 amd64
libquazip1-qt5-dev/mantic 1.4-1 amd64
libquazip1-qt5-doc/mantic,mantic 1.4-1 all
libquazip1-qt6-1/mantic,now 1.4-1 amd64 [installed,automatic]
libquazip1-qt6-dev/mantic,now 1.4-1 amd64 [installed]
libquazip1-qt6-doc/mantic,mantic 1.4-1 all
libquazip5-1/mantic,now 0.9.1-3 amd64 [installed,automatic]
libquazip5-dev/mantic 0.9.1-3 amd64

So it looks like libquazip1 has both Qt5 and Qt6 builds, and the libquazip5 is most likely a legacy build for Qt5 using the original libquazip[0], but this is just a guess on my part. It might be that the cleanest way of having a repo which builds against either Qt5 or Qt6 would be to update the Qt5 dependency from libquazip5-dev to libquazip1-qt5-dev, but right now I'd prefer not to bring any Qt5 components onto the machines available to me (at least until the public release of Noble is available). Of course I don't know how far back libquazip1-qt5-dev is available, so maybe it's cleaner to stay with what already works for older releases.

Copy link
Collaborator

@letsfindaway letsfindaway Mar 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course I don't know how far back libquazip1-qt5-dev is available, so maybe it's cleaner to stay with what already works for older releases.

This can be answered from the package search: https://packages.ubuntu.com/search?keywords=libquazip1

The newer naming conventions are available since Ubuntu 23.04. However, OpenBoard must also be able to be built with 20.04 and 22.04. So we need a solution which covers both without editing the project file. For the include path this is simple: just add both. But for the library name we need to differentiate.

That's the reason why I was using cmake and pkgconfig mechanisms in the cmake builds to discover libraries and include paths. I have also discussed using pkgconfig for the qmake project file quite some time ago with the project maintainer, but at that time the outcome was to keep it as it is and probably provide instructions on editing the project file for such cases.

@tim-littlefair tim-littlefair changed the base branch from master to dev March 16, 2024 08:38
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

Successfully merging this pull request may close these issues.

2 participants