From 492df1eb3b69e5bcfdb1ae17fc924eb982c1f64e Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Mon, 20 Mar 2023 17:39:21 +0000 Subject: [PATCH] ansible,jenkins: use gcc 10 on RHEL 8 for Node.js 20 --- ansible/roles/baselayout/vars/main.yml | 2 +- ansible/roles/docker/templates/rhel8.Dockerfile.j2 | 6 ++++++ jenkins/scripts/select-compiler.sh | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ansible/roles/baselayout/vars/main.yml b/ansible/roles/baselayout/vars/main.yml index 99be877e8..ad52c4c90 100644 --- a/ansible/roles/baselayout/vars/main.yml +++ b/ansible/roles/baselayout/vars/main.yml @@ -134,7 +134,7 @@ packages: { ], rhel8: [ - 'ccache,cmake,gcc-c++,gcc-toolset-11,git,make,python3', + 'ccache,cmake,gcc-c++,gcc-toolset-10,gcc-toolset-11,git,make,python3', ], smartos: [ diff --git a/ansible/roles/docker/templates/rhel8.Dockerfile.j2 b/ansible/roles/docker/templates/rhel8.Dockerfile.j2 index 7b5c71fba..d94ab2ae6 100644 --- a/ansible/roles/docker/templates/rhel8.Dockerfile.j2 +++ b/ansible/roles/docker/templates/rhel8.Dockerfile.j2 @@ -27,6 +27,12 @@ RUN dnf install --disableplugin=subscription-manager -y \ xz \ && dnf --disableplugin=subscription-manager clean all +RUN dnf install --disableplugin=subscription-manager -y \ + http://mirror.centos.org/centos/8-stream/AppStream/{{ ansible_architecture }}/os/Packages/gcc-toolset-10-gcc-10.3.1-1.2.el8_5.{{ ansible_architecture }}.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/{{ ansible_architecture }}/os/Packages/gcc-toolset-10-gcc-c++-10.3.1-1.2.el8_5.{{ ansible_architecture }}.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/{{ ansible_architecture }}/os/Packages/gcc-toolset-10-libstdc++-devel-10.3.1-1.2.el8_5.{{ ansible_architecture }}.rpm \ + http://mirror.centos.org/centos/8-stream/AppStream/{{ ansible_architecture }}/os/Packages/gcc-toolset-10-runtime-10.1-0.el8.{{ ansible_architecture }}.rpm + RUN groupadd -r -g {{ server_user_gid.stdout_lines[0] }} {{ server_user }} \ && adduser -r -m -d /home/{{ server_user }}/ \ -g {{ server_user_gid.stdout_lines[0] }} \ diff --git a/jenkins/scripts/select-compiler.sh b/jenkins/scripts/select-compiler.sh index 8e2933e10..2064663c3 100644 --- a/jenkins/scripts/select-compiler.sh +++ b/jenkins/scripts/select-compiler.sh @@ -46,6 +46,13 @@ case $NODE_NAME in ;; *) echo "Setting compiler for Node.js $NODEJS_MAJOR_VERSION on" `cat /etc/redhat-release` + if [ "$NODEJS_MAJOR_VERSION" -gt "19" ]; then + . /opt/rh/gcc-toolset-10/enable + export CC="ccache gcc" + export CXX="ccache g++" + echo "Selected compiler:" `${CXX} -dumpversion` + return + fi # Default gcc on RHEL 8 is gcc 8. if [ "$v8test" != "" ]; then # For V8 builds make `gcc` and `g++` point to non-ccache shims.