PE: Avoid device compilers while handling local toolchains

...and fix environment used when processing them.

Change-Id: I457c31e195f41ca2edf105229f2818dddd2f5df0
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2022-02-23 12:33:23 +01:00
parent 49a7ada03f
commit 4e57609dc7

View File

@@ -697,7 +697,7 @@ void GccToolChain::addToEnvironment(Environment &env) const
{ {
// On Windows gcc invokes cc1plus which is in libexec directory. // On Windows gcc invokes cc1plus which is in libexec directory.
// cc1plus depends on libwinpthread-1.dll which is in bin, so bin must be in the PATH. // cc1plus depends on libwinpthread-1.dll which is in bin, so bin must be in the PATH.
if (HostOsInfo::isWindowsHost()) if (compilerCommand().osType() == OsTypeWindows)
addCommandPathToEnvironment(compilerCommand(), env); addCommandPathToEnvironment(compilerCommand(), env);
} }
@@ -1223,7 +1223,7 @@ Toolchains GccToolChainFactory::autoDetectToolChain(const ToolChainDescription &
{ {
Toolchains result; Toolchains result;
Environment systemEnvironment = Environment::systemEnvironment(); Environment systemEnvironment = tcd.compilerPath.deviceEnvironment();
GccToolChain::addCommandPathToEnvironment(tcd.compilerPath, systemEnvironment); GccToolChain::addCommandPathToEnvironment(tcd.compilerPath, systemEnvironment);
const FilePath localCompilerPath = findLocalCompiler(tcd.compilerPath, systemEnvironment); const FilePath localCompilerPath = findLocalCompiler(tcd.compilerPath, systemEnvironment);
if (ToolChainManager::isBadToolchain(localCompilerPath)) if (ToolChainManager::isBadToolchain(localCompilerPath))
@@ -1430,7 +1430,7 @@ void GccToolChainConfigWidget::handleCompilerCommandChange()
haveCompiler = fi.isExecutable() && fi.isFile(); haveCompiler = fi.isExecutable() && fi.isFile();
} }
if (haveCompiler) { if (haveCompiler) {
Environment env = Environment::systemEnvironment(); Environment env = path.deviceEnvironment();
GccToolChain::addCommandPathToEnvironment(path, env); GccToolChain::addCommandPathToEnvironment(path, env);
QStringList args = gccPredefinedMacrosOptions(Constants::CXX_LANGUAGE_ID) QStringList args = gccPredefinedMacrosOptions(Constants::CXX_LANGUAGE_ID)
+ splitString(m_platformCodeGenFlagsLineEdit->text()); + splitString(m_platformCodeGenFlagsLineEdit->text());