Qbs

Blog Documentation Get Qbs

Qbs 1.21 Released

The Qbs build tool version 1.21.0 is available.

Qbs is a community-driven language-agnostic build automation system. It is fast and offers an easy-to-learn language based upon QML.

What’s new

About 105 contributions went into this release since version 1.20.0. We have selected a few items below. Have a look into the complete changelog if you are interested in more details.

Named Module Providers

We redesigned the module providers feature. Previously, when Qbs encountered a missing module (say, Qt.core), it searched for a provider that can generate that module based on the module name - Qbs consecutively searched for providers named “Qt.core”, “Qt” until it found one. This limited the ways to use providers - ultimately, it was possible to have only one provider for each framework such as Qt or Boost. Thus, we introduced the new qbsModuleProviders property to Product and Project items which allows to specify which providers are run.

For example, to invoke the Qt provider explicitly in your product, you can do the following:

CppApplication {
    Depends { name: "Qt.core" }
    files: "main.cpp"
    qbsModuleProviders: ["Qt"]
}

It is also possible to prioritize modules generated by different module providers (did I mention the new qbspkgconfig provider?) - providers contribute to the qbsSearchPaths in the order specified by the qbsModuleProviders.

In the following example, the “Qt.core” module can come both from the “Qt” provider and the “qbspkgconfig” provider, but modules generated by the “Qt” provider have higher priority as it comes first in the list. This can be useful when you want to use a custom Qt installation (Qt provider will try to locate qmake in PATH) but also have a fallback for a system Qt provided by pkg-config.

CppApplication {
    Depends { name: "Qt.core" }
    files: "main.cpp"
    qbsModuleProviders: ["Qt", "qbspkgconfig"]
}

We plan to add more providers, such as VCPKG or Conan provider in the future.

qbspkgconfig provider

Originally, Qbs used to use the “fallback” provider based on the pkg-config tool when searhed module was not generated by any other provider. There are several problems with the “fallback” provider - it always tries to generate a module using pkg-config, even for non C++ projects such as Java projects; it does not properly support packages that have special characters in their names - such names cannot be the name of a Qbs module (e.g. “python-3.9” contains a “.” which is a qualified-id separator). Also, the “fallback” provider invoked the pkg-config tool several times per module due to limitations of the pkg-config CLI, which could lead to bad performance when using multiple packages in a project.

So, we added the new qbspkgconfig provider which uses the internal C++ library for reading .pc files. This allows Qbs to have the information about dependencies between pkg-config packages (that info is lost when using the pkg-config tool) and generate modules with respective dependencies. Also, this works much faster as we now avoid expensive forking for the pkg-config process.

The new provider and the underlying library mimic the pkg-config tool behavior as much as possible but something might work a bit differently (not always intentional, so feel free to submit bug reports/suggetions).

General

  • capnproto and protobuf modules can now use runtime provided by the new qbspkgconfig provider.
  • Qbs no longer migrates the “profiles/” dir from earlier Qbs versions (QTCREATORBUG-26475). Old directories might be cleaned up manually.
  • We fixed a problem on FreeBSD when QBS did not track changes in files correctly due to the fact it used low-precision file times (with milliseconds excluded). Now Qbs always uses high-precision file times on all OSes which may not be supported by some older UNIXes - if you are user of such OS, please report a bug.
  • A new ConanfileProbe.verbose property was added which can be useful to debug problems with Conan.

C/C++ Support

  • Added support for C++23.
  • Add Elbrus E2K architecture for the GCC toolchain QBS-1675.

Android Support

  • A new Android.ndk.buildId property was added which allows to overwrite the default value (sha1) for the –build-id linker flag.

Try it

Qbs is available for download on the download page. Please report issues in our bug tracker. Join our Discord server for live discussions. We are not using IRC anymore. You can use our mailing list for questions and discussions. The documentation and wiki are also good places to get started. Qbs is also available from a number of package repositories (Chocolatey, MacPorts, Homebrew) and is updated on each release by the Qbs development team. It can also be installed through the native package management system on a number of Linux distributions. Please find a complete overview on repology.org. Qbs 1.21.0 is also included in Qt Creator 6.0.0 which was released recently.

Contribute

If You are a happy user of Qbs, please tell others about it. But maybe you would like to contribute something. Everything that makes Qbs better is highly appreciated. Contributions may consist of reporting bugs or fixing them right away. But also new features are very welcome. Your patches will be automatically sanity-checked, built and verified on Linux, macOS and Windows by our CI bot. Get started with instructions in the Qbs Wiki. Thanks to everybody who made the 1.21.0 release happen:

Contributors

  • Christian Kandeler
  • Christian Stenger
  • Davide Pesavento
  • Denis Shienkov
  • Ivan Komissarov
  • Kai Dohmen
  • Orgad Shaneh
  • Raphaël Cotty
  • Richard Weickelt
  • Thorbjørn Lindeijer