Skip to content

Commit

Permalink
Fix Ubuntu install script (facebookincubator#8988)
Browse files Browse the repository at this point in the history
Summary:
Ubuntu script fails when you run it twice.
Add missing SUDO to other system commands in the helper function.
Check if conda is already present

Pull Request resolved: facebookincubator#8988

Reviewed By: bikramSingh91

Differential Revision: D54955154

Pulled By: kgpai

fbshipit-source-id: 946c724ef51f5ae0e8527e8e914f6eb326088746
  • Loading branch information
majetideepak authored and Joe-Abraham committed Jun 7, 2024
1 parent cef6f2d commit 10457d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
7 changes: 4 additions & 3 deletions scripts/setup-helper-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ function github_checkout {
shift
local GIT_CLONE_PARAMS=$@
local DIRNAME=$(basename $REPO)
SUDO="${SUDO:-""}"
cd "${DEPENDENCY_DIR}"
if [ -z "${DIRNAME}" ]; then
echo "Failed to get repo name from ${REPO}"
exit 1
fi
if [ -d "${DIRNAME}" ] && prompt "${DIRNAME} already exists. Delete?"; then
rm -rf "${DIRNAME}"
${SUDO} rm -rf "${DIRNAME}"
fi
if [ ! -d "${DIRNAME}" ]; then
git clone -q -b $VERSION $GIT_CLONE_PARAMS "https://github.com/${REPO}.git"
Expand Down Expand Up @@ -152,13 +153,13 @@ function wget_and_untar {
function cmake_install {
local NAME=$(basename "$(pwd)")
local BINARY_DIR=_build
SUDO="${SUDO:-""}"
if [ -d "${BINARY_DIR}" ] && prompt "Do you want to rebuild ${NAME}?"; then
rm -rf "${BINARY_DIR}"
${SUDO} rm -rf "${BINARY_DIR}"
fi
mkdir -p "${BINARY_DIR}"
CPU_TARGET="${CPU_TARGET:-unknown}"
COMPILER_FLAGS=$(get_cxx_flags $CPU_TARGET)
SUDO="${SUDO:-""}"

# CMAKE_POSITION_INDEPENDENT_CODE is required so that Velox can be built into dynamic libraries \
cmake -Wno-dev -B"${BINARY_DIR}" \
Expand Down
21 changes: 12 additions & 9 deletions scripts/setup-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ BOOST_VERSION=boost-1.84.0
NPROC=$(getconf _NPROCESSORS_ONLN)
DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)}
export CMAKE_BUILD_TYPE=Release
export SUDO=sudo
SUDO="${SUDO:-"sudo --preserve-env"}"

# Install all velox and folly dependencies.
# The is an issue on 22.04 where a version conflict prevents glog install,
# installing libunwind first fixes this.
apt update && apt install sudo
sudo --preserve-env apt update && sudo --preserve-env apt install -y libunwind-dev && \
sudo --preserve-env apt install -y \

${SUDO} apt update
${SUDO} apt install -y libunwind-dev
${SUDO} apt install -y \
g++ \
cmake \
ccache \
Expand Down Expand Up @@ -76,7 +77,7 @@ function install_fmt {
function install_boost {
github_checkout boostorg/boost "${BOOST_VERSION}" --recursive
./bootstrap.sh --prefix=/usr/local
./b2 "-j$(nproc)" -d0 install threading=multi
${SUDO} ./b2 "-j$(nproc)" -d0 install threading=multi
}

function install_folly {
Expand Down Expand Up @@ -105,17 +106,19 @@ function install_fbthrift {
}

function install_conda {
mkdir -p conda && cd conda
MINICONDA_PATH=/opt/miniconda-for-velox
if [ -e ${MINICONDA_PATH} ]; then
echo "File or directory already exists: ${MINICONDA_PATH}"
return
fi
ARCH=$(uname -m)

if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "aarch64" ]; then
echo "Unsupported architecture: $ARCH"
exit 1
fi

mkdir -p conda && cd conda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-$ARCH.sh

MINICONDA_PATH=/opt/miniconda-for-velox
bash Miniconda3-latest-Linux-$ARCH.sh -b -p $MINICONDA_PATH
}

Expand Down

0 comments on commit 10457d3

Please sign in to comment.