From 39e551d3d6d18abdf993d1936e7ae9a55584c86f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 5 Dec 2018 15:10:38 +0100 Subject: shiboken: Fix finding of the Clang lib dir Query llvm-config for the lib dir instead of constructing the path from the prefix in case the Clang location is obtained via llvm-config. Assume a standard build in case the Clang location is obtained via environment variables. Change-Id: I7628d90706100a61f8a605e931bd023b27f1f442 Fixes: PYSIDE-867 Reviewed-by: Cristian Maureira-Fredes Reviewed-by: Thiago Macieira --- .../shiboken2/ApiExtractor/clangparser/compilersupport.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp index 74cad05ae..d3d5c8da8 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp +++ b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp @@ -239,11 +239,11 @@ static QByteArray noStandardIncludeOption() { return QByteArrayLiteral("-nostdin #endif #if NEED_CLANG_BUILTIN_INCLUDES -static QString findClang() +static QString findClangLibDir() { for (const char *envVar : {"LLVM_INSTALL_DIR", "CLANG_INSTALL_DIR"}) { if (qEnvironmentVariableIsSet(envVar)) { - const QString path = QFile::decodeName(qgetenv(envVar)); + const QString path = QFile::decodeName(qgetenv(envVar)) + QLatin1String("/lib"); if (QFileInfo::exists(path)) return path; } @@ -252,7 +252,7 @@ static QString findClang() QStandardPaths::findExecutable(QLatin1String("llvm-config")); if (!llvmConfig.isEmpty()) { QByteArray stdOut; - if (runProcess(llvmConfig, QStringList{QLatin1String("--prefix")}, &stdOut)) { + if (runProcess(llvmConfig, QStringList{QLatin1String("--libdir")}, &stdOut)) { const QString path = QFile::decodeName(stdOut.trimmed()); if (QFileInfo::exists(path)) return path; @@ -264,11 +264,11 @@ static QString findClang() static QString findClangBuiltInIncludesDir() { // Find the include directory of the highest version. - const QString clangPath = findClang(); - if (!clangPath.isEmpty()) { + const QString clangPathLibDir = findClangLibDir(); + if (!clangPathLibDir.isEmpty()) { QString candidate; QVersionNumber lastVersionNumber(1, 0, 0); - QDir clangDir(clangPath + QLatin1String("/lib/clang")); + QDir clangDir(clangPathLibDir + QLatin1String("/clang")); const QFileInfoList versionDirs = clangDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot); for (const QFileInfo &fi : versionDirs) { -- cgit v1.2.3