As of version 5.14.0 Qt is relocatable, i.e. it is possible to move the Qt installation to a different directory without breaking functionality or loading of plugins.
Let’s slip into the role of the Qt build master of a Windows project. You’re the one who knows all configure arguments by heart. You know which optimization screw to turn and which unneeded feature to turn off.
Your Qt build is perfectly tailored to the project and you’re providing a zip file containing the Qt installation.
configure -prefix C:/Qt/5.12.6 ...more options... jom jom install zip -r X:\shared_stuff\qt-5.12.6.zip C:\Qt\5.12.6
Then your teammates extract the archive to exactly the same location, and everything works fine.
Now, for whatever reason, Joe Developer must extract the Qt installation to some other drive/directory.
The Qt in that different directory is dysfunctional. QMake won’t work properly. Plugins cannot be loaded. Qt assets cannot be found.
Historically, Qt’s configure will bake the installation directory into the qmake executable and the Qt5Core library. The logic in QLibraryInfo tries to locate plugins, assets and mkspecs below the hard-coded prefix, which is always what you passed to configure with the -prefix argument.
Oh yes! Since Qt 5.14.0 the installation prefix can be automatically determined by the location of the Qt5Core library or the executable itself without relying on hard-coded paths.
This automatism is controlled at the time when Qt is configured via the relocatable feature.
This feature is on by default for non-static builds of Qt.
If you need a relocatable static build, turn on the feature manually:
configure -static -feature-relocatable ...
The caveat of relocatable static builds is that Qt-internal translations are not picked up automatically.
You will have to deploy Qt’s translation files together with your application.
This difference to the non-relocatable build is the reason why relocatable is off by default for static builds.
Of course you can.
configure -no-feature-relocatable ...
will bring back the old behavior.
Linux distributions, for example, don’t have the need for a relocatable Qt and can turn off the feature.
QTBUG-14150 is the original issue where the effort was tracked.
Commit 4ac872639ed0dd3ae6627e05bdda821f7d128500 in qtbase introduced the relocatable feature.
Download the latest release here: www.qt.io/download.
Qt 6 was created to be the productivity platform for the future, with next-gen 2D & 3D UX and limitless scalability.
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Näytä tämä julkaisu Instagramissa.
Want to build something for tomorrow, join #QtPeople today! We have loads of cool jobs you don’t want to miss! http://qt.io/careers #builtwithQt #software #developers #coding #framework #tool #tooling #C++ #QML #engineers #sales #tech #technology #UI #UX #CX #Qt #Qtdev #global #openpositions #careers #job
Henkilön Qt (@theqtcompany) jakama julkaisu