Commit 4c6b7947 authored by Marco Bubke's avatar Marco Bubke
Browse files

Add sysroot to the gcc tool chain system header detection

If no sysroot is applied the sysroot/usr/include path is not detected. Is
fixing a typo too.

Change-Id: I6a4e750b8b24b9f702ff4874810a91f020fca410
Reviewed-by: default avatarAlessandro Portale <>
parent 998e4ae1
......@@ -146,10 +146,12 @@ static QByteArray gccPredefinedMacros(const Utils::FileName &gcc, const QStringL
return predefinedMacros;
static QList<HeaderPath> gccHeaderPathes(const Utils::FileName &gcc, const QStringList &env)
QList<HeaderPath> GccToolChain::gccHeaderPaths(const Utils::FileName &gcc, const QStringList &env, const QString &sysrootPath)
QList<HeaderPath> systemHeaderPaths;
QStringList arguments;
if (!sysrootPath.isEmpty())
arguments << QLatin1String("-xc++")
<< QLatin1String("-E")
<< QLatin1String("-v")
......@@ -326,7 +328,7 @@ GccToolChain::GccToolChain(const GccToolChain &tc) :
{ }
......@@ -409,13 +411,13 @@ ProjectExplorer::ToolChain::CompilerFlags GccToolChain::compilerFlags(const QStr
QList<HeaderPath> GccToolChain::systemHeaderPaths() const
if (m_headerPathes.isEmpty()) {
if (m_headerPaths.isEmpty()) {
// Using a clean environment breaks ccache/distcc/etc.
Utils::Environment env = Utils::Environment::systemEnvironment();
m_headerPathes = gccHeaderPathes(m_compilerCommand, env.toStringList());
m_headerPaths = gccHeaderPaths(m_compilerCommand, env.toStringList());
return m_headerPathes;
return m_headerPaths;
void GccToolChain::addToEnvironment(Utils::Environment &env) const
......@@ -97,6 +97,8 @@ protected:
virtual QList<Abi> detectSupportedAbis() const;
virtual QString detectVersion() const;
static QList<HeaderPath> gccHeaderPaths(const Utils::FileName &gcc, const QStringList &env, const QString &sysrootPath = QString());
mutable QByteArray m_predefinedMacros;
......@@ -109,7 +111,7 @@ private:
Abi m_targetAbi;
mutable QList<Abi> m_supportedAbis;
mutable QList<HeaderPath> m_headerPathes;
mutable QList<HeaderPath> m_headerPaths;
mutable QString m_version;
friend class Internal::GccToolChainFactory;
Supports Markdown
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