Skip to content

Commit 5bcc708

Browse files
rootglutenperfbot
authored andcommitted
Add setup script for cent7 (oap 408)
1 parent b4ab137 commit 5bcc708

File tree

1 file changed

+272
-0
lines changed

1 file changed

+272
-0
lines changed

scripts/setup-centos7.sh

Lines changed: 272 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,272 @@
1+
#!/bin/bash
2+
# Copyright (c) Facebook, Inc. and its affiliates.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -efx -o pipefail
17+
# Some of the packages must be build with the same compiler flags
18+
# so that some low level types are the same size. Also, disable warnings.
19+
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
20+
source $SCRIPTDIR/setup-helper-functions.sh
21+
DEPENDENCY_DIR=${DEPENDENCY_DIR:-/tmp/velox-deps}
22+
CPU_TARGET="${CPU_TARGET:-avx}"
23+
NPROC=$(getconf _NPROCESSORS_ONLN)
24+
FMT_VERSION=10.1.1
25+
export CFLAGS=$(get_cxx_flags $CPU_TARGET) # Used by LZO.
26+
export CXXFLAGS=$CFLAGS # Used by boost.
27+
export CPPFLAGS=$CFLAGS # Used by LZO.
28+
export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH
29+
FB_OS_VERSION=v2024.02.26.00
30+
31+
# shellcheck disable=SC2037
32+
SUDO="sudo -E"
33+
34+
function run_and_time {
35+
time "$@"
36+
{ echo "+ Finished running $*"; } 2> /dev/null
37+
}
38+
39+
function dnf_install {
40+
$SUDO dnf install -y -q --setopt=install_weak_deps=False "$@"
41+
}
42+
43+
function yum_install {
44+
$SUDO yum install -y "$@"
45+
}
46+
47+
function wget_and_untar {
48+
local URL=$1
49+
local DIR=$2
50+
mkdir -p "${DIR}"
51+
wget -q --max-redirect 3 -O - "${URL}" | tar -xz -C "${DIR}" --strip-components=1
52+
}
53+
54+
function install_cmake {
55+
cd "${DEPENDENCY_DIR}"
56+
wget_and_untar https://cmake.org/files/v3.25/cmake-3.25.1.tar.gz cmake-3
57+
cd cmake-3
58+
./bootstrap --prefix=/usr/local
59+
make -j$(nproc)
60+
$SUDO make install
61+
cmake --version
62+
}
63+
64+
function install_ninja {
65+
cd "${DEPENDENCY_DIR}"
66+
github_checkout ninja-build/ninja v1.11.1
67+
./configure.py --bootstrap
68+
cmake -Bbuild-cmake
69+
cmake --build build-cmake
70+
$SUDO cp ninja /usr/local/bin/
71+
}
72+
73+
function install_folly {
74+
cd "${DEPENDENCY_DIR}"
75+
github_checkout facebook/folly "${FB_OS_VERSION}"
76+
cmake_install -DBUILD_TESTS=OFF -DFOLLY_HAVE_INT128_T=ON
77+
}
78+
79+
function install_conda {
80+
cd "${DEPENDENCY_DIR}"
81+
mkdir -p conda && cd conda
82+
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
83+
MINICONDA_PATH=/opt/miniconda-for-velox
84+
bash Miniconda3-latest-Linux-x86_64.sh -b -u $MINICONDA_PATH
85+
}
86+
87+
function install_openssl {
88+
cd "${DEPENDENCY_DIR}"
89+
wget_and_untar https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1s.tar.gz openssl
90+
cd openssl
91+
./config no-shared
92+
make depend
93+
make
94+
$SUDO make install
95+
}
96+
97+
function install_gflags {
98+
cd "${DEPENDENCY_DIR}"
99+
wget_and_untar https://github.com/gflags/gflags/archive/v2.2.2.tar.gz gflags
100+
cd gflags
101+
cmake_install -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DBUILD_gflags_LIB=ON -DLIB_SUFFIX=64 -DCMAKE_INSTALL_PREFIX:PATH=/usr/local
102+
}
103+
104+
function install_glog {
105+
cd "${DEPENDENCY_DIR}"
106+
wget_and_untar https://github.com/google/glog/archive/v0.5.0.tar.gz glog
107+
cd glog
108+
cmake_install -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr/local
109+
}
110+
111+
function install_snappy {
112+
cd "${DEPENDENCY_DIR}"
113+
wget_and_untar https://github.com/google/snappy/archive/1.1.8.tar.gz snappy
114+
cd snappy
115+
cmake_install -DSNAPPY_BUILD_TESTS=OFF
116+
}
117+
118+
function install_dwarf {
119+
cd "${DEPENDENCY_DIR}"
120+
wget_and_untar https://github.com/davea42/libdwarf-code/archive/refs/tags/20210528.tar.gz dwarf
121+
cd dwarf
122+
#local URL=https://github.com/davea42/libdwarf-code/releases/download/v0.5.0/libdwarf-0.5.0.tar.xz
123+
#local DIR=dwarf
124+
#mkdir -p "${DIR}"
125+
#wget -q --max-redirect 3 "${URL}"
126+
#tar -xf libdwarf-0.5.0.tar.xz -C "${DIR}"
127+
#cd dwarf/libdwarf-0.5.0
128+
./configure --enable-shared=no
129+
make
130+
make check
131+
$SUDO make install
132+
}
133+
134+
function install_re2 {
135+
cd "${DEPENDENCY_DIR}"
136+
wget_and_untar https://github.com/google/re2/archive/refs/tags/2023-03-01.tar.gz re2
137+
cd re2
138+
$SUDO make install
139+
}
140+
141+
function install_flex {
142+
cd "${DEPENDENCY_DIR}"
143+
wget_and_untar https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz flex
144+
cd flex
145+
./autogen.sh
146+
./configure
147+
$SUDO make install
148+
}
149+
150+
function install_lzo {
151+
cd "${DEPENDENCY_DIR}"
152+
wget_and_untar http://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz lzo
153+
cd lzo
154+
./configure --prefix=/usr/local --enable-shared --disable-static --docdir=/usr/local/share/doc/lzo-2.10
155+
make "-j$(nproc)"
156+
$SUDO make install
157+
}
158+
159+
function install_boost {
160+
# Remove old version.
161+
sudo rm -f /usr/local/lib/libboost_* /usr/lib64/libboost_* /opt/rh/devtoolset-9/root/usr/lib64/dyninst/libboost_*
162+
sudo rm -rf /tmp/velox-deps/boost/ /usr/local/include/boost/ /usr/local/lib/cmake/Boost-1.72.0/
163+
cd "${DEPENDENCY_DIR}"
164+
wget_and_untar https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.gz boost
165+
cd boost
166+
./bootstrap.sh --prefix=/usr/local --with-python=/usr/bin/python3 --with-python-root=/usr/lib/python3.6 --without-libraries=python
167+
$SUDO ./b2 "-j$(nproc)" -d0 install threading=multi
168+
}
169+
170+
function install_libhdfs3 {
171+
cd "${DEPENDENCY_DIR}"
172+
github_checkout apache/hawq master
173+
cd depends/libhdfs3
174+
sed -i "/FIND_PACKAGE(GoogleTest REQUIRED)/d" ./CMakeLists.txt
175+
sed -i "s/dumpversion/dumpfullversion/" ./CMake/Platform.cmake
176+
sed -i "s/dfs.domain.socket.path\", \"\"/dfs.domain.socket.path\", \"\/var\/lib\/hadoop-hdfs\/dn_socket\"/g" src/common/SessionConfig.cpp
177+
sed -i "s/pos < endOfCurBlock/pos \< endOfCurBlock \&\& pos \- cursor \<\= 128 \* 1024/g" src/client/InputStreamImpl.cpp
178+
cmake_install
179+
}
180+
181+
function install_protobuf {
182+
cd "${DEPENDENCY_DIR}"
183+
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protobuf-all-21.4.tar.gz
184+
tar -xzf protobuf-all-21.4.tar.gz
185+
cd protobuf-21.4
186+
./configure CXXFLAGS="-fPIC" --prefix=/usr/local
187+
make "-j$(nproc)"
188+
$SUDO make install
189+
}
190+
191+
function install_awssdk {
192+
cd "${DEPENDENCY_DIR}"
193+
github_checkout aws/aws-sdk-cpp 1.9.379 --depth 1 --recurse-submodules
194+
cmake_install -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DMINIMIZE_SIZE:BOOL=ON -DENABLE_TESTING:BOOL=OFF -DBUILD_ONLY:STRING="s3;identity-management"
195+
}
196+
197+
function install_gtest {
198+
cd "${DEPENDENCY_DIR}"
199+
wget https://github.com/google/googletest/archive/refs/tags/release-1.12.1.tar.gz
200+
tar -xzf release-1.12.1.tar.gz
201+
cd googletest-release-1.12.1
202+
mkdir -p build && cd build && cmake -DBUILD_GTEST=ON -DBUILD_GMOCK=ON -DINSTALL_GTEST=ON -DINSTALL_GMOCK=ON -DBUILD_SHARED_LIBS=ON ..
203+
make "-j$(nproc)"
204+
$SUDO make install
205+
}
206+
207+
function install_fmt {
208+
rm -rf /usr/local/lib64/libfmt.a
209+
rm -rf /usr/local/lib64/cmake/fmt
210+
rm -rf /usr/local/include/fmt
211+
rm -rf fmt
212+
wget_and_untar https://github.com/fmtlib/fmt/archive/10.1.1.tar.gz fmt
213+
cmake_install fmt -DFMT_TEST=OFF
214+
}
215+
216+
function install_prerequisites {
217+
run_and_time install_lzo
218+
run_and_time install_boost
219+
run_and_time install_re2
220+
run_and_time install_flex
221+
run_and_time install_openssl
222+
run_and_time install_gflags
223+
run_and_time install_glog
224+
run_and_time install_snappy
225+
run_and_time install_dwarf
226+
}
227+
228+
function install_velox_deps {
229+
run_and_time install_fmt
230+
run_and_time install_folly
231+
run_and_time install_conda
232+
}
233+
234+
$SUDO dnf makecache
235+
236+
# dnf install dependency libraries
237+
dnf_install epel-release dnf-plugins-core # For ccache, ninja
238+
# PowerTools only works on CentOS8
239+
# dnf config-manager --set-enabled powertools
240+
dnf_install ccache git wget which libevent-devel \
241+
openssl-devel libzstd-devel lz4-devel double-conversion-devel \
242+
curl-devel libxml2-devel libgsasl-devel libuuid-devel patch
243+
244+
$SUDO dnf remove -y gflags
245+
246+
# Required for Thrift
247+
dnf_install autoconf automake libtool bison python3 python3-devel
248+
249+
# Required for build flex
250+
dnf_install gettext-devel texinfo help2man
251+
252+
# dnf_install conda
253+
254+
# Activate gcc9; enable errors on unset variables afterwards.
255+
# GCC9 install via yum and devtoolset
256+
# dnf install gcc-toolset-9 only works on CentOS8
257+
258+
$SUDO yum makecache
259+
yum_install centos-release-scl
260+
yum_install devtoolset-9
261+
source /opt/rh/devtoolset-9/enable || exit 1
262+
gcc --version
263+
set -u
264+
265+
# Build from source
266+
[ -d "$DEPENDENCY_DIR" ] || mkdir -p "$DEPENDENCY_DIR"
267+
268+
run_and_time install_cmake
269+
run_and_time install_ninja
270+
271+
install_prerequisites
272+
install_velox_deps

0 commit comments

Comments
 (0)