Skip to content

Commit

Permalink
Add gcc11 to Ubuntu20.04 setup and add PkgConfig install
Browse files Browse the repository at this point in the history
Modernize the compiler used on Ubuntu 20.04. Once Velox moves to using the
C++20 standard the system gcc9 compiler cannot be used anymore.

In addition, recent upgrades added the usage of PkgConfig which was not installed into the system and is
not by default pre-installed into ubuntu 20.04.
  • Loading branch information
czentgr committed Oct 22, 2024
1 parent 9531f65 commit 01ea468
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion scripts/setup-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@ SUDO="${SUDO:-"sudo --preserve-env"}"
USE_CLANG="${USE_CLANG:-false}"
export INSTALL_PREFIX=${INSTALL_PREFIX:-"/usr/local"}
DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)/deps-download}
VERSION=$(cat /etc/os-release | grep VERSION_ID)

# On Ubuntu 20.04 dependencies need to be built using gcc11.
# On Ubuntu 22.04 gcc11 is already the system gcc installed.
if [[ ${VERSION} =~ "20.04" ]]; then
export CC=/usr/bin/gcc-11
export CXX=/usr/bin/g++-11
fi

function install_clang15 {
VERSION=`cat /etc/os-release | grep VERSION_ID`
if [[ ! ${VERSION} =~ "22.04" && ! ${VERSION} =~ "24.04" ]]; then
echo "Warning: using the Clang configuration is for Ubuntu 22.04 and 24.04. Errors might occur."
fi
Expand All @@ -54,6 +61,15 @@ function install_clang15 {
${SUDO} apt install ${CLANG_PACKAGE_LIST} -y
}

# For Ubuntu 20.04 we need add the toolchain PPA to get access to gcc11.
function install_gcc11_if_needed {
if [[ ${VERSION} =~ "20.04" ]]; then
${SUDO} add-apt-repository ppa:ubuntu-toolchain-r/test -y
${SUDO} apt update
${SUDO} apt install gcc-11 g++-11 -y
fi
}

FB_OS_VERSION="v2024.07.01.00"
FMT_VERSION="10.1.1"
BOOST_VERSION="boost-1.84.0"
Expand All @@ -75,14 +91,19 @@ function install_build_prerequisites {
ninja-build \
checkinstall \
git \
pkg-config \
cmake-data \
wget

# Install to /usr/local to make it available to all users.
${SUDO} pip3 install cmake==3.28.3

install_gcc11_if_needed

if [[ ${USE_CLANG} != "false" ]]; then
install_clang15
fi

}

# Install packages required for build.
Expand Down Expand Up @@ -294,6 +315,11 @@ function install_apt_deps {
echo " export CC=/usr/bin/clang-15"
echo " export CXX=/usr/bin/clang++-15"
fi
if [[ ${VERSION} =~ "20.04" && ${USE_CLANG} == "false" ]]; then
echo "To build Velox gcc-11/g++11 is required. Set the CC and CXX environment variables in your session."
echo " export CC=/usr/bin/gcc-11"
echo " export CXX=/usr/bin/g++-11"
fi
fi
)

0 comments on commit 01ea468

Please sign in to comment.