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

Commit

Permalink
Merge pull request #7549 from EOSIO/devtoolset8_18x
Browse files Browse the repository at this point in the history
restore usage of devtoolset-8 on centos7 - 1.8
  • Loading branch information
arhag committed Jun 28, 2019
2 parents 97d70ec + ea492bd commit 7aa3e4b
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 21 deletions.
55 changes: 55 additions & 0 deletions scripts/clang-devtoolset8-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
From 32b65345c5760295d04c95e0abb3653fe20ffd16 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Tue, 9 Apr 2019 13:26:10 +0000
Subject: [PATCH] Add support for detection of devtoolset-8

Summary:
The current llvm/clang et al. project can be built with the latest developer toolset (devtoolset-8) on RHEL, which provides GCC 8.2.1.
However, the result compiler will not identify this toolset itself when compiling programs, which is of course not desirable.

After the patch - which simply adds the name of the developer toolset to the existing list - it gets identified and selected, as shown below:

[bamboo@bamboo llvm-project]$ clang -v
clang version 9.0.0 (https://github.com/llvm/llvm-project.git e5ac385fb1ffa4bd3875ea6a4d24efdbd7814572)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/bamboo/llvm/bin
Found candidate GCC installation: /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1
Found candidate GCC installation: /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Found candidate GCC installation: /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

Patch By: Radu-Adrian Popescu

Reviewers: tstellar, fedor.sergeev

Reviewed By: tstellar

Subscribers: jdoerfert, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D59987

llvm-svn: 358002
---
clang/lib/Driver/ToolChains/Gnu.cpp | 1 +
1 file changed, 1 insertion(+)

diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 2a58f0f7142..8915e3f948f 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -1875,6 +1875,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
// Non-Solaris is much simpler - most systems just go with "/usr".
if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux) {
// Yet, still look for RHEL devtoolsets.
+ Prefixes.push_back("/opt/rh/devtoolset-8/root/usr");
Prefixes.push_back("/opt/rh/devtoolset-7/root/usr");
Prefixes.push_back("/opt/rh/devtoolset-6/root/usr");
Prefixes.push_back("/opt/rh/devtoolset-4/root/usr");
3 changes: 2 additions & 1 deletion scripts/eosio_build_amazonlinux2_deps
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ python-devel,rpm -qa
libedit-devel,rpm -qa
doxygen,rpm -qa
graphviz,rpm -qa
clang,rpm -qa
clang,rpm -qa
patch,rpm -qa
12 changes: 6 additions & 6 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
# GCC8 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 (so we can use GCC 8)]${COLOR_NC}"
execute-always source /opt/rh/devtoolset-8/enable
echo " - ${COLOR_GREEN}Centos devtoolset-8 successfully enabled!${COLOR_NC}"
fi
# Ensure packages exist
ensure-yum-packages "${REPO_ROOT}/scripts/eosio_build_centos7_deps"
Expand Down
3 changes: 2 additions & 1 deletion scripts/eosio_build_centos7_deps
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ rh-python36,rpm -qa
gettext-devel,rpm -qa
file,rpm -qa
libusbx-devel,rpm -qa
libcurl-devel,rpm -qa
libcurl-devel,rpm -qa
patch,rpm -qa
3 changes: 2 additions & 1 deletion scripts/eosio_build_ubuntu_deps
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ sudo,dpkg -s
ruby,dpkg -s
libusb-1.0-0-dev,dpkg -s
libcurl4-gnutls-dev,dpkg -s
pkg-config,dpkg -s
pkg-config,dpkg -s
patch,dpkg -s
5 changes: 3 additions & 2 deletions scripts/helpers/eosio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,10 @@ function build-clang() {
&& cd lld && git checkout $PINNED_COMPILER_LLD_COMMIT && cd ../ \
&& git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/polly.git \
&& cd polly && git checkout $PINNED_COMPILER_POLLY_COMMIT && cd ../ \
&& git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/clang.git clang && cd clang/tools \
&& git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/clang.git clang && cd clang \
&& git checkout $PINNED_COMPILER_CLANG_COMMIT \
&& mkdir extra && cd extra \
&& patch -p2 < \"$REPO_ROOT/scripts/clang-devtoolset8-support.patch\" \
&& cd tools && mkdir extra && cd extra \
&& git clone --single-branch --branch $PINNED_COMPILER_BRANCH https://git.llvm.org/git/clang-tools-extra.git \
&& cd clang-tools-extra && git checkout $PINNED_COMPILER_CLANG_TOOLS_EXTRA_COMMIT && cd .. \
&& cd ../../../../projects \
Expand Down
8 changes: 4 additions & 4 deletions scripts/helpers/general.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,16 @@ function ensure-scl() {
}

function ensure-devtoolset() {
echo "${COLOR_CYAN}[Ensuring installation of devtoolset-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} -i /NEWPATH"
[[ ! -z $(echo "${output}" | grep "centos-release-scl-2-3.el7.centos.noarch found") ]] || exit
[[ ! -z $(echo "${output}" | grep "devtoolset-7.* found") ]] || exit
[[ ! -z $(echo "${output}" | grep "Executing: source /opt/rh/devtoolset-7/enable") ]] || exit
[[ ! -z $(echo "${output}" | grep "devtoolset-8.* 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 @@ -41,6 +41,6 @@ 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
}
2 changes: 1 addition & 1 deletion tests/bash-bats/helpers/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function teardown() { # teardown is run once after each test, even if it fails
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
if [[ $NAME == 'Ubuntu' ]]; then
Expand Down

0 comments on commit 7aa3e4b

Please sign in to comment.