Project

General

Profile

Actions

Bug #1296

open

3.1.4: meson.build:3180:4: ERROR: Problem encountered: Qt6 >= 6.0 required for qt-client in Qt6 mode, but not found

Added by Matt Jolly 6 days ago. Updated 5 days ago.

Status:
In Review
Priority:
Normal
Category:
Bootstrap
Target version:
Start date:
04/16/2025
Due date:
% Done:

0%

Estimated time:

Description

One of our downstream users has reported that they are unable to build Freeciv.

meson.build:3180:4: ERROR: Problem encountered: Qt6 >= 6.0 required for qt-client in Qt6 mode, but not found

The system where this issue was encountered has Qt 6.8.2

meson-log.txt reveals the offending check to be here: https://github.com/freeciv/freeciv/blob/aa4161bf18fb142c0654ec26f53e308e95a759d4/meson.build#L3630-L3652

-----------
Command line: `x86_64-pc-linux-gnu-g++ -I/usr/include/qt6/QtWidgets -I/usr/include/qt6 -I/usr/include/qt6/QtGui -I/usr/include/qt6/QtCore -I/usr/lib64/qt6/mkspecs/linux-g++ /var/tmp/portage/games-strategy/freeciv-3.1.4/work/freeciv-3.1.4-build/meson-private/tmpsefbv08e/testfile.cpp -o /var/tmp/portage/games-strategy/freeciv-3.1.4/work/freeciv-3.1.4-build/meson-private/tmpsefbv08e/output.obj -c -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_FILE_OFFSET_BITS=64 -O0 -fpermissive -std=c++17` -> 1
stderr:
In file included from /usr/include/qt6/QtCore/qtcoreexports.h:7,
                 from /usr/include/qt6/QtCore/qglobal.h:26,
                 from /usr/include/qt6/QtCore/QtCore:4,
                 from /var/tmp/portage/games-strategy/freeciv-3.1.4/work/freeciv-3.1.4-build/meson-private/tmpsefbv08e/testfile.cpp:1:
/usr/include/qt6/QtCore/qcompilerdetection.h:1281:4: error: #error "You must build your code with position independent code if Qt was configured with -reduce-relocations. " "Compile your code with -fPIC (and not with -fPIE)." 
 1281 | #  error "You must build your code with position independent code if Qt was configured with -reduce-relocations. "\
      |    ^~~~~
-----------

We don't quite understand why this check fails (sometimes - we obviously managed to successfully package and test it), or why it's not a straightforward version check - later Qt releases should just make this information available via pkg-config.

Gentoo Bug: https://bugs.gentoo.org/953902
Build Log: https://bugs.gentoo.org/attachment.cgi?id=924944
meson Log: https://bugs.gentoo.org/attachment.cgi?id=924946

Please let me know if there's any


Files


Related issues 2 (2 open0 closed)

Related to Feature #1300: Qt6-6.4 as minimum requirement for Qt6-modeIn ReviewMarko Lindqvist04/17/2025

Actions
Blocks Tasks #1308: Release 3.1.5NewMarko Lindqvist04/19/2025

Actions
Actions #1

Updated by Marko Lindqvist 6 days ago

Does attached patch help? I thought that this hack is no longer needed with Qt6...

Actions #2

Updated by Marko Lindqvist 6 days ago

- main & S3_3 branch version that handles also Qt6x-mode.

Actions #3

Updated by Marko Lindqvist 5 days ago

Matt Jolly wrote:

or why it's not a straightforward version check - later Qt releases should just make this information available via pkg-config.

Latest Qt versions do, but older, yet still supported, versions do not. We can't yet rely on the existence of the .pc -file.

Actions #4

Updated by Marko Lindqvist 5 days ago

Marko Lindqvist wrote in #note-3:

Matt Jolly wrote:

or why it's not a straightforward version check - later Qt releases should just make this information available via pkg-config.

Latest Qt versions do, but older, yet still supported, versions do not.

6.4 is the first version that had them from the beginning: https://bugreports.qt.io/browse/QTBUG-86080

Actions #5

Updated by Marko Lindqvist 5 days ago

  • Related to Feature #1300: Qt6-6.4 as minimum requirement for Qt6-mode added
Actions #6

Updated by Matt Jolly 5 days ago

I've asked the impacted user to try the patch; I haven't repro'd the issue so I can't say anything other than "it still works" when applied to 3.1.4!

Qt 6.4 went EoS/EoL back in 2023 - I assume that you're still targeting distros pinned to an older version? A quick glance over https://repology.org/project/qt/versions suggests that this may not be a huge concern, pretty much everyone is on 5.15 or >= 6.4 (or provides an upgrade path to a release that supports it), including macports and debian (bookworm got 6.4 as a backport, trixie has 6.8). With 6.5 and 6.8 being current LTS releases, it's not really much of a stretch to drop support for versions older than 6.4, if only to avoid edge cases like this because we can consistently rely on pkg-config.

I'll let you know when I hear back from our user :)

Actions #7

Updated by Matt Jolly 5 days ago

Ah, you're a step ahead of me!

Actions #8

Updated by Matt Jolly 5 days ago

I tried to do some testing quickly in an Alpine 3.15 container (Qt 6.2.1).

It looks like, even with old meson, you should be able to rely on the Qt module for the dependency - with no pkg-config it can use qmake (or CMake iirc) to identify the dependency:

Run-time dependency qt6 (modules: Core, Gui, Widgets) found: YES 6.2.1 (qmake)
Checking if "qt minver" with dependency qt6 compiles: NO 

meson.build:3180:4: ERROR: Problem encountered: Qt6 >= 6.0 required for qt-client in Qt6 mode, but not found

With the `qtfine` checks removed, I get

Run-time dependency gtk4 found: NO (tried pkgconfig and cmake)
qmake found: YES (/usr/bin/qmake) 6.2.1
Run-time dependency qt6 (modules: Core, Gui, Widgets) found: YES 6.2.1 (qmake)
Detecting Qt6 tools
qmake found: YES (/usr/bin/qmake) 6.2.1
Run-time dependency qt6 (modules: Core) found: YES 6.2.1 (qmake)
Program /usr/lib/qt6/bin/moc found: NO
Program moc-qt6 found: NO
Program moc found: YES 6.2.1 (/usr/lib/qt6/libexec/moc)
Program /usr/lib/qt6/bin/uic found: NO
Program uic-qt6 found: NO
Program uic found: YES 6.2.1 (/usr/lib/qt6/libexec/uic)
Program /usr/lib/qt6/bin/rcc found: NO
Program rcc-qt6 found: NO
Program rcc found: YES 6.2.1 (/usr/lib/qt6/libexec/rcc)
Program /usr/lib/qt6/bin/lrelease found: NO
Program lrelease-qt6 found: NO
Program lrelease found: NO
Build targets in project: 52
/freeciv # ninja -C build
. . .
439/439] Linking target freeciv-qt
/freeciv # 

I didn't bind anything into the build container so I can't actually test the built client, however this suggests that the check is superfluous in meson and could be replaced with qt_dep = dependency('Qt6', modules: ['Core', 'Gui', 'Widgets'], version: '>= 6.x.y', required: true) without anyone really noticing the difference.

Actions #9

Updated by Marko Lindqvist 3 days ago

Actions #10

Updated by Marko Lindqvist 3 days ago

Actions #11

Updated by Marko Lindqvist 3 days ago

Actions

Also available in: Atom PDF