Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. executable doesn't work, project runs only in Qt Creator
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Solved QML and Qt Quick
15 Posts 5 Posters 2.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Philomath-Qt
    wrote on 24 Dec 2020, 02:47 last edited by Philomath-Qt
    #1

    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

    1 Reply Last reply
    0
    • P Philomath-Qt
      26 Dec 2020, 16:20

      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?

      A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on 26 Dec 2020, 16:25 last edited by
      #11

      @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

      Qt has to stay free or it will die.

      1 Reply Last reply
      2
      • P Offline
        P Offline
        Philomath-Qt
        wrote on 24 Dec 2020, 03:04 last edited by Philomath-Qt
        #2

        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
        
        1 Reply Last reply
        0
        • P Offline
          P Offline
          Philomath-Qt
          wrote on 24 Dec 2020, 07:49 last edited by
          #3

          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.

          J 1 Reply Last reply 24 Dec 2020, 07:56
          0
          • P Philomath-Qt
            24 Dec 2020, 07:49

            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.

            J Offline
            J Offline
            JKSH
            Moderators
            wrote on 24 Dec 2020, 07:56 last edited by
            #4

            @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.

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            2
            • P Offline
              P Offline
              Philomath-Qt
              wrote on 24 Dec 2020, 08:34 last edited by
              #5

              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

              J 1 Reply Last reply 24 Dec 2020, 12:38
              0
              • P Offline
                P Offline
                Philomath-Qt
                wrote on 24 Dec 2020, 09:28 last edited by
                #6

                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

                1 Reply Last reply
                0
                • P Philomath-Qt
                  24 Dec 2020, 08:34

                  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

                  J Offline
                  J Offline
                  JKSH
                  Moderators
                  wrote on 24 Dec 2020, 12:38 last edited by
                  #7

                  @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.

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  1 Reply Last reply
                  3
                  • P Offline
                    P Offline
                    Philomath-Qt
                    wrote on 25 Dec 2020, 19:02 last edited by Philomath-Qt
                    #8

                    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 ''

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 25 Dec 2020, 21:38 last edited by
                      #9

                      Hi,

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

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      3
                      • P Offline
                        P Offline
                        Philomath-Qt
                        wrote on 26 Dec 2020, 16:20 last edited by
                        #10

                        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?

                        A 1 Reply Last reply 26 Dec 2020, 16:25
                        0
                        • P Philomath-Qt
                          26 Dec 2020, 16:20

                          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?

                          A Offline
                          A Offline
                          aha_1980
                          Lifetime Qt Champion
                          wrote on 26 Dec 2020, 16:25 last edited by
                          #11

                          @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

                          Qt has to stay free or it will die.

                          1 Reply Last reply
                          2
                          • P Offline
                            P Offline
                            Philomath-Qt
                            wrote on 26 Dec 2020, 16:48 last edited by
                            #12

                            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.

                            A 1 Reply Last reply 26 Dec 2020, 17:42
                            1
                            • P Philomath-Qt
                              26 Dec 2020, 16:48

                              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.

                              A Offline
                              A Offline
                              aha_1980
                              Lifetime Qt Champion
                              wrote on 26 Dec 2020, 17:42 last edited by
                              #13

                              @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

                              Qt has to stay free or it will die.

                              1 Reply Last reply
                              0
                              • R Offline
                                R Offline
                                RCD_HSV
                                wrote on 4 Jan 2021, 00:57 last edited by
                                #14

                                @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!

                                R 1 Reply Last reply 5 Jan 2021, 02:42
                                0
                                • R RCD_HSV
                                  4 Jan 2021, 00:57

                                  @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!

                                  R Offline
                                  R Offline
                                  RCD_HSV
                                  wrote on 5 Jan 2021, 02:42 last edited by
                                  #15

                                  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

                                  1 Reply Last reply
                                  0

                                  • Login

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved