Qt Lite and configuration changes in Qt 5.8
Asked Answered
T

3

12

So allegedly, the configuration tool for Qt went through some changes, necessary to be able to make more streamlined Qt builds, a.k.a "Qt Lite". However, there doesn't seem to be any documentation about how to use that feature, or at least I don't find any, and looking at the comments from the release announcement, others can't neither.

What's more, the changes are definitely in there, judging by the fact that the configuration that I've been using for the last couple of years fails in a bunch of ways. I am not sure how up-to-date the built in help is, since the last time I tried using it for guidance, it turned out it was largely outdated and contained options that were no longer supported.

So it would be nice if someone could shed some light on what has changed and how, and how to configure for "Lite" builds. And especially on module and feature dependencies, because I think we'd all like to avoid wasting time on builds that will start building despite an improper configuration that omits necessary dependencies just to have it inevitably fail and result in nothing but a waste of time.

Taste answered 23/1, 2017 at 17:27 Comment(0)
S
6

Per to the changelog:

  • The configuration system has been rewritten almost from scratch. This improved the consistency between builds on Unix and Windows, but some subtle unintended behavior changes are also possible. Also, some obsolete options have been entirely removed and will now cause errors.
  • It is not permissible any more to manually #define QT_NO_ anywhere. Instead, configure's -no-feature-* options must be used. Note that this does not apply to defines which modify behavior rather than entirely removing features.
  • The -no-feature-* option family was integrated with the rest of the configuration system. Numerous existing features were made optional, and build problems in various reduced configurations were fixed. This is an ongoing effort known as "Qt Lite".

Features for -no-feature-* lists are in qtbase\src\corelib\global\qfeatures.txt.

All features are enabled by default.

More information can be found in the Qt Lite Overview Presentation and its slides.

You can also use the new UI Tool which is known as Qt Configuration Tool and which is a part of Qt for Embedded Devices package - see its documentation. The configuration tool is available for commercial Qt customers only at the moment (Qt 5.8).

Socio answered 24/1, 2017 at 3:7 Comment(4)
It is a good answer, but can you extend it with an example of usage (or link to example)?Phenica
Yeah, good luck to anyone willing to try and manage feature dependencies manually. There is a tool for that, but it seems it is only for commercial clients.Taste
@ddriver The feature dependencies are already managed automatically by the configure tool. When you disable a feature that others depend on, the dependent features get disabled too. Conflicting feature selections (e.g. -no-feature-A -feature-B when B depends on A) are flagged as errors before the build starts. A successful configuration (feature-wise) ensures a successful build - otherwise it's a reportable Qt bug.Ichinomiya
That doesn't really sounds like managing. More like checking. What does the managing is the tool that is only commercially available. I guess it wouldn't be that hard to parse the feature description file and use that info to build a FOS feature configuration tool. I might just do that when I get the time.Taste
T
3

The changes that are behind my failed configuration:

  • there is no longer the option to specify whether sql support is built-in or plug-in, so the format is now just -sql-<driver>, the documentation is still not updated and lists the old format - -<option>-sql-<driver>.

  • the -l option to add a specific library has been removed, which is turning out to be problematic in multiple areas.

Edit: Also, this blog entry just posted on doing lite builds might be useful.

Taste answered 31/1, 2017 at 16:3 Comment(1)
Thankfully, at least for now it's easy to add an option to relevant configure.json to pass the library to use for the given feature to the build system.Ichinomiya
H
2

Everything that describes what the new configuration system understands is given in the configure.json files scattered around Qt modules. The configure tool uses these files to build a list of command line arguments it understands.

Without the use of other tools, to learn about Qt features you need to inspect these json files and choose the features/options you wish turned on or off.

Sub Configurations

These act as includes, and refer to the configure.json file in a given folder. E.g. qtbase/configure.json includes qtbase/src/corelib/configure.json, qtbase/src/network/configure.json etc.:

"subconfigs": [
    "src/corelib",
    "src/network",
    [...]
],

Explicit Command Line Options

The commandline/options value lists the configure options a given Qt module understands. These options are separate from the feature system, although they may be used for convenience to provide shorthand aliases that control features. For example, in qtbase/configure.json, we have:

{ "commandline": { "options": { "accessibility": "boolean", [...] }

This command line option controls the identically named accessibility feature. It is more convenient to use than dealing with the feature system's option [-no]-feature-accessibility. The following pairs have identical effects:

  • -accessibility or -feature-accessibility
  • -no-accessibility or -no-feature-accessibility

Values:

  • boolean options are given to configure as -option and -no-option, meaning true and false, respectively.
  • all other options are given as -option value.

Feature Options

The features value lists the features available in a given module. The features are effectively booleans. They are all enabled by default, subject to passing configuration tests that enable them.

To control a feature foo:

  • -no-feature-foo disables the feature. E.g. to disable the iconv feature, you'd do configure -no-feature-iconv [...].
  • -feature-foo enables the feature and ensures that it is available. This will cause an error if a configuration test for the feature fails. It's useful in build systems that build a particularly configured Qt along with your application: it ensures that the features your code depends on will be available.

Failing Builds

Generally speaking, no matter what combination of feature selections you provide, if configure doesn't fail, the build is supposed to succeed.

we'd all like to avoid wasting time on builds that will start building despite an improper configuration

The configure tool will detect any invalid configurations. If configure succeeds yet the build fails, it's a Qt bug and you should report it.

Hammerskjold answered 27/2, 2017 at 16:22 Comment(3)
I've had successfully configured builds failing before 5.8. 5.8 fails at the configuration step. Apparently, the only solution at the moment is to manually hack the json files. Anyway, on my machine, configure takes about the same time as the building, likely the configuration is slow because it doesn't benefit from multithreading..Taste
@ddriver Configure caches test results, so if you change configuration it should be quick. If it doesn't - something's broken. The json files indicate feature dependencies. You generally can't modify them without fixing the code in parallel: they are meant to represent dependencies in the code itself - unless there's a bug where the json file is overzealous, and the code is more accepting.Ichinomiya
It is what it is - the only way to link against a 3rd party library after the configure option to do so was removed.Taste

© 2022 - 2024 — McMap. All rights reserved.