On this page

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 typeLocation
Separate standalone Qt License Service packageLicenseManagementTools/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 sourcesSee Build Qt License Service from sources.

Replace moc with mocwrapper

To replace moc with mocwrapper:

  1. Ensure you're in the correct directory:
    • Qt6:
      cd <your Qt Framework installation path>/libexec
    • Qt5:
      cd <your Qt Framework installation path>/bin
  2. Rename moc to qtmoc:
    mv moc qtmoc
  3. Copy mocwrapper to the directory you're in:
    cp <your mocwrapper source folder>/mocwrapper moc
  4. Build any Qt application with any IDE or from the command line to ensure that you set the installation path correctly.
  1. Ensure you're in the correct directory:
    • Qt6:
      cd <your Qt Framework installation path>/libexec
    • Qt5:
      cd <your Qt Framework installation path>/bin
  2. Rename moc to qtmoc:
    mv moc qtmoc
  3. Copy mocwrapper to the directory you're in:
    cp <your mocwrapper source folder>/mocwrapper moc
  4. Build any Qt application with any IDE or from the command line to ensure that you set the installation path correctly.
  1. Ensure you're in the correct directory:
    cd <your Qt Framework installation path>\bin
  2. Rename moc to qtmoc:
    move moc.exe qtmoc.exe
  3. Copy mocwrapper to the directory you're in:
    cp <your mocwrapper source folder>\mocwrapper.exe moc.exe
  4. 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:

  1. Back up the original licheck with any name:
    cp licheck licheck.bak
  2. Copy licheck replacement into its place:
    cp <your mocwrapper source folder>/licheck licheck

In <your Qt Framework installation path>/bin:

  1. Back up the original licheck with any name:
    cp licheck licheck.bak
  2. Copy licheck replacement into its place:
    cp <your mocwrapper source folder>/licheck licheck

In <your Qt Framework installation path>/bin:

  1. Back up the original licheck with any name:
    move licheck.exe licheck_bak.exe
  2. Copy licheck replacement 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.