Commit 6d8b723a authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Always add command path to environment in GccToolchain.



Fixes: SOFT ASSERT: "predefinedMacros.startsWith("#define ")" in
file .\gcctoolchain.cpp for MinGW since the g++ - invocation
to determine the macros causes g++ to launch a subprocess
which then fails.

Change-Id: If4e7b302ac57f7cbed4982a468bcb1cb3b39f028
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 54c856d3
......@@ -500,12 +500,15 @@ QList<HeaderPath> GccToolChain::systemHeaderPaths(const QStringList &cxxflags, c
return m_headerPaths;
}
void GccToolChain::addCommandPathToEnvironment(const FileName &command, Environment &env)
{
if (!command.isEmpty())
env.prependOrSetPath(command.parentDir().toString());
}
void GccToolChain::addToEnvironment(Environment &env) const
{
if (!m_compilerCommand.isEmpty()) {
FileName path = m_compilerCommand.parentDir();
env.prependOrSetPath(path.toString());
}
addCommandPathToEnvironment(m_compilerCommand, env);
}
QList<FileName> GccToolChain::suggestedMkspecList() const
......@@ -768,11 +771,12 @@ QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(const QString &comp
{
QList<ToolChain *> result;
const Environment systemEnvironment = Environment::systemEnvironment();
Environment systemEnvironment = Environment::systemEnvironment();
const FileName compilerPath = FileName::fromString(systemEnvironment.searchInPath(compiler));
if (compilerPath.isEmpty())
return result;
GccToolChain::addCommandPathToEnvironment(compilerPath, systemEnvironment);
QList<Abi> abiList = guessGccAbi(compilerPath, systemEnvironment.toStringList());
if (!abiList.contains(requiredAbi)) {
if (requiredAbi.wordWidth() != 64
......@@ -904,9 +908,12 @@ void GccToolChainConfigWidget::handleCompilerCommandChange()
QFileInfo fi(path.toFileInfo());
haveCompiler = fi.isExecutable() && fi.isFile();
}
if (haveCompiler)
abiList = guessGccAbi(path, Environment::systemEnvironment().toStringList(),
if (haveCompiler) {
Environment env = Environment::systemEnvironment();
GccToolChain::addCommandPathToEnvironment(path, env);
abiList = guessGccAbi(path, env.toStringList(),
splitString(m_platformCodeGenFlagsLineEdit->text()));
}
m_abiWidget->setEnabled(haveCompiler);
Abi currentAbi = m_abiWidget->currentAbi();
m_abiWidget->setAbis(abiList, abiList.contains(currentAbi) ? currentAbi : Abi());
......
......@@ -91,6 +91,8 @@ public:
ToolChain *clone() const;
static void addCommandPathToEnvironment(const Utils::FileName &command, Utils::Environment &env);
protected:
typedef QList<QPair<QStringList, QByteArray> > GccCache;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment