From 84befc2ae1b2f2be0541c65629fb911d0be013b4 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 9 Jul 2021 13:30:27 +0200 Subject: [PATCH] QtSupport: Catch some setup errors coming via stdout Some setups pass error messages via stdout, fooling the detection logic into believing everything is fine. We roughly know what to expect from qmake -query, so we can at least filter out some cases. Change-Id: I799a0bc708d44e062c8ad298c0d8fc576328e5b5 Reviewed-by: Christian Stenger --- src/plugins/qtsupport/baseqtversion.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index b670482729a..6165d543033 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -1813,6 +1813,15 @@ bool BaseQtVersionPrivate::queryQMakeVariables(const FilePath &binary, const Env QByteArray output; output = runQmakeQuery(binary, env, error); + if (!output.startsWith('Q')) { // Is it always "QT_SYSROOT="? + // Some setups pass error messages via stdout, fooling the logic below. + // Example with docker/qemu/arm "OCI runtime exec failed: exec failed: container_linux.go:367: + // starting container process caused: exec: "/bin/qmake": stat /bin/qmake: no such file or directory" + // Since we have a rough idea on what the output looks like we can work around this. + *error = QString::fromUtf8(output); + return false; + } + if (output.isNull() && !error->isEmpty()) { // Note: Don't rerun if we were able to execute the binary before.