Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

on supported platforms build with system clang by default #7516

Merged
merged 3 commits into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/eosio_build_amazonlinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion scripts/eosio_build_amazonlinux2_deps
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ python3-devel,rpm -qa
python-devel,rpm -qa
libedit-devel,rpm -qa
doxygen,rpm -qa
graphviz,rpm -qa
graphviz,rpm -qa
clang,rpm -qa
10 changes: 5 additions & 5 deletions scripts/eosio_build_centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions scripts/eosio_build_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions scripts/helpers/eosio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions scripts/helpers/general.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions tests/bash-bats/eosio_build_centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

}
3 changes: 1 addition & 2 deletions tests/bash-bats/helpers/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ 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
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
Expand Down