Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove NEED_C11_COMPILER variable and simplify NEED_C17_COMPILER #648

Merged
merged 6 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions jenkins-scripts/docker/lib/boilerplate_prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,19 @@ if [ -z ${ENABLE_REAPER} ]; then
fi

# We use ignitionsrobotics or osrf. osrf by default
if [ -Z ${GITHUB_ORG} ]; then
if [ -z ${GITHUB_ORG} ]; then
GITHUB_ORG="osrf"
fi

# By default, do not need to use C++11 compiler
if [ -z ${NEED_C11_COMPILER} ]; then
NEED_C11_COMPILER=false
if [ -z "${NEED_C17_COMPILER}" ]; then
export INSTALL_C17_COMPILER=false
fi

if [ -z ${NEED_C17_COMPILER} ]; then
NEED_C17_COMPILER=false
# Check if we need to install a custom compiler in old distributions
export INSTALL_C17_COMPILER=false
if ${NEED_C17_COMPILER}; then
if [ ${DISTRO} = 'bionic' ] || [ ${DISTRO} = 'buster' ]; then
export INSTALL_C17_COMPILER=true
fi
fi

# By default, do not use ROS
Expand All @@ -126,14 +128,6 @@ if [ -z ${NEED_GCC48_COMPILER} ]; then
NEED_GCC48_COMPILER=false
fi

# Only precise needs to install a C++11 compiler. Trusty on
# already have a supported version
if $NEED_C11_COMPILER; then
if [[ $DISTRO != 'precise' ]]; then
NEED_C11_COMPILER=false
fi
fi

# in some machines squid is returning
[ -z ${NEED_SQUID_WORKAROUND} ] && NEED_SQUID_WORKAROUND=false

Expand Down
18 changes: 2 additions & 16 deletions jenkins-scripts/docker/lib/debbuild-base.bash
Original file line number Diff line number Diff line change
Expand Up @@ -199,24 +199,10 @@ if [ -f /usr/bin/rosdep ]; then
rosdep init
fi

if $NEED_C11_COMPILER || $NEED_GCC48_COMPILER; then
echo '# BEGIN SECTION: install C++11 compiler'
if [ ${DISTRO} = 'precise' ]; then
sudo apt-get install -y python-software-propertie software-properties-common || true
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
fi
sudo apt-get install -y gcc-4.8 g++-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
g++ --version
echo '# END SECTION'
fi

# Be sure that a previous bug using g++8 compiler is not present anymore
if [[ ${DISTRO} == 'jammy' ]]; then
if [[ ${DISTRO} == 'jammy' || ${DISTRO} == 'focal' ]]; then
[[ \$(/usr/bin/gcc --version | grep 'gcc-8') ]] && ( echo "gcc-8 version found. A bug." ; exit 1 )
elif $NEED_C17_COMPILER; then
elif $INSTALL_C17_COMPILER; then
echo '# BEGIN SECTION: install C++17 compiler'
sudo apt-get install -y gcc-8 g++-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8
Expand Down
4 changes: 2 additions & 2 deletions jenkins-scripts/docker/lib/docker_generate_dockerfile.bash
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if [[ -z ${LINUX_DISTRO} ]]; then
export LINUX_DISTRO="ubuntu"
fi

[[ -z ${NEED_C17_COMPILER} ]] && NEED_C17_COMPILER=false
[[ -z ${INSTALL_C17_COMPILER} ]] && INSTALL_C17_COMPILER=false

export APT_PARAMS=

Expand Down Expand Up @@ -299,7 +299,7 @@ DELIM_DOCKER31

# Beware of moving this code since it needs to run update-alternative after
# installing the default compiler in PACKAGES_CACHE_AND_CHECK_UPDATES
if ${NEED_C17_COMPILER} && [[ ${DISTRO} != jammy ]]; then
if ${INSTALL_C17_COMPILER}; then
cat >> Dockerfile << DELIM_GCC8
RUN apt-get update \\
&& apt-get install -y g++-8 \\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ SCRIPT_DIR="${SCRIPT_DIR%/*}"
export RELEASE_REPO_DIRECTORY=${DISTRO}
export ENABLE_ROS=false
export GITHUB_ORG=ignitionrobotics
export NEED_C11_COMPILER=true

. ${SCRIPT_DIR}/lib/debbuild-base.bash