From d09c4a458c16e8d843b3165dcf929c38f7a32b6f Mon Sep 17 00:00:00 2001 From: Brian Xu Date: Wed, 29 Jul 2020 11:52:06 -0700 Subject: [PATCH] backport CR-1066596 Can't build XRT on an Amazon Linux 2 (#3655) to 2020.1 (#3690) --- build/build.sh | 2 +- src/runtime_src/tools/scripts/xrtdeps.sh | 27 +++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/build/build.sh b/build/build.sh index 51c45a87763..304c378078e 100755 --- a/build/build.sh +++ b/build/build.sh @@ -8,7 +8,7 @@ CORE=`grep -c ^processor /proc/cpuinfo` CMAKE=cmake CPU=`uname -m` -if [[ $OSDIST == "centos" ]] || [[ $OSDIST == "amazon" ]] || [[ $OSDIST == "rhel" ]]; then +if [[ $OSDIST == "centos" ]] || [[ $OSDIST == "amzn" ]] || [[ $OSDIST == "rhel" ]]; then CMAKE=cmake3 if [[ ! -x "$(command -v $CMAKE)" ]]; then echo "$CMAKE is not installed, please run xrtdeps.sh" diff --git a/src/runtime_src/tools/scripts/xrtdeps.sh b/src/runtime_src/tools/scripts/xrtdeps.sh index 1184cf2e77e..efaecfbc0d5 100755 --- a/src/runtime_src/tools/scripts/xrtdeps.sh +++ b/src/runtime_src/tools/scripts/xrtdeps.sh @@ -83,7 +83,6 @@ rh_package_list() pkgconfig \ protobuf-devel \ protobuf-compiler \ - redhat-lsb \ rpm-build \ strace \ unzip \ @@ -93,6 +92,16 @@ rh_package_list() python3-pip \ ) + if [ $FLAVOR == "amzn" ]; then + RH_LIST+=(\ + system-lsb-core \ + ) + else + RH_LIST+=(\ + redhat-lsb \ + ) + fi + # Centos8 if [ $MAJOR == 8 ]; then @@ -198,7 +207,7 @@ update_package_list() { if [ $FLAVOR == "ubuntu" ] || [ $FLAVOR == "debian" ]; then ub_package_list - elif [ $FLAVOR == "centos" ] || [ $FLAVOR == "rhel" ]; then + elif [ $FLAVOR == "centos" ] || [ $FLAVOR == "rhel" ] || [ $FLAVOR == "amzn" ]; then rh_package_list else echo "unknown OS flavor $FLAVOR" @@ -318,6 +327,16 @@ prep_rhel() yum install -y cmake3 } +prep_amzn() +{ + echo "Installing amazon EPEL..." + amazon-linux-extras install epel + echo "Installing cmake3 from EPEL repository..." + yum install cmake3 + echo "Installing opencl header from EPEL repository..." + yum install ocl-icd ocl-icd-devel opencl-headers +} + install() { if [ $FLAVOR == "ubuntu" ] || [ $FLAVOR == "debian" ]; then @@ -332,6 +351,8 @@ install() prep_centos elif [ $FLAVOR == "rhel" ]; then prep_rhel + elif [ $FLAVOR == "amzn" ]; then + prep_amzn fi if [ $FLAVOR == "rhel" ] || [ $FLAVOR == "centos" ] || [ $FLAVOR == "amzn" ]; then @@ -339,7 +360,7 @@ install() yum install -y "${RH_LIST[@]}" if [ $ARCH == "ppc64le" ]; then yum install -y devtoolset-7 - elif [ $MAJOR -lt "8" ]; then + elif [ $MAJOR -lt "8" ] && [ $FLAVOR != "amzn" ]; then yum install -y devtoolset-6 fi fi