Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved Installed Qt5.10.1 in ~/Qt5.10.1; qmake from the command line gives "bash: qmake: command not found"

    Installation and Deployment
    6
    10
    14254
    Loading More Posts
    • 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.
    • D
      deleted408 last edited by

      I have successfully installed Qt5.10.1 in my ~/Qt5.10.1 directory. It includes Qt Creator which works perfectly fine and builds projects perfectly but when I try to build a project from the command line I get the standard "qmake: command not found". I have installed a few versions of Qt before but have since deleted all but the one in the directory mentioned above. Any help at all on how to best deal with this (perhaps start installing all over again?) would be greatly appreciated.

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        One simple thing to do: use the full path to the qmake executable. That way you ensure that you are using the exact version of Qt you want.

        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 Reply Quote 2
        • D
          deleted408 last edited by

          I apologize for any inconvenience I might have cause you. I am very new to Qt (I have only been using it for about a week now). When you say "use the full path to the qmake executable" - I though using qmake on the command line in Terminal would generate an executable. How could I use the full path if haven't generated the executable with a successful build?
          I entered:
          cd ~/Qt5.10.1/5.10.1/Src/qtbase/examples/qmake/tutorial
          to build a basic "app example". I have installed Qt more than once with different versions (which might be part of my problem) - the problem seems to be that qmake isn't getting registered as existing to my operating system.

          D jsulm 2 Replies Last reply Reply Quote 0
          • D
            deleted408 @deleted408 last edited by

            I forgot to mention that after I cd'd to the above /tutorial directory (which includes a hello.pro file & hello.cpp & hello files) I attempted to build with the following command:
            qmake -o Makefile hello.pro
            Again, I got the standard "bash: qmake: command not found". Any help or advice would be greatly appreciated.

            1 Reply Last reply Reply Quote 0
            • Paul Colby
              Paul Colby last edited by Paul Colby

              @avmac1983 said in Installed Qt5.10.1 in ~/Qt5.10.1; qmake from the command line gives "bash: qmake: command not found":

              the problem seems to be that qmake isn't getting registered as existing to my operating system

              That's right, and by design. Unless you install the official OS-supplied packages (looks like you're on a *nix distro), you won't have qmake installed in your path. However, this is not a problem, just use the full path as @SGaist suggested. That would look something like:

              cd  ~/Qt5.10.1/5.10.1/Src/qtbase/examples/qmake/tutorial
              ~/Qt5.10.1/5.10.1/gcc_64/bin/qmake
              make
              

              Cheers.

              D 1 Reply Last reply Reply Quote 1
              • jsulm
                jsulm Lifetime Qt Champion @deleted408 last edited by

                @avmac1983 What @SGaist means is: use the whole path to qmake to call it, like:

                ~/Qt5.10.1/5.10.1/gcc_64/bin/qmake
                

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply Reply Quote 2
                • D
                  deleted408 @Paul Colby last edited by

                  I entered the following commands in the Terminal. First,
                  cd ~/Qt5.10.1/5.10.1/Src/qtbase/examples/qmake/tutorial
                  then,
                  ~/Qt5.10.1/5.10.1/clang_64/bin/qmake
                  and received the following error:
                  Project ERROR: You cannot build examples inside the Qt source tree, except as part of a proper Qt build.
                  My 'tutorial' directory contains the following:
                  hello.cpp, hello.h, hello.pro, hellounix.cpp, hellowin.cpp, AND main.cpp.
                  I thought I could use qmake from the command line in one of the following forms:
                  ~/Qt5.10.1/5.10.1/clang_64/bin/qmake
                  or
                  ~/Qt5.10.1/5.10.1/clang_64/bin/qmake -o Makefile hello.pro
                  but I get the following error for both:
                  Project ERROR: You cannot build examples inside the Qt source tree, except as part of a proper Qt build.
                  Again, I apologize for an inconvenience I have caused. Any assistance with this problem would be greatly appreciated.

                  jsulm 1 Reply Last reply Reply Quote 0
                  • jsulm
                    jsulm Lifetime Qt Champion @deleted408 last edited by

                    @avmac1983 Simply copy the whole example directory ("tutorial") to some other location and build it there.

                    cp -r ~/Qt5.10.1/5.10.1/Src/qtbase/examples/qmake/tutorial ~/
                    cd ~/tutorial
                    ~/Qt5.10.1/5.10.1/clang_64/bin/qmake
                    

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply Reply Quote 1
                    • said_oslo
                      said_oslo last edited by

                      Hi all.
                      The simple solution is to added the qmake path to the profile file:

                      > vim ~/.bashrc
                      # export Qt bin path, qmake path
                      export PATH="/opt/Qt/5.15.1/gcc_64/bin/:$PATH"
                      > source ~/.bashrc
                      
                      aha_1980 1 Reply Last reply Reply Quote 0
                      • aha_1980
                        aha_1980 Lifetime Qt Champion @said_oslo last edited by

                        Hi @said_oslo,

                        I cannot recommend that. Especially if you want to use several Qt versions in parallel, the only possible way is to call qmake with it's full path.

                        And if you use Qt Creator, it will already handle that for you.

                        Regards

                        Qt has to stay free or it will die.

                        1 Reply Last reply Reply Quote 2
                        • First post
                          Last post