Set up mocwrapper for Qt Framework
For the license checks to work for Qt Framework, replace the Meta-Object Compiler (moc) with mocwrapper. This means that the Qt build system calls mocwrapper first to handle the license checks. After a successful license check, mocwrapper forwards the original call to moc. If the license already exists in the local license cache, the process is quick. If it doesn't, Qt License Server requests the license and caches it on the local disk for quicker access.
This is relevant for all Qt Framework products.
Warning: You don't need to install mocwrapper manually if the official binaries contain the mocwrapper integration. For the supported versions, see Qt Framework and mocwrapper integration in official binaries
Obtain mocwrapper
To obtain mocwrapper, you can find it from the following locations depending on your installation method.
| Installation type | Location |
|---|---|
| Separate standalone Qt License Service package | LicenseManagementTools/QtLicenseServer/<version>/QtLicenseService/<operating system>/mocwrapper |
| Default Qt License Service installation with Qt Online Installer or offline installer | <Qt SDK>/LicenseService/mocwrapper(.exe) |
| Build Qt License Service from sources | See Build Qt License Service from sources. |
Replace moc with mocwrapper
To replace moc with mocwrapper:
- Ensure you're in the correct directory:
- Qt6:
cd <your Qt Framework installation path>/libexec
- Qt5:
cd <your Qt Framework installation path>/bin
- Qt6:
- Rename
moctoqtmoc:mv moc qtmoc
- Copy
mocwrapperto the directory you're in:cp <your mocwrapper source folder>/mocwrapper moc
- Build any Qt application with any IDE or from the command line to ensure that you set the installation path correctly.
- Ensure you're in the correct directory:
- Qt6:
cd <your Qt Framework installation path>/libexec
- Qt5:
cd <your Qt Framework installation path>/bin
- Qt6:
- Rename
moctoqtmoc:mv moc qtmoc
- Copy
mocwrapperto the directory you're in:cp <your mocwrapper source folder>/mocwrapper moc
- Build any Qt application with any IDE or from the command line to ensure that you set the installation path correctly.
- Ensure you're in the correct directory:
cd <your Qt Framework installation path>\bin
- Rename
moctoqtmoc:move moc.exe qtmoc.exe
- Copy
mocwrapperto the directory you're in:cp <your mocwrapper source folder>\mocwrapper.exe moc.exe
- Build any Qt application with any IDE or from the command line to ensure that you set the installation path correctly.
Verify the mocwrapper version
To verify which version of mocwrapper you have:
./mocwrapper --mocwrapper-version
./mocwrapper --mocwrapper-version
.\mocwrapper.exe --mocwrapper-version
Disable legacy license check for Qt 5
To disable legacy support for the Qt 5 qmake licensing system, replace the licheck binary with the provided one:
In <your Qt Framework installation path>/bin:
- Back up the original
licheckwith any name:cp licheck licheck.bak
- Copy
licheckreplacement into its place:cp <your mocwrapper source folder>/licheck licheck
In <your Qt Framework installation path>/bin:
- Back up the original
licheckwith any name:cp licheck licheck.bak
- Copy
licheckreplacement into its place:cp <your mocwrapper source folder>/licheck licheck
In <your Qt Framework installation path>/bin:
- Back up the original
licheckwith any name:move licheck.exe licheck_bak.exe
- Copy
licheckreplacement into its place:copy <your mocwrapper source folder>\licheck.exe .
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.