From 4725008aeea407ae55cfd66de802dd9e06412efc Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 19 Oct 2017 12:50:51 +0200 Subject: shiboken: Add the c++ header include paths of g++ It seems standard C++ headers are not found by clang when run g++ 6.3.X on RHEL 7.4. Task-number: PYSIDE-431 Task-number: PYSIDE-513 Change-Id: Ibd400cfa854ce3a9f763c593969cd063346f8056 Reviewed-by: Alexandru Croitor --- .../ApiExtractor/clangparser/compilersupport.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp index 31904c0d7..e9af23bc5 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp +++ b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -132,6 +133,16 @@ static void detectVulkan(HeaderPaths *headerPaths) } } +#if defined(Q_CC_GNU) +static inline bool isRedHat74() +{ + if (QSysInfo::productType() != QLatin1String("rhel")) + return false; + const QVersionNumber osVersion = QVersionNumber::fromString(QSysInfo::productVersion()); + return osVersion.isNull() || osVersion >= QVersionNumber(7, 4); +} +#endif // Q_CC_GNU + // For MSVC, we set the MS compatibility version and let Clang figure out its own // options and include paths. // For the others, we pass "-nostdinc" since libclang tries to add it's own system @@ -167,6 +178,16 @@ QByteArrayList emulatedCompilerOptions() result.append(QByteArrayLiteral("-isystem")); result.append(clangBuiltinIncludesDir); } + // Append the c++ include paths since Clang is unable to find etc + // on RHEL 7.4 with g++ 6.3. A fix for this has been added to Clang 5.0, + // so, the code can be removed once Clang 5.0 is the minimum version. + if (isRedHat74()) { + const HeaderPaths gppPaths = gppInternalIncludePaths(QStringLiteral("g++")); + for (const HeaderPath &h : gppPaths) { + if (h.path.contains("c++")) + headerPaths.append(h); + } + } #else HeaderPaths headerPaths; #endif -- cgit v1.2.3