From e0a89cc34138937ddb4c252ad489e19efe0a594e Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Thu, 21 Mar 2024 19:36:29 +0000 Subject: [PATCH 1/4] ansible: add libatomic-devel to gcc toolsets --- ansible/roles/baselayout/vars/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/baselayout/vars/main.yml b/ansible/roles/baselayout/vars/main.yml index e59fc94f8..491080b5a 100644 --- a/ansible/roles/baselayout/vars/main.yml +++ b/ansible/roles/baselayout/vars/main.yml @@ -104,7 +104,7 @@ packages: { ], rhel8: [ - 'ccache,cmake,gcc-c++,gcc-toolset-10,gcc-toolset-10-libatomic-devel,gcc-toolset-11,gcc-toolset-12,gcc-toolset-13,git,make,python3', + 'ccache,cmake,gcc-c++,gcc-toolset-10,gcc-toolset-10-libatomic-devel,gcc-toolset-11,gcc-toolset-12,gcc-toolset-12-libatomic-devel,gcc-toolset-13,gcc-toolset-13-libatomic-devel,git,make,python3', ], rhel9: [ From 1d411f406c29e52f33783b4cf9e08d3f0f2f4415 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Thu, 21 Mar 2024 19:36:55 +0000 Subject: [PATCH 2/4] ansible: build newer version of gn --- ansible/roles/gn/vars/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ansible/roles/gn/vars/main.yml b/ansible/roles/gn/vars/main.yml index 909a5bd19..a9d61d168 100644 --- a/ansible/roles/gn/vars/main.yml +++ b/ansible/roles/gn/vars/main.yml @@ -7,6 +7,4 @@ compiler: { } gn_select_compiler: "{{ compiler[os]|default(compiler[os|stripversion])|default('true') }}" -# Pin gn for now so we can still build older versions of V8 in Node.js 14. -# Refs: https://github.com/nodejs/node/pull/40689#issuecomment-956303875 -gn_version: 69ec4fc +gn_version: 88e8054 From 7ac14e9f011d5fad15cd2b7d8440aa982d2d54d2 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Thu, 21 Mar 2024 17:22:33 +0000 Subject: [PATCH 3/4] jenkins: use gcc 12 on rhel8-s390x for Node.js 22 To avoid a compiler bug in gcc, use gcc-toolset-12 on rhel8-s390x. Refs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106355 Refs: https://github.com/nodejs/build/issues/3630 --- jenkins/scripts/select-compiler.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jenkins/scripts/select-compiler.sh b/jenkins/scripts/select-compiler.sh index dbed409b0..336c13b0a 100644 --- a/jenkins/scripts/select-compiler.sh +++ b/jenkins/scripts/select-compiler.sh @@ -47,6 +47,16 @@ case $NODE_NAME in ;; *) echo "Setting compiler for Node.js $NODEJS_MAJOR_VERSION on" `cat /etc/redhat-release` + if [ "$NODEJS_MAJOR_VERSION" -gt "21" ]; then + # s390x, use later toolset to avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106355 + if [ "$SELECT_ARCH" = "S390X" ]; then + . /opt/rh/gcc-toolset-12/enable + export CC="ccache gcc" + export CXX="ccache g++" + echo "Selected compiler:" `${CXX} -dumpversion` + return + fi + fi if [ "$NODEJS_MAJOR_VERSION" -gt "19" ]; then . /opt/rh/gcc-toolset-10/enable export CC="ccache gcc" From a9e2757d9e4eff2d2b96c4a167bd5e87a0173338 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Tue, 16 Apr 2024 20:21:26 +0100 Subject: [PATCH 4/4] ansible: temporarily patch libstdc++ header on s390x As a stop-gap until gcc-toolset-12 in RHEL 8 is updated, manually patch the affected libstdc++ header file. Refs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 --- .../build-test-v8/files/gcc-bug-113960.patch | 57 +++++++++++++++++++ .../tasks/partials/rhel8-s390x.yml | 10 +++- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 ansible/roles/build-test-v8/files/gcc-bug-113960.patch diff --git a/ansible/roles/build-test-v8/files/gcc-bug-113960.patch b/ansible/roles/build-test-v8/files/gcc-bug-113960.patch new file mode 100644 index 000000000..f833dba45 --- /dev/null +++ b/ansible/roles/build-test-v8/files/gcc-bug-113960.patch @@ -0,0 +1,57 @@ +--- a/usr/include/c++/12/bits/stl_algobase.h ++++ b/usr/include/c++/12/bits/stl_algobase.h +@@ -1778,11 +1778,14 @@ + } + + #if __cpp_lib_three_way_comparison +- // Iter points to a contiguous range of unsigned narrow character type +- // or std::byte, suitable for comparison by memcmp. +- template +- concept __is_byte_iter = contiguous_iterator<_Iter> +- && __is_memcmp_ordered>::__value; ++ // Both iterators refer to contiguous ranges of unsigned narrow characters, ++ // or std::byte, or big-endian unsigned integers, suitable for comparison ++ // using memcmp. ++ template ++ concept __memcmp_ordered_with ++ = (__is_memcmp_ordered_with, ++ iter_value_t<_Iter2>>::__value) ++ && contiguous_iterator<_Iter1> && contiguous_iterator<_Iter2>; + + // Return a struct with two members, initialized to the smaller of x and y + // (or x if they compare equal) and the result of the comparison x <=> y. +@@ -1832,20 +1835,20 @@ + if (!std::__is_constant_evaluated()) + if constexpr (same_as<_Comp, __detail::_Synth3way> + || same_as<_Comp, compare_three_way>) +- if constexpr (__is_byte_iter<_InputIter1>) +- if constexpr (__is_byte_iter<_InputIter2>) +- { +- const auto [__len, __lencmp] = _GLIBCXX_STD_A:: +- __min_cmp(__last1 - __first1, __last2 - __first2); +- if (__len) +- { +- const auto __c +- = __builtin_memcmp(&*__first1, &*__first2, __len) <=> 0; +- if (__c != 0) +- return __c; +- } +- return __lencmp; +- } ++ if constexpr (__memcmp_ordered_with<_InputIter1, _InputIter2>) ++ { ++ const auto [__len, __lencmp] = _GLIBCXX_STD_A:: ++ __min_cmp(__last1 - __first1, __last2 - __first2); ++ if (__len) ++ { ++ const auto __blen = __len * sizeof(*__first1); ++ const auto __c ++ = __builtin_memcmp(&*__first1, &*__first2, __blen) <=> 0; ++ if (__c != 0) ++ return __c; ++ } ++ return __lencmp; ++ } + + while (__first1 != __last1) + { diff --git a/ansible/roles/build-test-v8/tasks/partials/rhel8-s390x.yml b/ansible/roles/build-test-v8/tasks/partials/rhel8-s390x.yml index e1740b267..60937ae47 100644 --- a/ansible/roles/build-test-v8/tasks/partials/rhel8-s390x.yml +++ b/ansible/roles/build-test-v8/tasks/partials/rhel8-s390x.yml @@ -8,7 +8,7 @@ # Newer V8 builds require Python 3.8, or later. - name: install packages required to build V8 ansible.builtin.dnf: - name: ['GConf2-devel', 'python2', 'python2-pip', 'python39'] + name: ['GConf2-devel', 'python2', 'python2-pip', 'python39', 'patch'] state: present notify: package updated @@ -35,3 +35,11 @@ executable: pip-3 name: ['httplib2', 'six'] state: present + +- name: temporary patch for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 + ansible.posix.patch: + basedir: /opt/rh/gcc-toolset-12/root/ + ignore_whitespace: true + src: gcc-bug-113960.patch + strip: 1 + become: true