Skip to content

Commit

Permalink
Fix installs-deps -a catch2 issue on ubuntu 20.04 (#516)
Browse files Browse the repository at this point in the history
* install gcc-10 on ubuntu 20.04 for -a to fix catch2 selftest unknown option error -Wcomma-subscript

* force catch2 to use the ver of gcc/g++

* set CC and CXX on cmake cmdline instead of exporting
  • Loading branch information
jw-msft authored Aug 11, 2023
1 parent bf2df7d commit e5e41f8
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions scripts/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ default_do_ref=develop
install_do=false
do_ref=$default_do_ref

# catch2 build
#
# used for dependencies like catch2 that will find system default
# (e.g. g++-9) despite g++-10 installed, so use CC and CXX env
# vars that CMake will honor.
catch2_cc=""
catch2_cxx=""

# Dependencies packages
aduc_packages=('git' 'make' 'build-essential' 'cmake' 'ninja-build' 'libcurl4-openssl-dev' 'libssl-dev' 'uuid-dev' 'python2.7' 'lsb-release' 'curl' 'wget' 'pkg-config')
static_analysis_packages=('clang' 'clang-tidy' 'cppcheck')
Expand Down Expand Up @@ -190,12 +198,19 @@ do_install_aduc_packages() {
OS=$(lsb_release --short --id)
if [[ $OS == "Debian" && $VER == "9" ]]; then
$SUDO apt-get install --yes gcc-6 g++-6 || return
elif [[ $OS == "Debian" && $VER == "11" ]]; then
$SUDO apt-get install --yes gcc-10 g++-10 || return
elif [[ $OS == "Ubuntu" && $VER == "22.04" ]]; then
catch2_cc=/usr/bin/gcc-6
catch2_cxx=/usr/bin/g++-6
elif [[ ($OS == "Debian" && $VER == "11") || (\
$OS == "Ubuntu" && $VER == "20.04") || (\
$OS == "Ubuntu" && $VER == "22.04") ]] \
; then
$SUDO apt-get install --yes gcc-10 g++-10 || return
catch2_cc=/usr/bin/gcc-10
catch2_cxx=/usr/bin/g++-10
else
$SUDO apt-get install --yes gcc-8 g++-8 || return
catch2_cc=/usr/bin/gcc-8
catch2_cxx=/usr/bin/g++-8
fi

echo "Installing packages required for static analysis..."
Expand Down Expand Up @@ -293,9 +308,8 @@ do_install_catch2() {
mkdir cmake || return
pushd cmake > /dev/null || return

cmake .. || return

cmake --build . || return
CC="$catch2_cc" CXX="$catch2_cxx" cmake .. || return
CC="$catch2_cc" CXX="$catch2_cxx" cmake --build . || return
$SUDO cmake --build . --target install || return
popd > /dev/null || return
popd > /dev/null || return
Expand Down

0 comments on commit e5e41f8

Please sign in to comment.