From 11a2e5a8bfb314f23a3a40577e0eebc25426d72e Mon Sep 17 00:00:00 2001 From: Aaron Enye Shi Date: Fri, 8 Sep 2017 11:46:10 -0400 Subject: [PATCH] [CentOS7] Fix HIP sample hipInfo and other tests Cent OS 7 has conflicts between its libc++ and libstdc++. Seems that we cannot use libstdc++ on Cent OS. This is related to SWDEV-131972 [ROCm CQE][Cent OS 7][G] Building any HIP sample giving an fatal error: 'bits/c++config.h'. [ROCm/clr commit: 728f1f4c954fec1b50509a8c78d1c71a030bbb9a] --- projects/clr/hipamd/bin/hipcc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/clr/hipamd/bin/hipcc b/projects/clr/hipamd/bin/hipcc index 624777ab25..5869eeda0d 100755 --- a/projects/clr/hipamd/bin/hipcc +++ b/projects/clr/hipamd/bin/hipcc @@ -106,6 +106,7 @@ if ($HIP_PLATFORM eq "hcc") { #### GCC system includes workaround #### $HCC_WA_FLAGS = " "; + $HOST_OSNAME= `cat /etc/os-release | grep "^ID\=" | cut -d= -f2 | tr -d '\n'`; if ($HCC_VERSION_MAJOR eq 1) { my $GCC_CUR_VER = `gcc -dumpversion`; my $GPP_CUR_VER = `g++ -dumpversion`; @@ -116,7 +117,8 @@ if ($HIP_PLATFORM eq "hcc") { # Only include the libstdc++ headers and libraries flags explicitly if the g++ is older than version 5. # That's because HCC already uses libstdc++ by default if a newer g++/libstdc++ is available - if (${GCC_CUR_VER} eq ${GPP_CUR_VER} and $GPP_VER_FIELDS[0] < 5) { + # Cent OS 7 cannot use libstdc++ for compilation, defaults to libc++ + if (${GCC_CUR_VER} eq ${GPP_CUR_VER} and $GPP_VER_FIELDS[0] < 5 and ($HOST_OSNAME ne "\"centos\"")) { $HCC_WA_FLAGS .= " -stdlib=libstdc++ -I/usr/include/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu/c++/${GCC_CUR_VER} -I/usr/include/c++/${GCC_CUR_VER} "; # Add C++ libs for GCC. $HIPLDFLAGS .= " -lstdc++"; @@ -124,7 +126,6 @@ if ($HIP_PLATFORM eq "hcc") { } # Force -stdlib=libc++ on UB14.04 - $HOST_OSNAME= `cat /etc/os-release | grep "^ID\=" | cut -d= -f2 | tr -d '\n'`; $HOST_OSVER= `cat /etc/os-release | grep "^VERSION_ID\=" | cut -d= -f2 | tr -d '\n'`; if ($HOST_OSNAME eq "ubuntu" and $HOST_OSVER eq "\"14.04\"") { $HIPCXXFLAGS .= " -stdlib=libc++";