From 114b09a743ad3df316b7e9bc11f3da4945ad3b59 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Thu, 20 Jun 2019 14:23:13 -0400 Subject: [PATCH 1/3] upgrade centos7 to devtoolset-8 --- scripts/eosio_build_centos.sh | 10 +++++----- scripts/helpers/general.sh | 8 ++++---- tests/bash-bats/eosio_build_centos.sh | 10 +++++----- tests/bash-bats/helpers/functions.sh | 3 +-- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/scripts/eosio_build_centos.sh b/scripts/eosio_build_centos.sh index e08a01d266f..44a96474fe0 100755 --- a/scripts/eosio_build_centos.sh +++ b/scripts/eosio_build_centos.sh @@ -12,14 +12,14 @@ echo "Disk space available: ${DISK_AVAIL}G" echo "" -# Repo necessary for rh-python3 and devtoolset-7 +# Repo necessary for rh-python3 and devtoolset-8 ensure-scl # GCC7 for Centos / Needed for CMAKE install even if we're pinning ensure-devtoolset -if [[ -d /opt/rh/devtoolset-7 ]]; then - echo "${COLOR_CYAN}[Enabling Centos devtoolset-7 (so we can use GCC 7)]${COLOR_NC}" - execute-always source /opt/rh/devtoolset-7/enable - echo " - ${COLOR_GREEN}Centos devtoolset-7 successfully enabled!${COLOR_NC}" +if [[ -d /opt/rh/devtoolset-8 ]]; then + echo "${COLOR_CYAN}[Enabling Centos devtoolset-8 (for newer GCC)]${COLOR_NC}" + execute-always source /opt/rh/devtoolset-8/enable + echo " - ${COLOR_GREEN}Centos devtoolset-8 successfully enabled!${COLOR_NC}" fi # Handle clang/compiler ensure-compiler diff --git a/scripts/helpers/general.sh b/scripts/helpers/general.sh index bc799871b68..b6e8fd57363 100755 --- a/scripts/helpers/general.sh +++ b/scripts/helpers/general.sh @@ -150,16 +150,16 @@ function ensure-scl() { } function ensure-devtoolset() { - echo "${COLOR_CYAN}[Ensuring installation of devtoolset-7 with C++7]${COLOR_NC}" - DEVTOOLSET=$( rpm -qa | grep -E 'devtoolset-7-[0-9].*' || true ) + echo "${COLOR_CYAN}[Ensuring installation of devtoolset-8]${COLOR_NC}" + DEVTOOLSET=$( rpm -qa | grep -E 'devtoolset-8-[0-9].*' || true ) if [[ -z "${DEVTOOLSET}" ]]; then while true; do [[ $NONINTERACTIVE == false ]] && printf "${COLOR_YELLOW}Not Found: Do you wish to install it? (y/n)?${COLOR_NC}" && read -p " " PROCEED echo "" case $PROCEED in "" ) echo "What would you like to do?";; - 0 | true | [Yy]* ) install-package devtoolset-7; break;; - 1 | false | [Nn]* ) echo " - User aborted installation of devtoolset-7."; break;; + 0 | true | [Yy]* ) install-package devtoolset-8; break;; + 1 | false | [Nn]* ) echo " - User aborted installation of devtoolset-8."; break;; * ) echo "Please type 'y' for yes or 'n' for no.";; esac done diff --git a/tests/bash-bats/eosio_build_centos.sh b/tests/bash-bats/eosio_build_centos.sh index 2d18263dbe9..e8fa93c3708 100644 --- a/tests/bash-bats/eosio_build_centos.sh +++ b/tests/bash-bats/eosio_build_centos.sh @@ -25,12 +25,12 @@ export TEST_LABEL="[eosio_build_centos]" set_system_vars # Obtain current machine's resources and set the necessary variables (like JOBS, etc) execute-always yum -y --enablerepo=extras install centos-release-scl &>/dev/null - install-package devtoolset-7 WETRUN &>/dev/null - # Ensure SCL and devtoolset-7 for c++ binary installation + install-package devtoolset-8 WETRUN &>/dev/null + # Ensure SCL and devtoolset-8 for c++ binary installation run bash -c "printf \"y\n%.0s\" {1..100}| ./${SCRIPT_LOCATION}" [[ ! -z $(echo "${output}" | grep "centos-release-scl-2-3.el7.centos.noarch found") ]] || exit - [[ ! -z $(echo "${output}" | grep "devtoolset-7-7.1-4.el7.x86_64 found") ]] || exit - [[ ! -z $(echo "${output}" | grep "Executing: source /opt/rh/devtoolset-7/enable") ]] || exit + [[ ! -z $(echo "${output}" | grep "devtoolset-8-8.0-2.el7.0.1.x86_64 found") ]] || exit + [[ ! -z $(echo "${output}" | grep "Executing: source /opt/rh/devtoolset-8/enable") ]] || exit [[ ! -z $(echo "${output}" | grep "Executing: make -j${JOBS}") ]] || exit [[ ! -z $(echo "${output}" | grep "Starting EOSIO Dependency Install") ]] || exit [[ ! -z $(echo "${output}" | grep "Executing: eval /usr/bin/yum -y update") ]] || exit @@ -42,7 +42,7 @@ export TEST_LABEL="[eosio_build_centos]" [[ ! -z $(echo "${output}" | grep "Starting EOSIO Build") ]] || exit [[ ! -z $(echo "${output}" | grep "make -j${CPU_CORES}") ]] || exit [[ ! -z $(echo "${output}" | grep "EOSIO has been successfully built") ]] || exit - uninstall-package devtoolset-7* WETRUN &>/dev/null + uninstall-package devtoolset-8* WETRUN &>/dev/null uninstall-package centos-release-scl WETRUN &>/dev/null } \ No newline at end of file diff --git a/tests/bash-bats/helpers/functions.sh b/tests/bash-bats/helpers/functions.sh index 6610061d813..f19f6f417c4 100644 --- a/tests/bash-bats/helpers/functions.sh +++ b/tests/bash-bats/helpers/functions.sh @@ -17,11 +17,10 @@ setup-bats-dirs function teardown() { # teardown is run once after each test, even if it fails [[ -d "$HOME" ]] && rm -rf "$HOME" - [[ -d /opt/rh/devtoolset-7 ]] && rm -rf /opt/rh/devtoolset-7 uninstall-package which WETRUN export SUDO_FORCE_REMOVE=yes uninstall-package sudo WETRUN - uninstall-package devtoolset-7* WETRUN + uninstall-package devtoolset-8* WETRUN uninstall-package centos-release-scl uninstall-package gcc-c++ WETRUN uninstall-package build-essential WETRUN From 498768232e9df3e4c5b566d68c6ea6538aade408 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Thu, 20 Jun 2019 14:54:11 -0400 Subject: [PATCH 2/3] install system clang on ubuntu 18 & amz2 Also, make sure that deps are installed before checking if a sufficient compiler is present --- scripts/eosio_build_amazonlinux.sh | 4 ++-- scripts/eosio_build_amazonlinux2_deps | 3 ++- scripts/eosio_build_ubuntu.sh | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/eosio_build_amazonlinux.sh b/scripts/eosio_build_amazonlinux.sh index a8622caad08..8e748c3cd22 100755 --- a/scripts/eosio_build_amazonlinux.sh +++ b/scripts/eosio_build_amazonlinux.sh @@ -14,11 +14,11 @@ fi [[ $MEM_GIG -lt 7 ]] && echo "Your system must have 7 or more Gigabytes of physical memory installed." && exit 1 [[ "${DISK_AVAIL}" -lt "${DISK_MIN}" ]] && echo " - You must have at least ${DISK_MIN}GB of available storage to install EOSIO." && exit 1 -# Handle clang/compiler -ensure-compiler # Ensure packages exist ($PIN_COMPILER && $BUILD_CLANG) && EXTRA_DEPS=(gcc-c++,rpm\ -qa) ensure-yum-packages $DEPS_FILE $(echo ${EXTRA_DEPS[@]}) +# Handle clang/compiler +ensure-compiler # CMAKE Installation ensure-cmake # CLANG Installation diff --git a/scripts/eosio_build_amazonlinux2_deps b/scripts/eosio_build_amazonlinux2_deps index 253958b3102..c599e9b1ae4 100755 --- a/scripts/eosio_build_amazonlinux2_deps +++ b/scripts/eosio_build_amazonlinux2_deps @@ -18,4 +18,5 @@ python3-devel,rpm -qa python-devel,rpm -qa libedit-devel,rpm -qa doxygen,rpm -qa -graphviz,rpm -qa \ No newline at end of file +graphviz,rpm -qa +clang,rpm -qa \ No newline at end of file diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index 2d4d6295e93..0c267b976b4 100755 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -10,15 +10,15 @@ echo "Disk space available: ${DISK_AVAIL}G" [[ $MEM_GIG -lt 7 ]] && echo "Your system must have 7 or more Gigabytes of physical memory installed." && exit 1 [[ "${DISK_AVAIL}" -lt "${DISK_MIN}" ]] && echo " - You must have at least ${DISK_MIN}GB of available storage to install EOSIO." && exit 1 -# C++7 for Ubuntu 18 (16 build-essential has cpp5) -( [[ $PIN_COMPILER == false ]] && [[ "$(echo ${VERSION_ID})" == "18.04" ]] ) && ensure-build-essential -# Handle clang/compiler -ensure-compiler +# system clang and build essential for Ubuntu 18 (16 too old) +( [[ $PIN_COMPILER == false ]] && [[ "$(echo ${VERSION_ID})" == "18.04" ]] ) && ensure-build-essential && EXTRA_DEPS=(clang,dpkg\ -s) # Ensure packages exist -([[ $PIN_COMPILER == false ]] && [[ $BUILD_CLANG == false ]]) && EXTRA_DEPS=(llvm-4.0,dpkg\ -s libclang-4.0-dev,dpkg\ -s) +([[ $PIN_COMPILER == false ]] && [[ $BUILD_CLANG == false ]]) && EXTRA_DEPS+=(llvm-4.0,dpkg\ -s) $ENABLE_COVERAGE_TESTING && EXTRA_DEPS+=(lcov,dpkg\ -s) ensure-apt-packages "${REPO_ROOT}/scripts/eosio_build_ubuntu_deps" $(echo ${EXTRA_DEPS[@]}) echo "" +# Handle clang/compiler +ensure-compiler # CMAKE Installation ensure-cmake # CLANG Installation From 6084ec0bbef27668ad8a9062a7bf0dfc22ff96b3 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Thu, 20 Jun 2019 15:03:30 -0400 Subject: [PATCH 3/3] set clang to default compiler on ubuntu,amz2,macos also bump the minimum version of clang the script looks for to 6.0 (cmake check is left at 5.0 for now still, still that still technically compiles eosio okay) --- scripts/helpers/eosio.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/helpers/eosio.sh b/scripts/helpers/eosio.sh index 98a676ab452..077a4675230 100755 --- a/scripts/helpers/eosio.sh +++ b/scripts/helpers/eosio.sh @@ -121,8 +121,14 @@ function prompt-mongo-install() { } function ensure-compiler() { - export CXX=${CXX:-c++} - export CC=${CC:-cc} + DEFAULT_CXX=clang++ + DEFAULT_CC=clang + if [[ $NAME == "CentOS Linux" ]]; then + DEFAULT_CXX=g++ + DEFAULT_CC=gcc + fi + export CXX=${CXX:-$DEFAULT_CXX} + export CC=${CC:-$DEFAULT_CC} if $PIN_COMPILER || [[ -f $CLANG_ROOT/bin/clang++ ]]; then export PIN_COMPILER=true export BUILD_CLANG=true @@ -141,9 +147,9 @@ function ensure-compiler() { [[ $( $(which $CXX) --version | cut -d ' ' -f 4 | cut -d '.' -f 1 | head -n 1 ) -lt 10 ]] && export NO_CPP17=true else if [[ $( $(which $CXX) --version | cut -d ' ' -f 3 | head -n 1 | cut -d '.' -f1) =~ ^[0-9]+$ ]]; then # Check if the version message cut returns an integer - [[ $( $(which $CXX) --version | cut -d ' ' -f 3 | head -n 1 | cut -d '.' -f1) < 5 ]] && export NO_CPP17=true + [[ $( $(which $CXX) --version | cut -d ' ' -f 3 | head -n 1 | cut -d '.' -f1) < 6 ]] && export NO_CPP17=true elif [[ $(clang --version | cut -d ' ' -f 4 | head -n 1 | cut -d '.' -f1) =~ ^[0-9]+$ ]]; then # Check if the version message cut returns an integer - [[ $( $(which $CXX) --version | cut -d ' ' -f 4 | cut -d '.' -f 1 | head -n 1 ) < 5 ]] && export NO_CPP17=true + [[ $( $(which $CXX) --version | cut -d ' ' -f 4 | cut -d '.' -f 1 | head -n 1 ) < 6 ]] && export NO_CPP17=true fi fi else