Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. qmake cannot run g++: $$system() not working under Windows 7
Forum Updated to NodeBB v4.3 + New Features

qmake cannot run g++: $$system() not working under Windows 7

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
16 Posts 3 Posters 3.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.
  • AshpoolA Offline
    AshpoolA Offline
    Ashpool
    wrote on last edited by Ashpool
    #1

    I've been struggling with this issue for two days now.
    I am trying to compile a very simple project with QTCreator using the MinGW 5.3.0 kit under Windows 7, but I get the following error from qmake:

    Project ERROR: Cannot run compiler 'g++'. Output:
    ===================
    ===================
    Maybe you forgot to setup the environment?
    

    I double-checked that the compiler was in place and functional. Investigating the issue further, I found out that the error occurs when parsing the mingw53_32/mkspecs/features/toolchain.prf file on this line:

    output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines, ec)
    

    which expands to

    output = $$system("set LC_ALL=C& g++ -fno-keep-inline-dllexport -E -v -xc++ - 2>&1 <NUL >NUL", lines, ec)
    

    Turns out, the $$system() function does not output anything at all no matter the arguments. For example, I tried substituting it with

    output =  $$system("echo test")
    

    and still the contents of output were empty. I know this because I tried launching qmake manually with the -d flag. I also played around with the toolchain.prf file a little, adding some debug output. Here i attached the log file I got from this command:

    D:\Qt\5.11.3\mingw53_32\bin>D:\Qt\5.11.3\mingw53_32\bin\qmake.exe D:\QTProjects\untitled9\untitled9.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" -d > qmake-test.txt 2>&1
    

    This is happening with Qt 5.11.3., but it is also relevant to 5.12.2 and 5.13.0. In fact, I downgraded from those in hopes of curing this problem. I'm glad to share any additional info that is required to resolve this issue. Please help, it's driving me crazy.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Might be a silly question but did you install MinGW through the Qt installer also ?

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

      AshpoolA 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Might be a silly question but did you install MinGW through the Qt installer also ?

        AshpoolA Offline
        AshpoolA Offline
        Ashpool
        wrote on last edited by
        #3

        @SGaist yes, I did. I also tried using a manually added compiler from the MSYS2 package installed separately, with the same result

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Do you have any yellow/red icon in your kit page in Qt Creator's preferences ?

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

          AshpoolA 1 Reply Last reply
          0
          • SGaistS SGaist

            Do you have any yellow/red icon in your kit page in Qt Creator's preferences ?

            AshpoolA Offline
            AshpoolA Offline
            Ashpool
            wrote on last edited by
            #5

            @SGaist no, the kit appears to have been configured properly. The bundled gcc, g++ and gdb were nicely detected out-of-the-box.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Did you try to close Qt Creator, nuke the build folder, the .pro.user file and then reconfigure your project ?

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

              AshpoolA 1 Reply Last reply
              0
              • SGaistS SGaist

                Did you try to close Qt Creator, nuke the build folder, the .pro.user file and then reconfigure your project ?

                AshpoolA Offline
                AshpoolA Offline
                Ashpool
                wrote on last edited by Ashpool
                #7

                @SGaist no, but I did create new helloworld projects several times. Also, as far as I can tell, the problem occurs before any project-specific files and settings get involved

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Do you still currently have several versions of MinGW ?

                  If so, can you remove the others ?

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

                  AshpoolA 2 Replies Last reply
                  0
                  • SGaistS SGaist

                    Do you still currently have several versions of MinGW ?

                    If so, can you remove the others ?

                    AshpoolA Offline
                    AshpoolA Offline
                    Ashpool
                    wrote on last edited by Ashpool
                    #9

                    @SGaist I will try that as soon as I get to my workstation. However what I did try was nuking the QTCreator's folder in AppData/Roaming, which caused all settings to reset, which included forgetting those manually added MinGW compilers. The bundled ones were detected again, and the kits were shown as if configured correctly

                    1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Do you still currently have several versions of MinGW ?

                      If so, can you remove the others ?

                      AshpoolA Offline
                      AshpoolA Offline
                      Ashpool
                      wrote on last edited by Ashpool
                      #10

                      @SGaist I removed all versions of MinGW except the one that came with Qt. My kit page in Qt Creator's preferences now has only one auto-detected kit "Desktop Qt 5.11.3 MinGW 32bit" which shows no errors or warnings. It's configured to use the MinGW binaries from Qt\Tools\mingw530_32\bin\. Upon creating a new Qt Widgets project the issue persists. There's also this message before I even try to build the project:

                      Project ERROR: failed to parse default search paths from compiler output
                      

                      and any Qt-related symbols and includes in the code editor are highlighted as unknown. It was there all along, I just didn't mention it. I believe it is caused by the same issue I described in the original post.

                      I should also mention that I did not compile Qt manually or make any modifications to it. I used the default online installer to install 5.12.2 and 5.13.0, and I used an offline installer to install 5.11.3.

                      1 Reply Last reply
                      0
                      • AshpoolA Offline
                        AshpoolA Offline
                        Ashpool
                        wrote on last edited by Ashpool
                        #11

                        I used the ProcessMonitor application from the Windows SysInternals Suite to try to determine where things go wrong. It looks like qmake.exe doesn't even try to run g++. If it did, — unsuccessfully — the log would contain a line which would look like
                        qmake.exe — QueryOpen — D:\some\path\which\doesnt\exist\g++.exe — NAME NOT FOUND
                        This, as you can see from the screenshot, is not the case.

                        0_1554362463971_Снимок.PNG

                        1 Reply Last reply
                        0
                        • AshpoolA Offline
                          AshpoolA Offline
                          Ashpool
                          wrote on last edited by
                          #12

                          This is how my kits and compilers pages in preferences are looking currently. Sorry for the Russian captions.

                          Kits:
                          0_1554362922747_Снимок2.PNG

                          Compilers:
                          0_1554362945301_Снимок1.PNG

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            All looks pretty good...

                            I suppose you can also successfully start g++ from the command line if you use the full path to the compiler ?

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

                            AshpoolA 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              All looks pretty good...

                              I suppose you can also successfully start g++ from the command line if you use the full path to the compiler ?

                              AshpoolA Offline
                              AshpoolA Offline
                              Ashpool
                              wrote on last edited by Ashpool
                              #14

                              @SGaist yes, indeed I can. I also added D:\Qt\Tools\mingw530_32\bin, the path containing it, to the PATH environment variable, just for good measure.

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                I am currently running out of ideas...

                                As a last resort, did you try a full Qt uninstallation/computer reboot/Qt installation ?

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

                                M 1 Reply Last reply
                                1
                                • SGaistS SGaist

                                  I am currently running out of ideas...

                                  As a last resort, did you try a full Qt uninstallation/computer reboot/Qt installation ?

                                  M Offline
                                  M Offline
                                  Makis
                                  wrote on last edited by
                                  #16

                                  @SGaist this happens to me and is very frustrating. The only solution i have is to create a new w10 account and install a new Qt there. I have no issues on other 2 w10 machines.

                                  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