From 04e8f3d3db311e73aab0fcb2fa8ab91fbbd82ff2 Mon Sep 17 00:00:00 2001 From: Ankur Aggarwal Date: Fri, 21 Feb 2025 12:09:45 -0800 Subject: [PATCH] Updated the build.sh to get Proxygen installed correctly on CentOS dev severs Summary: Current build.sh script of Proxygen fails to build on the CentOS dev servers (which are also used for the Confidential virtual machines). On investigation, I found 3 errors: a). lsb_release is not installed by default b). Reqiures installation of fast_float-devel c). Requires setting up of proxy server settings so that it could seamlessly download the github repos. The diff does not change anything for the existing systems, but instead make it work seamlessly for the CentOS servers with proxy server. Reviewed By: kvtsoy Differential Revision: D69965614 fbshipit-source-id: 1eebb1b8b3accf6aa7f130a805539cd516e7a864 --- proxygen/build.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/proxygen/build.sh b/proxygen/build.sh index 4fb6899eb2..aa2d581f8e 100755 --- a/proxygen/build.sh +++ b/proxygen/build.sh @@ -20,11 +20,18 @@ COLOR_OFF="\033[0m" function detect_platform() { unameOut="$(uname -s)" case "${unameOut}" in - Linux*) PLATFORM=Linux; DISTRO="$(lsb_release -is)";; + Linux*) + PLATFORM=Linux + if [ -x "$(command -v lsb_release)" ]; then + DISTRO="$(lsb_release -is)" + else + DISTRO="CentOS" + fi + ;; Darwin*) PLATFORM=Mac;; *) PLATFORM="UNKNOWN:${unameOut}" esac - echo -e "${COLOR_GREEN}Detected platform: $PLATFORM ${COLOR_OFF}" + echo -e "${COLOR_GREEN}Detected platform: $PLATFORM Distribution $DISTRO ${COLOR_OFF}" } function install_dependencies_linux_default() { @@ -83,6 +90,38 @@ function install_dependencies_linux_fedora() { gperf } +function install_dependencies_linux_centos() { + sudo dnf install -y \ + $deps_universal \ + m4 \ + g++ \ + flex \ + bison \ + fast_float-devel \ + gflags-devel \ + glog-devel \ + krb5-libs \ + double-conversion-devel \ + libzstd-devel \ + libsodium-devel \ + binutils-devel \ + zlib-devel \ + make \ + lz4-devel \ + wget \ + unzip \ + snappy-devel \ + jemalloc-devel \ + boost-devel\ + cyrus-sasl-devel \ + numactl-libs \ + openssl-devel \ + libcap-devel \ + libevent-devel \ + libtool \ + gperf +} + function install_dependencies_linux { deps_universal="\ git \ @@ -98,6 +137,7 @@ function install_dependencies_linux { case "$DISTRO" in Fedora*) install_dependencies_linux_fedora;; + CentOS*) install_dependencies_linux_centos;; *) install_dependencies_linux_default;; esac } @@ -405,7 +445,10 @@ INSTALL_DEPENDENCIES=true FETCH_DEPENDENCIES=true PREFIX="" COMPILER_FLAGS="" -USAGE="./build.sh [-j num_jobs] [-m|--no-jemalloc] [--no-install-dependencies] [-p|--prefix] [-x|--compiler-flags] [--no-fetch-dependencies]" +PROXY_SERVER_HOST="" +PROXY_SERVER_PORT="8080" + +USAGE="./build.sh [-j num_jobs] [-m|--no-jemalloc] [--no-install-dependencies] [-p|--prefix] [-x|--compiler-flags] [--no-fetch-dependencies] [--proxy_server_host] [--proxy_server_port]" while [ "$1" != "" ]; do case $1 in -j | --jobs ) shift @@ -434,6 +477,14 @@ while [ "$1" != "" ]; do shift COMPILER_FLAGS=$1 ;; + --proxy_server_host ) + shift + PROXY_SERVER_HOST=$1 + ;; + --proxy_server_port ) + shift + PROXY_SERVER_PORT=$1 + ;; * ) echo $USAGE exit 1 esac @@ -464,6 +515,10 @@ mkdir -p "$DEPS_DIR" # Must execute from the directory containing this script cd "$(dirname "$0")" +if [ -n "$PROXY_SERVER_HOST" ]; then + export https_proxy=http://$PROXY_SERVER_HOST:$PROXY_SERVER_PORT + export http_proxy=http://$PROXY_SERVER_HOST:$PROXY_SERVER_PORT +fi setup_fmt setup_googletest setup_zstd