Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

executable doesn't work, project runs only in Qt Creator



  • Hi there,

    I'm just trying to create and run an executable of the example project "automotive" in order to be sure, that i will be able to do the same think with my own project later on. The automotive project runs without problems in the QtCreator, but when I create a build folder in which i run qmake .. and make , i get errors when i try to run the executable ./automotive

    QQmlApplicationEngine failed to load component
    qrc:/qml/automotive.qml:53 module "QtQuick.Controls" is not installed
    qrc:/qml/automotive.qml:55 module "QtQuick.Window" is not installed
    qrc:/qml/automotive.qml:52 module "QtQuick.Layouts" is not installed
    qrc:/qml/automotive.qml:54 module "QtQuick.Controls.Imagine" is not installed
    qrc:/qml/automotive.qml:51 module "QtQuick" is not installed
    qrc:/qml/automotive.qml:53 module "QtQuick.Controls" is not installed
    
    

    This error goes on for more lines, each referring to a QtQuick module.
    I had similiar problems running qmake before, but i fixed them with

    sudo apt-get install -y libgles2-mesa-dev
    sudo apt-get install -y qtquickcontrols2-5-dev
    sudo apt-get install -y qtdeclarative5-dev 
    
    

    I really don't get the point, why everything is running in Qt Creator, but the executable doesn't work, i thought the QtCreator also just work by applying qmake and make within the application.

    Thank you in advance & merry Christmas


  • Lifetime Qt Champion

    @Philomath-Qt

    calling /home/USERNAME/Qt/5.15.2/gcc_64/bin/qmake is exactly what @sgaist meant.

    However, creating a link in /usr/bin is a bad idea. Leave that directory to your distros package manager. Especially do not link to your home from there (security reasons!)

    Regards



  • okay, i just fixed part of the problem by installing

    sudo apt-get install -y qml-module-qtquick-dialogs
    sudo apt-get install -y qml-module-qtquick-controls
    sudo apt-get install -y qml-module-qtquick-layouts
    sudo apt-get install -y qml-module-qtquick-window2
    

    Now i get a new error:

    ./automotive 
    QQmlApplicationEngine failed to load component
    qrc:/qml/automotive.qml:51 module "QtQuick" version 2.12 is not installed
    


  • Still have the same problem, but now i know it's independent from qmake, because my cmake project has the same problem. My CMake project (called "qtquickLeer", using a CMakeLists.txt file, also runs perfectly fine using Qt Creator. When I create a build folder, and use cmake .. and make to create an executable, it shows me the same error

    ./qtquickLeer
    QQmlApplicationEngine failed to load component
    qrc:/main.qml:1 module "QtQuick" version 2.12 is not installed
    

    I could fix the problem in the cmake project by changing the lines in main.qml from

    import QtQuick 2.12
    import QtQuick.Window 2.12
    

    to

    import QtQuick 2.9
    import QtQuick.Window 2
    

    This doesn't make any sense to me, according toQtQuick Version , this step shouldn't be necessary, because i have the latest Qt 5 Version, therefore i also have the latest QtQuick 2.12 version.


  • Moderators

    @Philomath-Qt said in executable doesn't work, project runs only in Qt Creator:

    this step shouldn't be necessary, because i have the latest Qt 5 Version

    What version of Qt 5 do you have installed?

    The latest is Qt 5.15.2 but the version from apt-get might be older.



  • Hi @JKSH and thank you for your answer. I have Qt 5.15.2 installed using the Qt Maintenance tool.

    I just found out that my QMake is using an older Version of Qt for some reason i don't know:

    qmake --version
    

    tells me

    QMake version 3.1
    Using Qt version 5.9.5 in /usr/lib/x86_64-linux-gnu
    

    I would assume that CMake might also use an older Version, but the funny thing is, that i configured my Cmake project, so that it uses my system's CMake (not the one fron Qt Maintenance Tool). Therefor i still don't get the point, why it works in Qt Creator



  • Didn't solve the problem yet, i guess i will create a new topic in another forum, because my issue is about qmake and cmake, the QtQuick library itself isn't the problem


  • Moderators

    @Philomath-Qt said in executable doesn't work, project runs only in Qt Creator:

    I have Qt 5.15.2 installed using the Qt Maintenance tool.

    I just found out that my QMake is using an older Version of Qt for some reason i don't know:

    qmake --version
    

    tells me

    QMake version 3.1
    Using Qt version 5.9.5 in /usr/lib/x86_64-linux-gnu
    

    You have at least 2 versions of Qt on your system: Qt 5.15.2 that you installed from the MaintenanceTool, and Qt 5.9.5 that is provided by your Linux distro. This means you have at least 2 versions of qmake too (each version of Qt comes with its own copy of qmake)

    When you call sudo apt-get install -y qml-module-qtquick-dialogs you get version 5.9.5 of those modules.

    Therefor i still don't get the point, why it works in Qt Creator

    In Qt Creator, you can select which version(s) of Qt to use for your projects: https://doc.qt.io/qtcreator/creator-targets.html

    However, when you call qmake or CMake from your console, you will be using your Linux distro's version of Qt (5.9.5) by default.



  • Hi @JKSH , you are 100 percent right, i had another Qt Version on my system without knowing, because i used the wrong way to fix a bug from stackoverflow: I entered

    sudo apt-get install qt5-default
    

    But this installed Qt 5.9.5 and linked it to qmake. Unfortunately Qt Creator and the Maintenance Tool as well only listed my Qt 5.15.2 in the configuration, therefore i was not aware. I uninstalled it now by

    sudo apt-get autoremove qt5-default
    

    but now i'm back at my original bug, qmake isn't linked to my Qt Version, when i enter qmake .. in my build folder or just qmake --version i get

    qmake: could not find a Qt installation of ''
    

    Do you maybe know the proper way to solve this problem?
    I tried

    sudo ln -s /home/USERNAME/Qt/5.15.2/qmake /usr/bin/qmake-qt5 .
    

    But this didn't work, qmake --version still returns qmake: could not find a Qt installation of ''


  • Lifetime Qt Champion

    Hi,

    Always use the full path to the qmake version you want to use. Do not mess with your distribution provided Qt.



  • Thanks to you @JKSH and @SGaist for helping me understand the problem.
    I think it was a bad idea to manually install qmake additionally in the first place, because it automatically links to an old Qt Version.

    I prefixed the problem by using

    /home/USERNAME/Qt/5.15.2/gcc_64/bin/qmake ..
    

    in the build folder of my Qt project to create the makefiles.

    Finally i could link the qmake command with my Qt Version, to use qmake in the terminal:

    sudo ln -sf /home/USERNAME/Qt/5.15.2/gcc_64/bin/qmake /usr/bin/qmake
    

    @SGaist i don't get your point with using the "whole path", what is the whole path? Did i link them correctly in the ende or is there something from with it?


  • Lifetime Qt Champion

    @Philomath-Qt

    calling /home/USERNAME/Qt/5.15.2/gcc_64/bin/qmake is exactly what @sgaist meant.

    However, creating a link in /usr/bin is a bad idea. Leave that directory to your distros package manager. Especially do not link to your home from there (security reasons!)

    Regards



  • Aaah okay, now i get it, thanks for clarifying that @aha_1980 ! I should be more careful entering commands I found in some forum, I'm new to Qt and Linux.
    Can you maybe tell me the command to undo the link i created in /usr/bin ? I'm afraid to mess up the situation.


  • Lifetime Qt Champion

    @Philomath-Qt

    Can you maybe tell me the command to undo the link i created in /usr/bin ? I'm afraid to mess up the situation.

    I think you can just delete that link.

    Regards



  • @Philomath-Qt said in executable doesn't work, project runs only in Qt Creator:

    Hi there,

    I'm just trying to create and run an executable of the example project "automotive" in order to be sure, that i will be able to do the same think with my own project later on. The automotive project runs without problems in the QtCreator, but when I create a build folder in which i run qmake .. and make , i get errors when i try to run the executable ./automotive

    QQmlApplicationEngine failed to load component
    qrc:/qml/automotive.qml:53 module "QtQuick.Controls" is not installed
    qrc:/qml/automotive.qml:55 module "QtQuick.Window" is not installed
    qrc:/qml/automotive.qml:52 module "QtQuick.Layouts" is not installed
    qrc:/qml/automotive.qml:54 module "QtQuick.Controls.Imagine" is not installed
    qrc:/qml/automotive.qml:51 module "QtQuick" is not installed
    qrc:/qml/automotive.qml:53 module "QtQuick.Controls" is not installed
    
    

    This error goes on for more lines, each referring to a QtQuick module.
    I had similiar problems running qmake before, but i fixed them with

    sudo apt-get install -y libgles2-mesa-dev
    sudo apt-get install -y qtquickcontrols2-5-dev
    sudo apt-get install -y qtdeclarative5-dev 
    
    

    I really don't get the point, why everything is running in Qt Creator, but the executable doesn't work, i thought the QtCreator also just work by applying qmake and make within the application.

    Thank you in advance & merry Christmas

    This part here fixed my problem with a build failure. It couldn't find -lOpenGL. I ran this and fixed it.

    The kit was Desktop Qt 5.12.10 GCC 64-bit
    The compiler's were both System and Qmake types just for giggles. Both worked.

    Cheers!



  • One more thing. It might be trivial, but I don't know yet for sure. This was the other error I fixed along the way. I can't reproduce it with the packages updated.

    There was a build error up top in the automotive.qml file

    import QtQuick
    import QtQuick.Layouts
    import QtQuick.Controls
    import QtQuick.Controls.Imagine 2.0 <---without a version number here, I was getting a build error highlighting this line.
    import QtQuick.Window


Log in to reply