Skip to content

Commit

Permalink
ansible: update RHEL 8 cross compiler container (#3274)
Browse files Browse the repository at this point in the history
Update RHEL 8 container used for cross compiling for armv7.
Add logic to select gcc 10 toolchain for Node.js 20 onwards.
Install gcc-toolset-10 host compiler.

Refs: rvagg/rpi-newer-crosstools#2
Refs: https://github.com/orgs/nodejs/discussions/45892
Refs: nodejs/node#47067
  • Loading branch information
richardlau authored Apr 3, 2023
1 parent 38342fd commit d20d4a0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
8 changes: 5 additions & 3 deletions ansible/roles/docker/files/cc-selector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
# cross-compiler-ubuntu1804-armv7-gcc-6
# cross-compiler-ubuntu1804-armv7-gcc-8
# cross-compiler-rhel8-armv7-gcc-8-glibc-2.28
# cross-compiler-rhel8-armv7-gcc-10-glibc-2.28

rpi_newer_tools_base="/opt/raspberrypi/rpi-newer-crosstools/"
base_4_9_4="${rpi_newer_tools_base}x64-gcc-4.9.4-binutils-2.28/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-"
base_6="${rpi_newer_tools_base}x64-gcc-6.5.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-"
base_8="${rpi_newer_tools_base}x64-gcc-8.3.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-"
base_8_glibc_2_28="${rpi_newer_tools_base}x64-gcc-8.3.0-glibc-2.28/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-"
base_10_glibc_2_28="${rpi_newer_tools_base}x64-gcc-10.3.0-glibc-2.28/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-"

flags_armv6="-march=armv6zk"
flags_armv7="-march=armv7-a"
Expand All @@ -22,15 +24,15 @@ function run {
local label="$1"

export arm_type=$(echo $label | sed -E 's/^cross-compiler-(ubuntu1[68]04|rhel8)-(armv[67])-gcc-.*$/\2/')
export gcc_version=$(echo $label | sed -E 's/^cross-compiler-(ubuntu1[68]04|rhel8)-armv[67]-gcc-(4\.9\.4|6|8)/\2/')
export gcc_version=$(echo $label | sed -E 's/^cross-compiler-(ubuntu1[68]04|rhel8)-armv[67]-gcc-(4\.9\.4|6|8|10)/\2/')
export git_branch="cc-${arm_type}"
export host_os=$(echo $label | sed -E 's/^cross-compiler-(ubuntu1[68]04|rhel8)-(armv[67])-gcc-.*$/\1/')

if [[ ! "$arm_type" =~ ^armv[67]$ ]]; then
echo "Could not determine ARM type from '$label'"
exit 1
fi
if [[ ! "$gcc_version" =~ ^(4\.9\.4|6|8|8-glibc-2.28)$ ]]; then
if [[ ! "$gcc_version" =~ ^(4\.9\.4|6|8|8-glibc-2.28|10-glibc-2.28)$ ]]; then
echo "Could not determine ARM type from '$label'"
exit 1
fi
Expand All @@ -52,7 +54,7 @@ function run {
# Additional gcc versions are installed via gcc-toolset-<n> packages.
# No such package exists for the default gcc version (8 on RHEL 8).
if [ "${current_gcc_version}" != "${gcc_host_version}" ]; then
if ! . /opt/gcc-toolset-${gcc_host_version}/enable; then
if ! . /opt/rh/gcc-toolset-${gcc_host_version}/enable; then
echo "Host gcc version mismatch (wanted ${gcc_host_version} but got ${current_gcc_version})."
exit 1
fi
Expand Down
11 changes: 9 additions & 2 deletions ansible/roles/docker/templates/rhel8_arm_cross.Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,22 @@ RUN dnf install --disableplugin=subscription-manager -y \
git \
glibc-devel.i686 \
java-17-openjdk-headless \
make \
libatomic.i686 \
libstdc++-devel \
libstdc++-devel.i686 \
make \
python3.8 \
procps-ng \
xz \
&& dnf --disableplugin=subscription-manager clean all

RUN dnf install --disableplugin=subscription-manager -y \
http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/gcc-toolset-10-gcc-10.3.1-1.2.el8_5.x86_64.rpm \
http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/gcc-toolset-10-gcc-c++-10.3.1-1.2.el8_5.x86_64.rpm \
http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/gcc-toolset-10-libstdc++-devel-10.3.1-1.2.el8_5.i686.rpm \
http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/gcc-toolset-10-libstdc++-devel-10.3.1-1.2.el8_5.x86_64.rpm \
http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/gcc-toolset-10-runtime-10.1-0.el8.x86_64.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] }} \
Expand All @@ -45,7 +52,7 @@ ENV PYTHON /usr/bin/python3

RUN pip3 install tap2junit=={{ tap2junit_version }}

RUN git clone https://github.com/rvagg/rpi-newer-crosstools.git /opt/raspberrypi/rpi-newer-crosstools
RUN git clone --depth=1 https://github.com/rvagg/rpi-newer-crosstools.git /opt/raspberrypi/rpi-newer-crosstools

COPY cc-selector.sh /opt/raspberrypi/cc-selector.sh

Expand Down
3 changes: 3 additions & 0 deletions jenkins/scripts/VersionSelectorScript.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def buildExclusions = [
[ /^debian8-docker-armv7$/, releaseType, lt(10) ],
[ /^debian8-docker-armv7$/, anyType, gte(12) ],
[ /^debian9-docker-armv7$/, anyType, lt(10) ],
[ /^debian10-armv7l$/, anyType, gte(20) ], // gcc 10 requires newer libstdc++
[ /^pi1-docker$/, releaseType, gte(10) ],
[ /^cross-compiler-ubuntu1604-armv[67]-gcc-4.9/, anyType, gte(12) ],
[ /^cross-compiler-ubuntu1604-armv[67]-gcc-6/, anyType, lt(12) ],
Expand All @@ -65,6 +66,8 @@ def buildExclusions = [
[ /^cross-compiler-ubuntu1804-armv7-gcc-8/, anyType, lt(16) ],
[ /^cross-compiler-ubuntu1804-armv7-gcc-8/, anyType, gte(18) ],
[ /^cross-compiler-rhel8-armv7-gcc-8-glibc-2.28/,anyType, lt(18) ],
[ /^cross-compiler-rhel8-armv7-gcc-8-glibc-2.28/,anyType, gte(20) ],
[ /^cross-compiler-rhel8-armv7-gcc-10-glibc-2.28/,anyType, lt(20) ],
[ /^ubuntu1604-arm64/, anyType, gte(14) ],

// Windows -----------------------------------------------
Expand Down

0 comments on commit d20d4a0

Please sign in to comment.