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

MixxxApplication: Support linking Qt statically on Linux #12284

Merged
merged 1 commit into from Nov 13, 2023

Conversation

fwcd
Copy link
Member

@fwcd fwcd commented Nov 10, 2023

Currently, Mixxx cannot be built at all using static Qt on Linux, since it will always error at compile time with a message indicating the a plugin for the current platform is missing (see e.g. this build).

While using the system-packaged (and dynamically linked) Qt is generally the preferred way, there are use cases for statically linking Qt (e.g. portable or embedded builds), therefore it would be nice if we could at least support building Mixxx this way.

Unfortunately Linux does not have a single display API, instead there are several choices for platform plugins on Linux, as described in the Qt documentation:

This patch chooses to hardcode the X11/XCB plugin for static Qt builds, which is certainly not ideal, especially since Wayland seems to increasingly be the preferred backend, but seems to be the only plugin supported by vcpkg's qtbase:

In the spirit of having at least something that works, I would consider this an acceptable tradeoff for now. In the future we could e.g. add a configuration flag for selecting a plugin at build-time (including e.g. the Wayland plugin). Any thoughts?

Currently, Mixxx cannot be built at all using static Qt and will always
error at compile time with a message indicating the a plugin for the
current platform is missing.

While using the system-packaged Qt is generally the preferred way, there
are use cases for statically linking Qt (e.g. portable or embedded
builds), therefore it would be nice if we could at least support
building Mixxx this way.

Unfortunately, Linux does not have a single display API, a list can be
found in the Qt documentation:

    https://doc.qt.io/qt-6/qpa.html

This patch chooses to hardcode the X11/XCB plugin for static Qt builds,
which is certainly not ideal, especially since Wayland seems to
increasingly be the preferred backend, but seems to be the only plugin
supported by vcpkg's `qtbase`:

    https://github.com/mixxxdj/vcpkg/blob/2.5-rel/ports/qtbase/portfile.cmake
@daschuer
Copy link
Member

I have no objections.

@fwcd fwcd marked this pull request as ready for review November 12, 2023 16:22
@fwcd
Copy link
Member Author

fwcd commented Nov 12, 2023

I'll mark this as ready for review, since it's a pretty trivial PR, but would like to hold off merging until we've tested it with an actual build (which effectively means it's blocked on all the PRs listed in fwcd/m1xxx#48).

@fwcd
Copy link
Member Author

fwcd commented Nov 13, 2023

Can confirm that this works, tested the "static" build that only links essential and X11-related libraries in a VM:

image

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

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

Good job, Thank you. LGTM

@daschuer daschuer merged commit 17981df into mixxxdj:main Nov 13, 2023
11 checks passed
@fwcd fwcd deleted the static-qt-xcb-plugin branch November 13, 2023 12:20
@ronso0
Copy link
Member

ronso0 commented Jan 9, 2024

Lesson learned: we need to test on all affected platforms next time merging such a change.

@ronso0
Copy link
Member

ronso0 commented Jan 9, 2024

@fwcd Do you have an idea how to fix it?

@fwcd
Copy link
Member Author

fwcd commented Jan 9, 2024

This doesn‘t make much sense to me, do the Ubuntu builds link Qt statically? (I‘d find that very surprising if it were the case) Otherwise we should investigate why QT_STATIC is set at build-time…

The condition that this adds would have produced a build error before (if QT_STATIC was set on Linux), so I don‘t really understand how that could have happened in the first place.

Still, these kinds of bugs can probably easily go unnoticed if many people still have the X libraries installed.

@fwcd
Copy link
Member Author

fwcd commented Jan 9, 2024

I don’t have much experience with Ubuntu packaging and Launchpad, so perhaps someone more familiar with that process has an idea?

@ronso0
Copy link
Member

ronso0 commented Jan 9, 2024

Hmm, maybe this is not related to #12525 at all, it just seemed to this was the only relevant PR.

@fwcd
Copy link
Member Author

fwcd commented Jan 9, 2024

If it is a more general issue, it‘s probably something with the way Qt 6 is packaged on Ubuntu (in which case it should affect all Qt 6 apps)

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.

None yet

3 participants