SWDEV-319221 - Fix c++/g++ build (#2464)

CentOS 7.5 has too old c++/g++/gcc(<version 5) in /usr/bin.
They cannot support __has_attribute, thus build failure will
happen.
Remove hardcoded /usr/bin path so that the target version will
be selected via PATH. For example in CentOS,
PATH=/opt/rh/devtoolset-7/root/usr/bin:$PATH, c++/g++/gcc will
be from /opt/rh/devtoolset-7/root/usr/bin.

Change-Id: Id77c54127eb0b9960e78897af75cfc3666d85689

[ROCm/hip commit: b253a4617b]
This commit is contained in:
TomSang
2022-01-24 00:45:36 -05:00
committed by GitHub
parent ed7cd9b7e1
commit 242779287f
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -372,8 +372,8 @@ macro(HIT_ADD_FILES _config _dir _label _parent)
string(REGEX REPLACE "%hc" "${HIP_HIPCC_EXECUTABLE}" _contents "${_contents}")
string(REGEX REPLACE "%hip-path" "${HIP_ROOT_DIR}" _contents "${_contents}")
string(REGEX REPLACE "%rocm-path" "${ROCM_PATH}" _contents "${_contents}")
string(REGEX REPLACE "%cc" "/usr/bin/cc" _contents "${_contents}")
string(REGEX REPLACE "%cxx" "/usr/bin/c++" _contents "${_contents}")
string(REGEX REPLACE "%cc" "cc" _contents "${_contents}")
string(REGEX REPLACE "%cxx" "c++" _contents "${_contents}")
string(REGEX REPLACE "%S" ${_dir} _contents "${_contents}")
string(REGEX REPLACE "%T" ${_label} _contents "${_contents}")
foreach(_cmd ${_contents})
+1 -1
View File
@@ -67,7 +67,7 @@ sub parse_file {
$line =~ s/%s/$file/g; # Substitute %s -> filename
$line =~ s/%t/$exe/g; # Substitute %t -> targetname
# Substitute %hc -> /path/to/hipcc and %hip-path -> /path/to/hip happens in cmake
# Substitute %cc -> /usr/bin/cc and %cxx -> /usr/bin/c++ happens in cmake
# Substitute %cc -> cc and %cxx -> c++ happens in cmake
# Substitute %S -> src dir and %T -> target build dir happens in cmake
$line =~ s/\R//g; # Remove line endings
push @customBuildCMDs, $line;