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. Trouble configuring qt - can't find function _popen
Forum Updated to NodeBB v4.3 + New Features

Trouble configuring qt - can't find function _popen

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
11 Posts 5 Posters 1.7k Views 1 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.
  • V Offline
    V Offline
    vega
    wrote on 19 Oct 2020, 05:43 last edited by
    #1

    Hello,

    I'm trying to build stellarium from source but I've run into a problem configuring qt. When I try and run the configure.bat script, I get the following errors:

    C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp: In member function 'QByteArray QMakeEvaluator::getCommandOutput(const QString&, int*) const':
    C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:76:18: error: '_popen' was not declared in this scope; did you mean '_lopen'?
       76 | #define QT_POPEN _popen
          |                  ^~~~~~
    
    C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:540:22: note: in expansion of macro 'QT_POPEN'
      540 |     if (FILE *proc = QT_POPEN(QString(QLatin1String("cd ")
          |                      ^~~~~~~~
    
    C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:78:19: error: '_pclose' was not declared in this scope; did you mean '_lclose'?
       78 | #define QT_PCLOSE _pclose
          |                   ^~~~~~~
    
    C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:550:18: note: in expansion of macro 'QT_PCLOSE'
      550 |         int ec = QT_PCLOSE(proc);
          |                  ^~~~~~~~~
    
    C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp: In member function 'QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(const QMakeInternal::QMakeBuiltin&, const ProKey&, const ProStringList&, ProStringList&)':
    C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:1241:25: error: 'KEY_WOW64_32KEY' was not declared in this scope
     1241 |                 flags = KEY_WOW64_32KEY;
          |                         ^~~~~~~~~~~~~~~
    
    C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:1244:25: error: 'KEY_WOW64_64KEY' was not declared in this scope
     1244 |                 flags = KEY_WOW64_64KEY;
          |                         ^~~~~~~~~~~~~~~
    
    Makefile:255: recipe for target 'qmakebuiltins.o' failed
    mingw32-make: *** [qmakebuiltins.o] Error 1
    

    While all the errors are an issue, I'm mainly concerned about the _popen one. Both windows.h and stdio.h have been #include'd, and I even upgraded my mingw install to try and fix the error, but not luck.

    Has anyone encountered anything like this in their build/ know who to fix it?

    Thanks

    J J 2 Replies Last reply 19 Oct 2020, 05:47
    0
    • V vega
      19 Oct 2020, 05:43

      Hello,

      I'm trying to build stellarium from source but I've run into a problem configuring qt. When I try and run the configure.bat script, I get the following errors:

      C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp: In member function 'QByteArray QMakeEvaluator::getCommandOutput(const QString&, int*) const':
      C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:76:18: error: '_popen' was not declared in this scope; did you mean '_lopen'?
         76 | #define QT_POPEN _popen
            |                  ^~~~~~
      
      C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:540:22: note: in expansion of macro 'QT_POPEN'
        540 |     if (FILE *proc = QT_POPEN(QString(QLatin1String("cd ")
            |                      ^~~~~~~~
      
      C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:78:19: error: '_pclose' was not declared in this scope; did you mean '_lclose'?
         78 | #define QT_PCLOSE _pclose
            |                   ^~~~~~~
      
      C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:550:18: note: in expansion of macro 'QT_PCLOSE'
        550 |         int ec = QT_PCLOSE(proc);
            |                  ^~~~~~~~~
      
      C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp: In member function 'QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(const QMakeInternal::QMakeBuiltin&, const ProKey&, const ProStringList&, ProStringList&)':
      C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:1241:25: error: 'KEY_WOW64_32KEY' was not declared in this scope
       1241 |                 flags = KEY_WOW64_32KEY;
            |                         ^~~~~~~~~~~~~~~
      
      C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:1244:25: error: 'KEY_WOW64_64KEY' was not declared in this scope
       1244 |                 flags = KEY_WOW64_64KEY;
            |                         ^~~~~~~~~~~~~~~
      
      Makefile:255: recipe for target 'qmakebuiltins.o' failed
      mingw32-make: *** [qmakebuiltins.o] Error 1
      

      While all the errors are an issue, I'm mainly concerned about the _popen one. Both windows.h and stdio.h have been #include'd, and I even upgraded my mingw install to try and fix the error, but not luck.

      Has anyone encountered anything like this in their build/ know who to fix it?

      Thanks

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 19 Oct 2020, 05:47 last edited by
      #2

      @vega Do you use the MinGW console to compile (you will find it in Qt menu in Windows start menu)?
      What exact MinGW version do you use?

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

      V 1 Reply Last reply 20 Oct 2020, 06:19
      0
      • V vega
        19 Oct 2020, 05:43

        Hello,

        I'm trying to build stellarium from source but I've run into a problem configuring qt. When I try and run the configure.bat script, I get the following errors:

        C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp: In member function 'QByteArray QMakeEvaluator::getCommandOutput(const QString&, int*) const':
        C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:76:18: error: '_popen' was not declared in this scope; did you mean '_lopen'?
           76 | #define QT_POPEN _popen
              |                  ^~~~~~
        
        C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:540:22: note: in expansion of macro 'QT_POPEN'
          540 |     if (FILE *proc = QT_POPEN(QString(QLatin1String("cd ")
              |                      ^~~~~~~~
        
        C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:78:19: error: '_pclose' was not declared in this scope; did you mean '_lclose'?
           78 | #define QT_PCLOSE _pclose
              |                   ^~~~~~~
        
        C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:550:18: note: in expansion of macro 'QT_PCLOSE'
          550 |         int ec = QT_PCLOSE(proc);
              |                  ^~~~~~~~~
        
        C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp: In member function 'QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(const QMakeInternal::QMakeBuiltin&, const ProKey&, const ProStringList&, ProStringList&)':
        C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:1241:25: error: 'KEY_WOW64_32KEY' was not declared in this scope
         1241 |                 flags = KEY_WOW64_32KEY;
              |                         ^~~~~~~~~~~~~~~
        
        C:/qt5/qtbase/qmake/library/qmakebuiltins.cpp:1244:25: error: 'KEY_WOW64_64KEY' was not declared in this scope
         1244 |                 flags = KEY_WOW64_64KEY;
              |                         ^~~~~~~~~~~~~~~
        
        Makefile:255: recipe for target 'qmakebuiltins.o' failed
        mingw32-make: *** [qmakebuiltins.o] Error 1
        

        While all the errors are an issue, I'm mainly concerned about the _popen one. Both windows.h and stdio.h have been #include'd, and I even upgraded my mingw install to try and fix the error, but not luck.

        Has anyone encountered anything like this in their build/ know who to fix it?

        Thanks

        J Online
        J Online
        JonB
        wrote on 19 Oct 2020, 08:15 last edited by
        #3

        @vega
        I know nothing about MinGW. But _popen() etc. are "low-level" OS calls. Supplied under Linux, seems to be there from MSVC. But not necessarily MinGW. See e.g. https://stackoverflow.com/questions/46343789/cant-find-popen-and-pclose-with-windows-codeblocks-mingw-16-01, https://stackoverflow.com/questions/22166633/mingw-function-not-found-when-compiled-with-std-c11, https://github.com/boostorg/type_erasure/issues/16 for others reporting problem on _popen under MinGW.

        1 Reply Last reply
        0
        • J jsulm
          19 Oct 2020, 05:47

          @vega Do you use the MinGW console to compile (you will find it in Qt menu in Windows start menu)?
          What exact MinGW version do you use?

          V Offline
          V Offline
          vega
          wrote on 20 Oct 2020, 06:19 last edited by
          #4

          @jsulm It looks like I'm using MinGW version 7 - the exact install is mingw-w64-v7.0.0. I tried to compile it directly from the command line in VS code. I can't seem to see the Qt menu in my Windows start menu - is there another way to access it?

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 20 Oct 2020, 06:22 last edited by
            #5

            I'm pretty sure you've msys in your PATH and therefore configure is picking up the wrong compiler.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            V 1 Reply Last reply 20 Oct 2020, 06:32
            0
            • C Christian Ehrlicher
              20 Oct 2020, 06:22

              I'm pretty sure you've msys in your PATH and therefore configure is picking up the wrong compiler.

              V Offline
              V Offline
              vega
              wrote on 20 Oct 2020, 06:32 last edited by
              #6

              @Christian-Ehrlicher It looks like I have both MinGW and msvs2017 (from qt) in my PATH. Should I removed MinGW?

              1 Reply Last reply
              0
              • C Offline
                C Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 20 Oct 2020, 06:37 last edited by
                #7

                It depends on what you want to sue to compile Qt - MSVC or MinGW - only one of them should be visible to configure when compiling Qt.
                Why do you want to compile Qt at all?

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                V 2 Replies Last reply 20 Oct 2020, 15:43
                1
                • C Christian Ehrlicher
                  20 Oct 2020, 06:37

                  It depends on what you want to sue to compile Qt - MSVC or MinGW - only one of them should be visible to configure when compiling Qt.
                  Why do you want to compile Qt at all?

                  V Offline
                  V Offline
                  vega
                  wrote on 20 Oct 2020, 15:43 last edited by
                  #8

                  @Christian-Ehrlicher I'm building Stellarium from source, and I need Qt in order to do so.

                  1 Reply Last reply
                  0
                  • C Christian Ehrlicher
                    20 Oct 2020, 06:37

                    It depends on what you want to sue to compile Qt - MSVC or MinGW - only one of them should be visible to configure when compiling Qt.
                    Why do you want to compile Qt at all?

                    V Offline
                    V Offline
                    vega
                    wrote on 20 Oct 2020, 16:00 last edited by
                    #9

                    @Christian-Ehrlicher Also, when I try and combile with just MinGW in path, I get the same error. When I try and compile with just msvc, I get an error that says "Cannot detect host toolchain. Please use -platform. Aborting."

                    1 Reply Last reply
                    0
                    • V Offline
                      V Offline
                      vega
                      wrote on 7 Nov 2020, 16:48 last edited by
                      #10

                      Note to future visitors: I was unfortunately unable to fix the _popen error. I eventually just decided to download qt with the qt installer ( it wasn't working for me previously) and it seems to be ok now. If anyone else encounters this error, good luck!

                      1 Reply Last reply
                      2
                      • Y Offline
                        Y Offline
                        yasamson
                        wrote on 8 Jun 2024, 21:34 last edited by
                        #11

                        It is necessary to change the mingw version according to the table https://wiki.qt.io/MinGW.

                        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