Skip to content

Commit d20d4a0

Browse files
authored
ansible: update RHEL 8 cross compiler container (#3274)
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
1 parent 38342fd commit d20d4a0

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

ansible/roles/docker/files/cc-selector.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
# cross-compiler-ubuntu1804-armv7-gcc-6
99
# cross-compiler-ubuntu1804-armv7-gcc-8
1010
# cross-compiler-rhel8-armv7-gcc-8-glibc-2.28
11+
# cross-compiler-rhel8-armv7-gcc-10-glibc-2.28
1112

1213
rpi_newer_tools_base="/opt/raspberrypi/rpi-newer-crosstools/"
1314
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-"
1415
base_6="${rpi_newer_tools_base}x64-gcc-6.5.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-"
1516
base_8="${rpi_newer_tools_base}x64-gcc-8.3.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-"
1617
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-"
18+
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-"
1719

1820
flags_armv6="-march=armv6zk"
1921
flags_armv7="-march=armv7-a"
@@ -22,15 +24,15 @@ function run {
2224
local label="$1"
2325

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

2931
if [[ ! "$arm_type" =~ ^armv[67]$ ]]; then
3032
echo "Could not determine ARM type from '$label'"
3133
exit 1
3234
fi
33-
if [[ ! "$gcc_version" =~ ^(4\.9\.4|6|8|8-glibc-2.28)$ ]]; then
35+
if [[ ! "$gcc_version" =~ ^(4\.9\.4|6|8|8-glibc-2.28|10-glibc-2.28)$ ]]; then
3436
echo "Could not determine ARM type from '$label'"
3537
exit 1
3638
fi
@@ -52,7 +54,7 @@ function run {
5254
# Additional gcc versions are installed via gcc-toolset-<n> packages.
5355
# No such package exists for the default gcc version (8 on RHEL 8).
5456
if [ "${current_gcc_version}" != "${gcc_host_version}" ]; then
55-
if ! . /opt/gcc-toolset-${gcc_host_version}/enable; then
57+
if ! . /opt/rh/gcc-toolset-${gcc_host_version}/enable; then
5658
echo "Host gcc version mismatch (wanted ${gcc_host_version} but got ${current_gcc_version})."
5759
exit 1
5860
fi

ansible/roles/docker/templates/rhel8_arm_cross.Dockerfile.j2

+9-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,22 @@ RUN dnf install --disableplugin=subscription-manager -y \
2222
git \
2323
glibc-devel.i686 \
2424
java-17-openjdk-headless \
25-
make \
2625
libatomic.i686 \
2726
libstdc++-devel \
2827
libstdc++-devel.i686 \
28+
make \
2929
python3.8 \
3030
procps-ng \
3131
xz \
3232
&& dnf --disableplugin=subscription-manager clean all
3333

34+
RUN dnf install --disableplugin=subscription-manager -y \
35+
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 \
36+
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 \
37+
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 \
38+
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 \
39+
http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/gcc-toolset-10-runtime-10.1-0.el8.x86_64.rpm
40+
3441
RUN groupadd -r -g {{ server_user_gid.stdout_lines[0] }} {{ server_user }} \
3542
&& adduser -r -m -d /home/{{ server_user }}/ \
3643
-g {{ server_user_gid.stdout_lines[0] }} \
@@ -45,7 +52,7 @@ ENV PYTHON /usr/bin/python3
4552

4653
RUN pip3 install tap2junit=={{ tap2junit_version }}
4754

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

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

jenkins/scripts/VersionSelectorScript.groovy

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def buildExclusions = [
5656
[ /^debian8-docker-armv7$/, releaseType, lt(10) ],
5757
[ /^debian8-docker-armv7$/, anyType, gte(12) ],
5858
[ /^debian9-docker-armv7$/, anyType, lt(10) ],
59+
[ /^debian10-armv7l$/, anyType, gte(20) ], // gcc 10 requires newer libstdc++
5960
[ /^pi1-docker$/, releaseType, gte(10) ],
6061
[ /^cross-compiler-ubuntu1604-armv[67]-gcc-4.9/, anyType, gte(12) ],
6162
[ /^cross-compiler-ubuntu1604-armv[67]-gcc-6/, anyType, lt(12) ],
@@ -65,6 +66,8 @@ def buildExclusions = [
6566
[ /^cross-compiler-ubuntu1804-armv7-gcc-8/, anyType, lt(16) ],
6667
[ /^cross-compiler-ubuntu1804-armv7-gcc-8/, anyType, gte(18) ],
6768
[ /^cross-compiler-rhel8-armv7-gcc-8-glibc-2.28/,anyType, lt(18) ],
69+
[ /^cross-compiler-rhel8-armv7-gcc-8-glibc-2.28/,anyType, gte(20) ],
70+
[ /^cross-compiler-rhel8-armv7-gcc-10-glibc-2.28/,anyType, lt(20) ],
6871
[ /^ubuntu1604-arm64/, anyType, gte(14) ],
6972

7073
// Windows -----------------------------------------------

0 commit comments

Comments
 (0)