Skip to content

Commit 8480a60

Browse files
czentgrfacebook-github-bot
authored andcommitted
refactor(build): Separate thrift and arrow install on Linux (#12034)
Summary: This PR addresses two issues. 1. Address downloading reliability from archive.apache.org by switching to github. 2. Remove the bundling of thrift from arrow and make it a separate install. This follows a PR where the bundled version of arrow still bundles thrift but has changed download locations. Pull Request resolved: #12034 Reviewed By: kgpai Differential Revision: D68174931 Pulled By: kagamiori fbshipit-source-id: 539d860828ca70b0c0ef025580751bc5b8ccda68
1 parent 05fc7f8 commit 8480a60

File tree

2 files changed

+42
-19
lines changed

2 files changed

+42
-19
lines changed

scripts/setup-centos9.sh

+20-9
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)/deps-download}
4343
FB_OS_VERSION="v2024.07.01.00"
4444
FMT_VERSION="10.1.1"
4545
BOOST_VERSION="boost-1.84.0"
46+
THRIFT_VERSION="v0.16.0"
47+
# Note: when updating arrow check if thrift needs an update as well.
4648
ARROW_VERSION="15.0.0"
4749
STEMMER_VERSION="2.2.0"
4850
DUCKDB_VERSION="v0.8.1"
@@ -191,8 +193,23 @@ function install_stemmer {
191193
)
192194
}
193195

196+
function install_thrift {
197+
wget_and_untar https://github.com/apache/thrift/archive/${THRIFT_VERSION}.tar.gz thrift
198+
(
199+
cd ${DEPENDENCY_DIR}/thrift
200+
./bootstrap.sh
201+
EXTRA_CXXFLAGS="-O3 -fPIC"
202+
# Clang will generate warnings and they need to be suppressed, otherwise the build will fail.
203+
if [[ ${USE_CLANG} != "false" ]]; then
204+
EXTRA_CXXFLAGS="-O3 -fPIC -Wno-inconsistent-missing-override -Wno-unused-but-set-variable"
205+
fi
206+
./configure --prefix=${INSTALL_PREFIX} --enable-tests=no --enable-tutorial=no --with-boost=${INSTALL_PREFIX} CXXFLAGS="${EXTRA_CXXFLAGS}"
207+
make "-j${NPROC}" install
208+
)
209+
}
210+
194211
function install_arrow {
195-
wget_and_untar https://archive.apache.org/dist/arrow/arrow-${ARROW_VERSION}/apache-arrow-${ARROW_VERSION}.tar.gz arrow
212+
wget_and_untar https://github.com/apache/arrow/archive/apache-arrow-${ARROW_VERSION}.tar.gz arrow
196213
cmake_install_dir arrow/cpp \
197214
-DARROW_PARQUET=OFF \
198215
-DARROW_WITH_THRIFT=ON \
@@ -208,21 +225,14 @@ function install_arrow {
208225
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
209226
-DCMAKE_BUILD_TYPE=Release \
210227
-DARROW_BUILD_STATIC=ON \
211-
-DThrift_SOURCE=BUNDLED \
212228
-DBOOST_ROOT=${INSTALL_PREFIX}
213-
214-
(
215-
# Install thrift.
216-
cd ${DEPENDENCY_DIR}/arrow/cpp/_build/thrift_ep-prefix/src/thrift_ep-build
217-
cmake --install ./ --prefix ${INSTALL_PREFIX}
218-
)
219229
}
220230

221231
function install_cuda {
222232
# See https://developer.nvidia.com/cuda-downloads
223233
dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo
224234
local dashed="$(echo $1 | tr '.' '-')"
225-
dnf install -y cuda-nvcc-$dashed cuda-cudart-devel-$dashed cuda-nvrtc-devel-$dashed cuda-driver-devel-$dashed
235+
dnf install -y cuda-nvcc-$dashed cuda-cudart-devel-$dashed cuda-nvrtc-devel-$dashed cuda-driver-devel-$dashed
226236
}
227237

228238
function install_velox_deps {
@@ -242,6 +252,7 @@ function install_velox_deps {
242252
run_and_time install_fbthrift
243253
run_and_time install_duckdb
244254
run_and_time install_stemmer
255+
run_and_time install_thrift
245256
run_and_time install_arrow
246257
}
247258

scripts/setup-ubuntu.sh

+22-10
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ function install_gcc11_if_needed {
7575
FB_OS_VERSION="v2024.07.01.00"
7676
FMT_VERSION="10.1.1"
7777
BOOST_VERSION="boost-1.84.0"
78+
THRIFT_VERSION="v0.16.0"
79+
# Note: when updating arrow check if thrift needs an update as well.
7880
ARROW_VERSION="15.0.0"
7981
STEMMER_VERSION="2.2.0"
8082
DUCKDB_VERSION="v0.8.1"
@@ -94,13 +96,14 @@ function install_build_prerequisites {
9496
checkinstall \
9597
git \
9698
pkg-config \
99+
libtool \
97100
wget
98-
101+
99102
if [ ! -f ${PYTHON_VENV}/pyvenv.cfg ]; then
100103
echo "Creating Python Virtual Environment at ${PYTHON_VENV}"
101104
python3 -m venv ${PYTHON_VENV}
102105
fi
103-
source ${PYTHON_VENV}/bin/activate;
106+
source ${PYTHON_VENV}/bin/activate;
104107
# Install to /usr/local to make it available to all users.
105108
${SUDO} pip3 install cmake==3.28.3
106109

@@ -244,8 +247,23 @@ function install_stemmer {
244247
)
245248
}
246249

250+
function install_thrift {
251+
wget_and_untar https://github.com/apache/thrift/archive/${THRIFT_VERSION}.tar.gz thrift
252+
(
253+
cd ${DEPENDENCY_DIR}/thrift
254+
./bootstrap.sh
255+
EXTRA_CXXFLAGS="-O3 -fPIC"
256+
# Clang will generate warnings and they need to be suppressed, otherwise the build will fail.
257+
if [[ ${USE_CLANG} != "false" ]]; then
258+
EXTRA_CXXFLAGS="-O3 -fPIC -Wno-inconsistent-missing-override -Wno-unused-but-set-variable"
259+
fi
260+
./configure --prefix=${INSTALL_PREFIX} --enable-tests=no --enable-tutorial=no --with-boost=${INSTALL_PREFIX} CXXFLAGS="${EXTRA_CXXFLAGS}"
261+
make "-j${NPROC}" install
262+
)
263+
}
264+
247265
function install_arrow {
248-
wget_and_untar https://archive.apache.org/dist/arrow/arrow-${ARROW_VERSION}/apache-arrow-${ARROW_VERSION}.tar.gz arrow
266+
wget_and_untar https://github.com/apache/arrow/archive/apache-arrow-${ARROW_VERSION}.tar.gz arrow
249267
cmake_install_dir arrow/cpp \
250268
-DARROW_PARQUET=OFF \
251269
-DARROW_WITH_THRIFT=ON \
@@ -261,14 +279,7 @@ function install_arrow {
261279
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
262280
-DCMAKE_BUILD_TYPE=Release \
263281
-DARROW_BUILD_STATIC=ON \
264-
-DThrift_SOURCE=BUNDLED \
265282
-DBOOST_ROOT=${INSTALL_PREFIX}
266-
267-
(
268-
# Install thrift.
269-
cd ${DEPENDENCY_DIR}/arrow/cpp/_build/thrift_ep-prefix/src/thrift_ep-build
270-
$SUDO cmake --install ./ --prefix ${INSTALL_PREFIX}
271-
)
272283
}
273284

274285
function install_cuda {
@@ -296,6 +307,7 @@ function install_velox_deps {
296307
run_and_time install_conda
297308
run_and_time install_duckdb
298309
run_and_time install_stemmer
310+
run_and_time install_thrift
299311
run_and_time install_arrow
300312
}
301313

0 commit comments

Comments
 (0)