Skip to content

Commit da66b58

Browse files
authored
[GLUTEN-7458][VL] Upgrade to GCC-11 for centos-7/8 and ubuntu-20.04 (#7578)
1 parent b1741c6 commit da66b58

17 files changed

+75
-102
lines changed

.github/workflows/build_bundle_package.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
yum install sudo patch java-1.8.0-openjdk-devel -y && \
5050
cd $GITHUB_WORKSPACE/ep/build-velox/src && \
5151
./get_velox.sh && \
52-
source /opt/rh/devtoolset-9/enable && \
52+
source /opt/rh/devtoolset-11/enable && \
5353
cd $GITHUB_WORKSPACE/ && \
5454
export NUM_THREADS=4
5555
./dev/builddeps-veloxbe.sh --enable_vcpkg=ON --build_tests=OFF --build_benchmarks=OFF --enable_s3=OFF \

.github/workflows/velox_weekly.yml

+11-2
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ jobs:
5555
-e 's/^#baseurl/baseurl/' \
5656
-e 's/mirror\.centos\.org/vault.centos.org/' \
5757
/etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
58+
yum install -y devtoolset-11
59+
source /opt/rh/devtoolset-11/enable
5860
elif [ "${{ matrix.os }}" = "quay.io/centos/centos:stream9" ]; then
5961
dnf install -y --setopt=install_weak_deps=False gcc-toolset-12
6062
source /opt/rh/gcc-toolset-12/enable || exit 1
6163
else
62-
dnf install -y --setopt=install_weak_deps=False gcc-toolset-9
63-
source /opt/rh/gcc-toolset-9/enable || exit 1
64+
dnf install -y --setopt=install_weak_deps=False gcc-toolset-11
65+
source /opt/rh/gcc-toolset-11/enable || exit 1
6466
fi
6567
yum install -y java-1.8.0-openjdk-devel patch wget git perl
6668
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk && \
@@ -87,6 +89,13 @@ jobs:
8789
# To avoid the prompt for region selection during installing tzdata.
8890
export DEBIAN_FRONTEND=noninteractive
8991
apt-get update && apt-get install -y sudo maven wget git
92+
if [ "${{ matrix.os }}" = "ubuntu:20.04" ]; then
93+
sudo apt install -y software-properties-common
94+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
95+
sudo apt update && sudo apt install -y gcc-11 g++-11
96+
sudo ln -sf /usr/bin/gcc-11 /usr/bin/gcc
97+
sudo ln -sf /usr/bin/g++-11 /usr/bin/g++
98+
fi
9099
sudo apt-get install -y openjdk-8-jdk
91100
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
92101
cd $GITHUB_WORKSPACE/ && ./dev/package.sh

dev/build_helper_functions.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function setup_linux {
165165
$GLUTEN_VELOX_SCRIPT_HOME/setup-centos7.sh
166166
set +u
167167
export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH
168-
source /opt/rh/devtoolset-9/enable
168+
source /opt/rh/devtoolset-11/enable
169169
set -u
170170
;;
171171
*)
@@ -179,7 +179,7 @@ function setup_linux {
179179
$GLUTEN_VELOX_SCRIPT_HOME/setup-centos7.sh
180180
set +u
181181
export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH
182-
source /opt/rh/devtoolset-9/enable
182+
source /opt/rh/devtoolset-11/enable
183183
set -u
184184
;;
185185
3) $GLUTEN_VELOX_SCRIPT_HOME/setup-centos8.sh ;;
@@ -194,7 +194,7 @@ function setup_linux {
194194
$GLUTEN_VELOX_SCRIPT_HOME/setup-centos7.sh
195195
set +u
196196
export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH
197-
source /opt/rh/devtoolset-9/enable
197+
source /opt/rh/devtoolset-11/enable
198198
set -u
199199
;;
200200
3.2) $GLUTEN_VELOX_SCRIPT_HOME/setup-centos8.sh ;;

dev/ci-velox-buildshared-centos-8.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -e
44

5-
source /opt/rh/gcc-toolset-9/enable
5+
# TODO: will be removed after docker is updated.
6+
dnf install -y --setopt=install_weak_deps=False gcc-toolset-11
7+
source /opt/rh/gcc-toolset-11/enable
68
./dev/builddeps-veloxbe.sh --run_setup_script=OFF --build_arrow=OFF --enable_ep_cache=OFF --build_tests=ON \
79
--build_examples=ON --build_benchmarks=ON

dev/ci-velox-buildstatic-centos-7.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
set -e
44

5-
source /opt/rh/devtoolset-9/enable
5+
# TODO: will be removed after docker is updated.
6+
sudo yum install -y devtoolset-11
7+
source /opt/rh/devtoolset-11/enable
68
export NUM_THREADS=4
79
./dev/builddeps-veloxbe.sh --enable_vcpkg=ON --build_arrow=OFF --build_tests=OFF --build_benchmarks=OFF \
810
--build_examples=OFF --enable_s3=ON --enable_gcs=ON --enable_hdfs=ON --enable_abfs=ON

dev/docker/Dockerfile.centos7-static-build

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN sed -i \
1111
-e 's/mirror\.centos\.org/vault.centos.org/' \
1212
/etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
1313

14-
RUN yum install -y git patch wget sudo java-1.8.0-openjdk-devel
14+
RUN yum install -y git patch wget sudo java-1.8.0-openjdk-devel ccache
1515

1616
RUN git clone --depth=1 https://github.com/apache/incubator-gluten /opt/gluten
1717

@@ -26,7 +26,7 @@ RUN mkdir -p /var/cache/vcpkg
2626
ENV VCPKG_BINARY_SOURCES=clear;files,/var/cache/vcpkg,readwrite
2727

2828
# Build arrow, then install the native libs to system paths and jar package to .m2/ directory.
29-
RUN cd /opt/gluten && source /opt/rh/devtoolset-9/enable && \
29+
RUN cd /opt/gluten && source /opt/rh/devtoolset-11/enable && \
3030
bash ./dev/builddeps-veloxbe.sh --enable_vcpkg=ON --build_tests=ON --enable_s3=ON --enable_gcs=ON \
3131
--enable_hdfs=ON --enable_abfs=ON build_arrow && \
3232
rm -rf /opt/gluten

dev/docker/Dockerfile.centos8-dynamic-build

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ FROM centos:8
33
RUN sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-* || true
44
RUN sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-* || true
55

6-
RUN yum update -y && yum install -y epel-release sudo dnf
7-
RUN dnf install -y --setopt=install_weak_deps=False gcc-toolset-9
6+
RUN yum update -y && yum install -y epel-release sudo dnf ccache
7+
RUN dnf install -y --setopt=install_weak_deps=False gcc-toolset-11
88
RUN echo "check_certificate = off" >> ~/.wgetrc
99

1010
RUN yum install -y java-1.8.0-openjdk-devel patch wget git perl
@@ -17,4 +17,4 @@ ENV PATH=${PATH}:/usr/lib/maven/bin
1717

1818
RUN git clone --depth=1 https://github.com/apache/incubator-gluten /opt/gluten
1919

20-
RUN cd /opt/gluten && source /opt/rh/gcc-toolset-9/enable && ./dev/builddeps-veloxbe.sh --run_setup_script=ON build_arrow && rm -rf /opt/gluten
20+
RUN cd /opt/gluten && source /opt/rh/gcc-toolset-11/enable && ./dev/builddeps-veloxbe.sh --run_setup_script=ON build_arrow && rm -rf /opt/gluten

dev/docker/entrypoint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#! /bin/sh
22

3-
. /opt/rh/devtoolset-9/enable
3+
. /opt/rh/devtoolset-11/enable
44
exec "$@"

dev/package-vcpkg.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ ARCH=`uname -m`
1111
cd "$GLUTEN_DIR"
1212
if [ "$LINUX_OS" == "centos" ]; then
1313
if [ "$VERSION" == "8" ]; then
14-
source /opt/rh/gcc-toolset-9/enable
14+
source /opt/rh/gcc-toolset-11/enable
1515
elif [ "$VERSION" == "7" ]; then
1616
export MANPATH=""
17-
source /opt/rh/devtoolset-9/enable
17+
source /opt/rh/devtoolset-11/enable
1818
fi
1919
fi
2020

dev/vcpkg/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ Please install build depends on your system to compile all libraries:
1515
sudo $GLUTEN_REPO/dev/vcpkg/setup-build-depends.sh
1616
```
1717

18-
For CentOS user, gcc 9 needs to be enabled manually before next step:
18+
For CentOS user, gcc 11 needs to be enabled manually before next step:
1919

2020
``` sh
2121
# CentOS 8
22-
source /opt/rh/gcc-toolset-9/enable
22+
source /opt/rh/gcc-toolset-11/enable
2323

2424
# CentOS 7
25-
source /opt/rh/devtoolset-9/enable
25+
source /opt/rh/devtoolset-11/enable
2626
```
2727

2828
For unsupported linux distro, you can install the following packages from package manager.

dev/vcpkg/setup-build-depends.sh

+13-56
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,17 @@ install_maven_from_source() {
2626
fi
2727
}
2828

29-
install_gcc9_from_source() {
29+
install_gcc11_from_source() {
3030
cur_gcc_version=$(gcc -dumpversion)
31-
if [ "$(semver "$cur_gcc_version")" -lt "$(semver 9.0.0)" ]; then
32-
gcc_version=gcc-9.4.0
31+
if [ "$(semver "$cur_gcc_version")" -lt "$(semver 11.0.0)" ]; then
32+
gcc_version=gcc-11.5.0
3333
gcc_install_dir=/usr/local/${gcc_version}
3434
cd /tmp
3535
if [ ! -d $gcc_version ]; then
3636
wget https://ftp.gnu.org/gnu/gcc/${gcc_version}/${gcc_version}.tar.gz
3737
tar -xvf ${gcc_version}.tar.gz
3838
fi
3939
cd ${gcc_version}
40-
sed -i 's/ftp/https/g' contrib/download_prerequisites
4140
./contrib/download_prerequisites
4241

4342
mkdir gcc-build && cd gcc-build
@@ -68,7 +67,7 @@ install_centos_7() {
6867
yum -y install \
6968
wget curl tar zip unzip which patch sudo \
7069
ninja-build perl-IPC-Cmd autoconf autoconf-archive automake libtool \
71-
devtoolset-9 python3 pip dnf \
70+
devtoolset-11 python3 pip dnf \
7271
bison \
7372
java-1.8.0-openjdk java-1.8.0-openjdk-devel
7473

@@ -126,7 +125,7 @@ install_centos_8() {
126125
yum -y install \
127126
wget curl tar zip unzip git which sudo patch \
128127
cmake perl-IPC-Cmd autoconf automake libtool \
129-
gcc-toolset-9-gcc gcc-toolset-9-gcc-c++ \
128+
gcc-toolset-11 \
130129
flex bison python3 \
131130
java-1.8.0-openjdk java-1.8.0-openjdk-devel
132131

@@ -135,60 +134,18 @@ install_centos_8() {
135134
install_maven_from_source
136135
}
137136

138-
install_ubuntu_18.04() {
139-
# Support for gcc-9 and g++-9
140-
apt-get update && apt-get install -y software-properties-common
141-
add-apt-repository -y ppa:ubuntu-toolchain-r/test
142-
143-
apt-get -y install \
144-
wget curl tar zip unzip git \
145-
build-essential ccache ninja-build pkg-config autoconf autoconf-archive libtool \
146-
flex bison \
147-
openjdk-8-jdk \
148-
gcc-9 g++-9
149-
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 900 --slave /usr/bin/g++ g++ /usr/bin/g++-9
150-
151-
# Install cmake 3.28.1 from source
152-
apt remove -y --purge --auto-remove cmake
153-
apt-get install -y libssl-dev
154-
155-
version=3.28
156-
build=1
157-
mkdir cmake_install
158-
cd cmake_install
159-
wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
160-
tar -xzvf cmake-$version.$build.tar.gz
161-
cd cmake-$version.$build/
162-
163-
./bootstrap
164-
make -j$(nproc)
165-
make install
166-
167-
cd ../../
168-
rm -rf cmake_install
169-
ln -fs /usr/local/bin/cmake /usr/bin/cmake
170-
171-
# Install automake 1.16
172-
mkdir -p /tmp/automake
173-
wget -O - http://ftp.gnu.org/gnu/automake/automake-1.16.5.tar.xz | tar -x --xz -C /tmp/automake --strip-components=1
174-
cd /tmp/automake
175-
./configure
176-
make install -j
177-
cd
178-
rm -rf /tmp/automake
179-
180-
# Fix aclocal search path
181-
echo /usr/share/aclocal > /usr/local/share/aclocal/dirlist
182-
183-
install_maven_from_source
184-
}
185-
186137
install_ubuntu_20.04() {
187138
apt-get update && apt-get -y install \
188139
wget curl tar zip unzip git \
189140
build-essential ccache cmake ninja-build pkg-config autoconf autoconf-archive libtool \
190141
flex bison \
191142
openjdk-8-jdk maven
143+
# Overwrite gcc-9 installed by build-essential.
144+
sudo apt install -y software-properties-common
145+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
146+
sudo apt update && sudo apt install -y gcc-11 g++-11
147+
sudo ln -sf /usr/bin/gcc-11 /usr/bin/gcc
148+
sudo ln -sf /usr/bin/g++-11 /usr/bin/g++
192149
}
193150

194151
install_ubuntu_22.04() { install_ubuntu_20.04; }
@@ -206,7 +163,7 @@ install_tencentos_3.2() {
206163
yum -y install \
207164
wget curl tar zip unzip git which \
208165
cmake ninja-build perl-IPC-Cmd autoconf autoconf-archive automake libtool \
209-
gcc-toolset-9-gcc gcc-toolset-9-gcc-c++ \
166+
gcc-toolset-11 \
210167
flex bison python3 \
211168
java-8-konajdk
212169

@@ -229,7 +186,7 @@ install_debian_10() {
229186
apt update && apt-get -y install temurin-8-jdk
230187

231188
install_maven_from_source
232-
install_gcc9_from_source
189+
install_gcc11_from_source
233190
}
234191

235192
install_debian_11() {

ep/build-velox/src/get_velox.sh

+15-4
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ function process_setup_ubuntu {
6969
# Do not install libunwind which can cause interruption when catching native exception.
7070
ensure_pattern_matched '\${SUDO} apt install -y libunwind-dev' scripts/setup-ubuntu.sh
7171
sed -i 's/${SUDO} apt install -y libunwind-dev//' scripts/setup-ubuntu.sh
72+
# Overwrite gcc installed by build-essential.
73+
ensure_pattern_matched '\${SUDO} pip3 install cmake==3.28.3' scripts/setup-ubuntu.sh
74+
sed -i '/^ ${SUDO} pip3 install cmake==3.28.3/a\
75+
\VERSION=`cat /etc/os-release | grep VERSION_ID`\
76+
if [[ $VERSION =~ "20.04" ]]; then\
77+
sudo apt install -y software-properties-common\
78+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test\
79+
sudo apt update && sudo apt install -y gcc-11 g++-11\
80+
sudo ln -sf /usr/bin/gcc-11 /usr/bin/gcc\
81+
sudo ln -sf /usr/bin/g++-11 /usr/bin/g++\
82+
fi' scripts/setup-ubuntu.sh
7283
ensure_pattern_matched 'ccache' scripts/setup-ubuntu.sh
7384
sed -i '/ccache/a\ *thrift* \\' scripts/setup-ubuntu.sh
7485
sed -i '/ccache/a\ libiberty-dev \\' scripts/setup-ubuntu.sh
@@ -121,10 +132,10 @@ function process_setup_alinux3 {
121132
sed -i "s/.*dnf_install epel-release/#&/" ${CURRENT_DIR}/setup-centos8.sh
122133
sed -i "s/.*run_and_time install_conda/#&/" ${CURRENT_DIR}/setup-centos8.sh
123134
sed -i "s/.*dnf config-manager --set-enabled powertools/#&/" ${CURRENT_DIR}/setup-centos8.sh
124-
sed -i "s/gcc-toolset-9 //" ${CURRENT_DIR}/setup-centos8.sh
125-
sed -i "s/.*source \/opt\/rh\/gcc-toolset-9\/enable/#&/" ${CURRENT_DIR}/setup-centos8.sh
126-
sed -i 's|^export CC=/opt/rh/gcc-toolset-9/root/bin/gcc|# &|' ${CURRENT_DIR}/setup-centos8.sh
127-
sed -i 's|^export CXX=/opt/rh/gcc-toolset-9/root/bin/g++|# &|' ${CURRENT_DIR}/setup-centos8.sh
135+
sed -i "s/gcc-toolset-11 //" ${CURRENT_DIR}/setup-centos8.sh
136+
sed -i "s/.*source \/opt\/rh\/gcc-toolset-11\/enable/#&/" ${CURRENT_DIR}/setup-centos8.sh
137+
sed -i 's|^export CC=/opt/rh/gcc-toolset-11/root/bin/gcc|# &|' ${CURRENT_DIR}/setup-centos8.sh
138+
sed -i 's|^export CXX=/opt/rh/gcc-toolset-11/root/bin/g++|# &|' ${CURRENT_DIR}/setup-centos8.sh
128139
sed -i 's/python39 python39-devel python39-pip //g' ${CURRENT_DIR}/setup-centos8.sh
129140
sed -i "s/.*pip.* install/#&/" ${CURRENT_DIR}/setup-centos8.sh
130141
}

ep/build-velox/src/setup-centos7.sh

+3-11
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ function install_lzo {
157157

158158
function install_boost {
159159
# Remove old version.
160-
sudo rm -f /usr/local/lib/libboost_* /usr/lib64/libboost_* /opt/rh/devtoolset-9/root/usr/lib64/dyninst/libboost_*
160+
sudo rm -f /usr/local/lib/libboost_* /usr/lib64/libboost_* /opt/rh/devtoolset-11/root/usr/lib64/dyninst/libboost_*
161161
sudo rm -rf /tmp/velox-deps/boost/ /usr/local/include/boost/ /usr/local/lib/cmake/Boost-1.72.0/
162162
cd "${DEPENDENCY_DIR}"
163163
wget_and_untar https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.gz boost
@@ -239,8 +239,6 @@ $SUDO dnf makecache
239239

240240
# dnf install dependency libraries
241241
dnf_install epel-release dnf-plugins-core # For ccache, ninja
242-
# PowerTools only works on CentOS8
243-
# dnf config-manager --set-enabled powertools
244242
dnf_install ccache wget which libevent-devel \
245243
yasm \
246244
openssl-devel libzstd-devel lz4-devel double-conversion-devel \
@@ -254,16 +252,10 @@ dnf_install autoconf automake libtool bison python3 python3-devel
254252
# Required for build flex
255253
dnf_install gettext-devel texinfo help2man
256254

257-
# dnf_install conda
258-
259-
# Activate gcc9; enable errors on unset variables afterwards.
260-
# GCC9 install via yum and devtoolset
261-
# dnf install gcc-toolset-9 only works on CentOS8
262-
263255
$SUDO yum makecache
264256
yum_install centos-release-scl
265-
yum_install devtoolset-9
266-
source /opt/rh/devtoolset-9/enable || exit 1
257+
yum_install devtoolset-11
258+
source /opt/rh/devtoolset-11/enable || exit 1
267259
gcc --version
268260
set -u
269261

ep/build-velox/src/setup-centos8.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export CXXFLAGS=$CFLAGS # Used by boost.
3838
export CPPFLAGS=$CFLAGS # Used by LZO.
3939
CMAKE_BUILD_TYPE="${BUILD_TYPE:-Release}"
4040
BUILD_DUCKDB="${BUILD_DUCKDB:-true}"
41-
export CC=/opt/rh/gcc-toolset-9/root/bin/gcc
42-
export CXX=/opt/rh/gcc-toolset-9/root/bin/g++
41+
export CC=/opt/rh/gcc-toolset-11/root/bin/gcc
42+
export CXX=/opt/rh/gcc-toolset-11/root/bin/g++
4343
DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)/deps-download}
4444

4545
FB_OS_VERSION="v2024.05.20.00"
@@ -56,7 +56,7 @@ function install_build_prerequisites {
5656
dnf_install epel-release dnf-plugins-core # For ccache, ninja
5757
dnf config-manager --set-enabled powertools
5858
dnf update -y
59-
dnf_install ninja-build curl ccache gcc-toolset-9 git wget which
59+
dnf_install ninja-build curl ccache gcc-toolset-11 git wget which
6060
dnf_install yasm
6161
dnf_install autoconf automake python39 python39-devel python39-pip libtool
6262
pip3.9 install cmake==3.28.3
@@ -198,8 +198,8 @@ function install_velox_deps {
198198

199199
(
200200
if [[ $# -ne 0 ]]; then
201-
# Activate gcc9; enable errors on unset variables afterwards.
202-
source /opt/rh/gcc-toolset-9/enable || exit 1
201+
# Activate gcc11; enable errors on unset variables afterwards.
202+
source /opt/rh/gcc-toolset-11/enable || exit 1
203203
set -u
204204
for cmd in "$@"; do
205205
run_and_time "${cmd}"
@@ -212,8 +212,8 @@ function install_velox_deps {
212212
else
213213
echo "Skipping installation of build dependencies since INSTALL_PREREQUISITES is not set"
214214
fi
215-
# Activate gcc9; enable errors on unset variables afterwards.
216-
source /opt/rh/gcc-toolset-9/enable || exit 1
215+
# Activate gcc11; enable errors on unset variables afterwards.
216+
source /opt/rh/gcc-toolset-11/enable || exit 1
217217
set -u
218218
install_velox_deps
219219
echo "All dependencies for Velox installed!"

0 commit comments

Comments
 (0)