From a11397e769f71227cfc44353842ea90707610236 Mon Sep 17 00:00:00 2001 From: Jeremy Newton Date: Wed, 31 May 2023 10:37:08 -0400 Subject: [PATCH] Improve HIP_CLANG_INCLUDE detection Using: $HIP_CLANG_PATH."/../lib/clang/".$HIP_CLANG_VERSION; Isn't always correct, as the library and resource directory can be customized at build time in LLVM. E.g. Fedora, RHEL, and SLE uses "lib64/clang" instead of "lib/clang". So it's better to ask clang where its resource directory is instead. Change-Id: I026b245735af5e5310b9ee6188f3f080fac6eb51 Signed-off-by: Jeremy Newton --- bin/hipconfig.pl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/bin/hipconfig.pl b/bin/hipconfig.pl index dd03ad6..5abdfbf 100755 --- a/bin/hipconfig.pl +++ b/bin/hipconfig.pl @@ -64,19 +64,16 @@ BEGIN ); if ($HIP_COMPILER eq "clang") { - $HIP_CLANG_VERSION = ""; + $HIP_CLANG_INCLUDE = ""; if($isWindows) { - $HIP_CLANG_VERSION = `\"$HIP_CLANG_PATH/clang++\" --version`; + $HIP_CLANG_INCLUDE = `\"$HIP_CLANG_PATH/clang++\" --print-resource-dir`; } else { - $HIP_CLANG_VERSION = `$HIP_CLANG_PATH/clang++ --version`; + $HIP_CLANG_INCLUDE = `$HIP_CLANG_PATH/clang++ --print-resource-dir`; } - $HIP_CLANG_VERSION=~/.*clang version (\S+).*/; - $HIP_CLANG_VERSION=$1; $CPP_CONFIG = " -D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__="; $HIP_PATH_INCLUDE = $HIP_PATH."/include"; - $HIP_CLANG_INCLUDE = $HIP_CLANG_PATH."/../lib/clang/".$HIP_CLANG_VERSION; if($isWindows) { $CPP_CONFIG .= " -I\"$HIP_PATH_INCLUDE\" -I\"$HIP_CLANG_INCLUDE\""; } else {