Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Installed Qt5.10.1 in ~/Qt5.10.1; qmake from the command line gives "bash: qmake: command not found"

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

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
10 Posts 6 Posters 17.0k Views
  • 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 Offline
    D Offline
    deleted408
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      2
      • D Offline
        D Offline
        deleted408
        wrote on last edited by
        #3

        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 jsulmJ 2 Replies Last reply
        0
        • D deleted408

          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 Offline
          D Offline
          deleted408
          wrote on last edited by
          #4

          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
          0
          • Paul ColbyP Offline
            Paul ColbyP Offline
            Paul Colby
            wrote on last edited by Paul Colby
            #5

            @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
            1
            • D deleted408

              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.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @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
              2
              • Paul ColbyP 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 Offline
                D Offline
                deleted408
                wrote on last edited by
                #7

                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.

                jsulmJ 1 Reply Last reply
                0
                • D deleted408

                  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.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @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
                  1
                  • said_osloS Offline
                    said_osloS Offline
                    said_oslo
                    wrote on last edited by
                    #9

                    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_1980A 1 Reply Last reply
                    0
                    • said_osloS said_oslo

                      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_1980A Offline
                      aha_1980A Offline
                      aha_1980
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      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
                      2

                      • Login

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