Qt 5.x Runtime Components for Linux Platform - magic-lantern-studio/mle-documentation GitHub Wiki
This documentation discusses how to build Qt components targeting the Ubuntu 22.04 LTS 64-bit platform. These components are not Rehearsal Player or Inventor components since they utilize OpenGL directly (not Open Inventor).
To install Qt, you can either use the "apt" command, or you can use the Qt Online Installer.
To download the qt components using apt, do the following:
sudo apt install -y qtcreator qtbase5-dev qt5-qmake cmake
Download the Qt Online Installer, qt-unified-linux-x64-3.2.3-online.run installation script from here. You will need an account with Qt to obtain the open source.
To install Qt on the Ubuntu 22.04 LTS 64-bit platform, do the following:
Use the following Qt installer to download and install Qt Creator and 5.x versions of the SDK.
chmod +x qt-unified-linux-x64-3.2.3-online.run
./qt-unified-linux-x64-3.2.3-online.run
Make sure to install the "Desktop Qt 5.15.0 GCC 64bit" kit. The Magic Lantern Qt libraries have only been tested against this version of the Qt SDK.
Make sure to also add the xinerama0 library:
$ sudo apt update
$ sudo apt install libxcb-xinerama0
Note: You may also need to set the QT_PLUGIN_PATH environment variable if you see the following error while running your application
QFactoryLoader::QFactoryLoader() checking directory path "/media/workarea/msm/Projects/WizzerWorks/MagicLanternPython/mle-players/Players/rehearsal/build/qt/build-mleplayer-Desktop_Qt_5_12_11_GCC_64bit-Debug/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
For example, the following workaround will probably fix this issue:
export QT_PLUGIN_PATH=/home/msm/binQt/5.12.11/gcc_64/plugins
Note: Replace the path with one referencing where you installed Qt.
The QtCreator installation does not install example code and documentation. So, do the following:
sudo apt-get install qtbase5-examples qtbase5-doc-html qt5-doc qt5-doc-html
To uninstall Qt, do the following
- Open a terminal.
- Go to the installed directory, for example "cd /opt/Qt".
- Run MaintenanceTools using the following command "./MaintenanceTool". Follow the directions in the dialog.
Use the instructions found at SDK Build Environment for Qt Linux Platform to generate the runtime libraries and mastering tools for the Linux platform.
You do not need to build the Rehearsal Player components (Actors/Roles/Mediarefs/Sets/Stages) found on that page since those instructions target the Coin 3D Inventor platform. The Qt Runtime Target uses OpenGL without the Coin 3D Scene Graph.
The Qt runtime libraries may be built by using either the QtCreator IDE or in batch mode.
Load the following projects into Qt Creator:
Library | Location | Description |
---|---|---|
qtstage | $MLE_HOME/Parts/stages/qt/mleqtstage.pro | Qt Stage |
qtmref | $MLE_HOME/Parts/mediaref/qt/mleqtmref.pro | Qt Media References |
qtset | $MLE_HOME/Parts/sets/qt/mleqtset.pro | Qt Sets |
qtrole | $MLE_HOME/Parts/roles/qt/mleqtrole.pro | Qt Roles |
Note that the ".pro.user" files are not tracked by the source code repository. Therefore, these files must be configured the first time that Qt Creator is used. For each of the above projects, enable the "Desktop Qt 5.12.6 GCC 64bit" kit. This can be done in the "Projects" tab under the "Build & Run" dialog on the left-hand side of the tab.
Also, update the Debug and Release "Build directory" for each respective project to
Build Directory | Description |
---|---|
$(MLE_HOME)/Parts/stages/build-mleqtstage-Desktop-Debug | qtstage Debug build |
$(MLE_HOME)/Parts/stages/build-mleqtstage-Desktop-Release | qtstage Release build |
$(MLE_HOME)/Parts/mediaref/build-mleqtmref-Desktop-Debug | qtmref Debug build |
$(MLE_HOME)/Parts/mediaref/build-mleqtmref-Desktop-Release | qtmref Release build |
$(MLE_HOME)/Parts/sets/build-mleqtset-Desktop-Debug | qtset Debug build |
$(MLE_HOME)/Parts/sets/build-mleqtset-Desktop-Release | qtset Release build |
$(MLE_HOME)/Parts/roles/build-mleqtrole-Desktop-Debug | qtrole Debug build |
$(MLE_HOME)/Parts/roles/build-mleqtrole-Desktop-Release | qtrole Release build |
The batch Makefile depends that the libraries have been configured with the above kit and Debug/Release paths.
Use the following instructions to build all the Qt libraries in batch mode (without Qt Creator):
- cd $MLE_HOME/build/linux
- make -f Makefile.qt qt_install
The libraries will be installed in $MLE_ROOT. By default, this should /opt/MagicLantern/lib.
To build the libqtstage library in batch mode, do the following:
- cd $MLE_HOME/build/linux
- make -f Makefile.qt qtstage_install
The build artifacts will be located in $(MLE_HOME)/Parts/stages/build-mleqtstage-Desktop-Debug.
The library will be installed to $MLE_ROOT/lib/qt/libqtstage.so.
A unit test is provided as part of the project. Use the "Run" button to execute the unittest program. You should see an empty QtStage window.
To build the Qt Media Reference library, libgtmref, do the following:
- cd $MLE_HOME/build/linux
- make -f Makefile.qt qtmref_install
The build artifacts will be located in $(MLE_HOME)/Parts/mediaref/build-mleqtmref-Desktop-Debug.
The library will be installed to $MLE_ROOT/lib/qt/libqtmref.so.
A unit test is provided as part of the qtmref project. Additional parameters, the name of a image file, needs to be provided in order to run the test. In QtCreator's "Run Settings" panel ("Projects"->"Build & Run"->"Desktop"->"Run" selection) set the "Working directory:" to $MLE_HOME/Parts/mediaref/qt/test. Also set the "Command line arguments:" to wwlogo.png.
After setting the input argument in the "Projects" run configuration, use the "Run" button to execute the unittest program. You will see a QtStage window with a Qt Mle2dSet. Nothing is rendered yet.
To build the Qt Set library, libqtset, do the following:
- cd $MLE_HOME/build/linux
- make -f Makefile.qt qtset_install
The build artifacts will be located in $(MLE_HOME)/Parts/sets/build-mleqtset-Desktop-Debug.
The library will be installed to $MLE_ROOT/lib/qt/libqtset.so.
A unit test is provided as part of the qtset project. Use the "Run" button to execute the unittest program. You will see a QtStage window with a Qt Mle2dSet. Nothing is rendered using this set.
To buid the libqtrole library in batch mode, do the following:
- cd $MLE_HOME/build/linux
- make -f Makefile.qt qtrole_install
The build artifacts will be located in $(MLE_HOME)/Parts/roles/build-mleqtrole-Desktop-Debug.
The library will be installed to $MLE_ROOT/lib/qt/libqtrole.so.
A unit test is provided as part of the qtrole project. Additional parameters, the name of a image file, needs to be provided in order to run the test. In QtCreator's "Run Settings" panel ("Projects"->"Build & Run"->"Desktop"->"Run" selection) set the "Working directory:" to $MLE_HOME/Parts/roles/qt/test. Also set the "Command line arguments:" to wwlogo.png.
After setting the input argument in the "Projects" run configuration, use the "Run" button to execute the unittest program. You will see a QtStage window with a Qt Mle2dSet. Nothing is rendered yet.