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

Qt 6 host binaries have moved to QT_HOST_LIBEXECS in Qt 6.1+ #9791

Closed
jlindgren90 opened this issue Jan 8, 2022 · 1 comment
Closed

Qt 6 host binaries have moved to QT_HOST_LIBEXECS in Qt 6.1+ #9791

jlindgren90 opened this issue Jan 8, 2022 · 1 comment

Comments

@jlindgren90
Copy link
Contributor

Describe the bug
meson fails to find the moc, rcc, and uic binaries from Qt 6.1+ because they have moved from QT_HOST_BINS to QT_HOST_LIBEXECS.

To Reproduce
meson.build:

project('test', 'c')
qt6 = import('qt6')
qt6.preprocess(qresources: 'test.qrc')

Run QMAKE=qmake6 meson build.
Partial output:

Run-time dependency qt6 (modules: Core) found: YES 6.2.2 (qmake)
Program /usr/lib/qt6/bin/moc found: NO
Program moc-qt6 found: NO
Program moc found: NO found 5.15.2 but need: '== 6.2.2' (/usr/bin/moc)
Program /usr/lib/qt6/bin/uic found: NO
Program uic-qt6 found: NO
Program uic found: NO found 5.15.2 but need: '== 6.2.2' (/usr/bin/uic)
Program /usr/lib/qt6/bin/rcc found: NO
Program rcc-qt6 found: NO
Program rcc found: NO found 5.15.2 but need: '== 6.2.2' (/usr/bin/rcc)
Program /usr/lib/qt6/bin/lrelease found: YES 6.2.2 (/usr/lib/qt6/bin/lrelease)

meson.build:3:4: ERROR: RCC sources specified and couldn't find rcc-qt6, please check your qt6 installation

Expected behavior
meson should find the rcc binary which is located at /usr/lib/qt6/rcc.

system parameters

  • native build
  • Arch Linux
  • Python 3.10.1
  • meson 0.60.3
  • ninja 1.10.2

Proof-of-concept patch to add support for QT_HOST_LIBEXECS:

From 3dcdd69637ffba416e2e99fd812772b028dd0b83 Mon Sep 17 00:00:00 2001
From: John Lindgren <john@jlindgren.net>
Date: Sat, 8 Jan 2022 16:21:27 -0500
Subject: [PATCH] Add support for Qt 6.1+

Qt 6.1 moved the location of some binaries from QT_HOST_BINS to
QT_HOST_LIBEXECS as noted in the changelog:

c515ee178f Move build tools to libexec instead of the bin dir
- Tools that are called by the build system and are unlikely to be
called by the user are now installed to the libexec directory.

https://code.qt.io/cgit/qt/qtreleasenotes.git/tree/qt/6.1.0/release-note.txt

To compensate, meson now needs to look for moc, rcc, uic, etc. in
QT_HOST_LIBEXECS as well as QT_HOST_BINS.
---
 mesonbuild/dependencies/qt.py | 8 ++++++++
 mesonbuild/modules/qt.py      | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/mesonbuild/dependencies/qt.py b/mesonbuild/dependencies/qt.py
index 699f912c5..09140a85a 100644
--- a/mesonbuild/dependencies/qt.py
+++ b/mesonbuild/dependencies/qt.py
@@ -69,6 +69,12 @@ def get_qmake_host_bins(qvars: T.Dict[str, str]) -> str:
     return qvars['QT_INSTALL_BINS']
 
 
+def get_qmake_host_libexecs(qvars: T.Dict[str, str]) -> str:
+    if 'QT_HOST_LIBEXECS' in qvars:
+        return qvars['QT_HOST_LIBEXECS']
+    return qvars['QT_INSTALL_LIBEXECS']
+
+
 def _get_modules_lib_suffix(version: str, info: 'MachineInfo', is_debug: bool) -> str:
     """Get the module suffix based on platform and debug type."""
     suffix = ''
@@ -277,6 +283,7 @@ class QmakeQtDependency(_QtBase, ConfigToolDependency, metaclass=abc.ABCMeta):
         libdir = qvars['QT_INSTALL_LIBS']
         # Used by qt.compilers_detect()
         self.bindir = get_qmake_host_bins(qvars)
+        self.libexecdir = get_qmake_host_libexecs(qvars)
 
         # Use the buildtype by default, but look at the b_vscrt option if the
         # compiler supports it.
@@ -353,6 +360,7 @@ class QmakeQtDependency(_QtBase, ConfigToolDependency, metaclass=abc.ABCMeta):
             self.is_found = True
             # Used by self.compilers_detect()
             self.bindir = get_qmake_host_bins(qvars)
+            self.libexecdir = get_qmake_host_libexecs(qvars)
 
     def log_info(self) -> str:
         return 'qmake'
diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py
index 3d29b646b..1835481eb 100644
--- a/mesonbuild/modules/qt.py
+++ b/mesonbuild/modules/qt.py
@@ -127,6 +127,8 @@ class QtBaseModule(ExtensionModule):
             for b in self.tools:
                 if qt_dep.bindir:
                     yield os.path.join(qt_dep.bindir, b), b
+                if qt_dep.libexecdir:
+                    yield os.path.join(qt_dep.libexecdir, b), b
                 # prefer the <tool>-qt<version> of the tool to the plain one, as we
                 # don't know what the unsuffixed one points to without calling it.
                 yield f'{b}-qt{qt_dep.qtver}', b
-- 
2.34.1
jlindgren90 added a commit to audacious-media-player/audacious that referenced this issue Jan 8, 2022
@eli-schwartz
Copy link
Member

Fixed by #10259 and #9988

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 a pull request may close this issue.

2 participants