Unsolved Trouble configuring qt - can't find function _popen
-
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
-
@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? -
@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. -
@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?
-
I'm pretty sure you've msys in your PATH and therefore configure is picking up the wrong compiler.
-
@Christian-Ehrlicher It looks like I have both MinGW and msvs2017 (from qt) in my PATH. Should I removed MinGW?
-
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? -
@Christian-Ehrlicher I'm building Stellarium from source, and I need Qt in order to do so.
-
@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."
-
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!