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. Building examples on Ubuntu with Qt-5.13.0

Building examples on Ubuntu with Qt-5.13.0

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
16 Posts 2 Posters 2.4k 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.
  • G gibbogle

    I'm starting to work with Qt-5.13.0 on Ubuntu 16.04.
    I installed Qt-5.13.0 in ~/Qt5.13.0.
    Running Qt Creator, I click on Welcome then Examples, and select the Address Book Example.
    Click Configure Project with Qt-5.13.0.
    This generates these errors in General Messages:

    /home/gib/Qt5.13.0/5.13.0/gcc_64/mkspecs/features/toolchain.prf(39): system(execute) requires one or two arguments.
    Project ERROR: Cannot run compiler 'g++'. Output:

    ===================
    Maybe you forgot to setup the environment?
    /home/gib/Qt5.13.0/5.13.0/gcc_64/mkspecs/features/toolchain.prf(76): Variable QMAKE_CXX.COMPILER_MACROS is not defined.
    /home/gib/Qt5.13.0/5.13.0/gcc_64/mkspecs/features/toolchain.prf(201): system(execute) requires one or two arguments.
    Project ERROR: Cannot run compiler 'g++'. Output:

    ===================
    Maybe you forgot to setup the environment?
    Error while parsing file /home/gib/Qt5.13.0/Examples/Qt-5.13.0/widgets/itemviews/addressbook/addressbook.pro. Giving up.
    /home/gib/Qt5.13.0/5.13.0/gcc_64/mkspecs/features/toolchain.prf(39): system(execute) requires one or two arguments.
    Project ERROR: Cannot run compiler 'g++'. Output:

    ===================
    Maybe you forgot to setup the environment?
    /home/gib/Qt5.13.0/5.13.0/gcc_64/mkspecs/features/toolchain.prf(76): Variable QMAKE_CXX.COMPILER_MACROS is not defined.
    /home/gib/Qt5.13.0/5.13.0/gcc_64/mkspecs/features/toolchain.prf(201): system(execute) requires one or two arguments.
    Project ERROR: Cannot run compiler 'g++'. Output:

    ===================
    Maybe you forgot to setup the environment?
    Error while parsing file /home/gib/Qt5.13.0/Examples/Qt-5.13.0/widgets/itemviews/addressbook/addressbook.pro. Giving up.

    Perhaps as a consequence, no Project Tree is displayed. With Project view selected, there is just the single title line "addressbook". (The project build is apparently successful, but it can't be run - there is a popup "Could not find the executable, please provide one" Presumably this problem is caused by the configure issues.)

    I don't know what it means in this context to "setup the environment". My previous experience with Qt Creator has been mainly on Windows, and the examples have always built with no problems.

    Advice will be much appreciated.

    Thanks
    Gib

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

    @gibbogle Did you install build-essential Ubuntu package as well?
    As the error message states it can't find C++ compiler.
    See https://doc.qt.io/qt-5/linux.html

    sudo apt-get install build-essential libgl1-mesa-dev
    

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

    G 1 Reply Last reply
    0
    • G Offline
      G Offline
      gibbogle
      wrote on last edited by
      #3

      @jsulm said in Building examples on Ubuntu with Qt-5.13.0:

      sudo apt-get install build-essential libgl1-mesa-dev

      Both are already the newest version.

      1 Reply Last reply
      0
      • jsulmJ jsulm

        @gibbogle Did you install build-essential Ubuntu package as well?
        As the error message states it can't find C++ compiler.
        See https://doc.qt.io/qt-5/linux.html

        sudo apt-get install build-essential libgl1-mesa-dev
        
        G Offline
        G Offline
        gibbogle
        wrote on last edited by
        #4

        @jsulm
        The kit has the compiler as: GCC (C++, x86 64bit in /usr/bin), and in /usr/bin I see gcc as a link to gcc-5.
        'gcc -v' shows

        Using built-in specs.
        COLLECT_GCC=gcc
        COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
        Target: x86_64-linux-gnu
        Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.11' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
        Thread model: posix
        gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)

        jsulmJ 1 Reply Last reply
        0
        • G gibbogle

          @jsulm
          The kit has the compiler as: GCC (C++, x86 64bit in /usr/bin), and in /usr/bin I see gcc as a link to gcc-5.
          'gcc -v' shows

          Using built-in specs.
          COLLECT_GCC=gcc
          COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
          Target: x86_64-linux-gnu
          Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.11' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
          Thread model: posix
          gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)

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

          @gibbogle Please check your Kit: are there any warnings/errors?
          Is C++ compiler set as g++?

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

          G 2 Replies Last reply
          0
          • jsulmJ jsulm

            @gibbogle Please check your Kit: are there any warnings/errors?
            Is C++ compiler set as g++?

            G Offline
            G Offline
            gibbogle
            wrote on last edited by
            #6

            @jsulm
            I don't see any warnings or errors associated with Qt-5.13.0.
            How do I set gcc to g++?

            1 Reply Last reply
            0
            • jsulmJ jsulm

              @gibbogle Please check your Kit: are there any warnings/errors?
              Is C++ compiler set as g++?

              G Offline
              G Offline
              gibbogle
              wrote on last edited by
              #7

              @jsulm
              To better express this: in the list of Compilers I see just many versions of GCC and some of Clang.

              jsulmJ 1 Reply Last reply
              0
              • G gibbogle

                @jsulm
                To better express this: in the list of Compilers I see just many versions of GCC and some of Clang.

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

                @gibbogle Can you show a screenshot of your Kit configuration?

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

                G 3 Replies Last reply
                0
                • jsulmJ jsulm

                  @gibbogle Can you show a screenshot of your Kit configuration?

                  G Offline
                  G Offline
                  gibbogle
                  wrote on last edited by
                  #9

                  @jsulm Before I try to find out how to that, perhaps there is a simple solution.
                  In Compilers, the Auto-detected list has two entries for GCC (C++, x86 64bit in /usr/bin) and two for GCC 5(C++, x86 64bit in /usr/bin). When I select these I see that the associated compiler paths are all to a version of g++:
                  /usr/bin/g++
                  /usr/bin/x86_64-linux-gnu-g++
                  /usr/bin/g++-5
                  /usr/bin/x86_64-linux-gnu-g++-5

                  I know that the kit is using GCC, not GCC 5, but there is no way to see which of the first two in the above list it corresponds to (g++ or x86_64-linux-gnu-g++).

                  Now I see that they all point to g++-5

                  gib@gigabyte:/usr/bin$ ls -al g++
                  lrwxrwxrwx 1 root root 5 May 20 2017 g++ -> g++-5
                  -rwxr-xr-x 1 root root 919832 Aug 28 2018 g++-5
                  lrwxrwxrwx 1 root root 5 May 20 2017 x86_64-linux-gnu-g++ -> g++-5
                  lrwxrwxrwx 1 root root 5 Aug 28 2018 x86_64-linux-gnu-g++-5 -> g++-5

                  G 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @gibbogle Can you show a screenshot of your Kit configuration?

                    G Offline
                    G Offline
                    gibbogle
                    wrote on last edited by
                    #10

                    @jsulm I don't know how to get a screenshot in Linux.
                    The kit for Qt-5.13.0 is (default) has:
                    Compiler: GCC (C++, x86 64bit in /usr/bin)
                    Environment: No changes to apply.
                    Qt version: Qt 5.13.0 (gcc_64)

                    1 Reply Last reply
                    0
                    • G gibbogle

                      @jsulm Before I try to find out how to that, perhaps there is a simple solution.
                      In Compilers, the Auto-detected list has two entries for GCC (C++, x86 64bit in /usr/bin) and two for GCC 5(C++, x86 64bit in /usr/bin). When I select these I see that the associated compiler paths are all to a version of g++:
                      /usr/bin/g++
                      /usr/bin/x86_64-linux-gnu-g++
                      /usr/bin/g++-5
                      /usr/bin/x86_64-linux-gnu-g++-5

                      I know that the kit is using GCC, not GCC 5, but there is no way to see which of the first two in the above list it corresponds to (g++ or x86_64-linux-gnu-g++).

                      Now I see that they all point to g++-5

                      gib@gigabyte:/usr/bin$ ls -al g++
                      lrwxrwxrwx 1 root root 5 May 20 2017 g++ -> g++-5
                      -rwxr-xr-x 1 root root 919832 Aug 28 2018 g++-5
                      lrwxrwxrwx 1 root root 5 May 20 2017 x86_64-linux-gnu-g++ -> g++-5
                      lrwxrwxrwx 1 root root 5 Aug 28 2018 x86_64-linux-gnu-g++-5 -> g++-5

                      G Offline
                      G Offline
                      gibbogle
                      wrote on last edited by gibbogle
                      #11

                      @gibbogle
                      In fact (* got stripped in the copy-and-paste) I typed:
                      ls -al * g++ *
                      (without the spaces)

                      G 1 Reply Last reply
                      0
                      • G gibbogle

                        @gibbogle
                        In fact (* got stripped in the copy-and-paste) I typed:
                        ls -al * g++ *
                        (without the spaces)

                        G Offline
                        G Offline
                        gibbogle
                        wrote on last edited by
                        #12
                        This post is deleted!
                        G 1 Reply Last reply
                        0
                        • G gibbogle

                          This post is deleted!

                          G Offline
                          G Offline
                          gibbogle
                          wrote on last edited by
                          #13
                          This post is deleted!
                          1 Reply Last reply
                          0
                          • jsulmJ jsulm

                            @gibbogle Can you show a screenshot of your Kit configuration?

                            G Offline
                            G Offline
                            gibbogle
                            wrote on last edited by
                            #14

                            @jsulm I just reminded myself that the build does find and use g++, and makes the executable. I located it, and it runs OK. So the configure errors about g++ are perhaps not important, but there is still the problem with the missing directory tree.

                            Should I make a bug report?

                            jsulmJ 1 Reply Last reply
                            0
                            • G gibbogle

                              @jsulm I just reminded myself that the build does find and use g++, and makes the executable. I located it, and it runs OK. So the configure errors about g++ are perhaps not important, but there is still the problem with the missing directory tree.

                              Should I make a bug report?

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

                              @gibbogle said in Building examples on Ubuntu with Qt-5.13.0:

                              missing directory tree

                              You mean in QtCreator? This is not a bug - if qmake fails the project structure will not be updated.
                              What happens if you call qmake in a terminal instead in QtCreator?

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

                              G 1 Reply Last reply
                              0
                              • jsulmJ jsulm

                                @gibbogle said in Building examples on Ubuntu with Qt-5.13.0:

                                missing directory tree

                                You mean in QtCreator? This is not a bug - if qmake fails the project structure will not be updated.
                                What happens if you call qmake in a terminal instead in QtCreator?

                                G Offline
                                G Offline
                                gibbogle
                                wrote on last edited by gibbogle
                                #16

                                @jsulm But qmake doesn't fail when I do Build > Run qmake, and the build does succeed.
                                I've now found that if I build for the first time then close the project (no project tree), then reopen the project, I do get a project tree. You might not call this a bug, but it's definitely confusing and undesirable.

                                There is also the issue that after a successful build, clicking the green arrow to run the program gives the "Could not find the executable" popup. (I just discovered that on reopening the project - and seeing a project tree - the green arrow does execute the program.) It seems likely that all these issues stem from the same cause.

                                Yes, this is all within Qt Creator.

                                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