nodejs / unofficial-builds

Unofficial binaries for Node.js
https://unofficial-builds.nodejs.org
242 stars 50 forks source link

Update compiler for Node.js 16 #42

Closed richardlau closed 3 years ago

richardlau commented 3 years ago

Node.js 16 requires gcc/g++ 8.3 or later.

V8 9.2 included in Node.js 16.6.0 fails to compile with gcc/g++ 8.2.1: https://unofficial-builds.nodejs.org/logs/202107292303-v16.6.0/x64-usdt.log

``` ../deps/v8/src/builtins/builtins-call-gen.cc: In instantiation of 'void v8::internal::CallOrConstructBuiltinsAssembler::CallReceiver(v8::internal::Builtins::Name, v8::internal::TNode, v8::internal::TNode, v8::base::Optional >) [with Descriptor = v8::internal::CallTrampoline_BaselineDescriptor]': ../deps/v8/src/builtins/builtins-call-gen.cc:81:42: required from here ../deps/v8/src/builtins/builtins-call-gen.cc:491:14: error: passing 'const v8::base::Optional >' as 'this' argument discards qualifiers [-fpermissive] return *maybe_receiver; ^~~~~~~~~~~~~~~ In file included from ../deps/v8/src/compiler/code-assembler.h:17, from ../deps/v8/src/codegen/code-stub-assembler.h:15, from ../deps/v8/src/builtins/builtins-call-gen.h:8, from ../deps/v8/src/builtins/builtins-call-gen.cc:5: ../deps/v8/src/base/optional.h:575:16: note: in call to 'constexpr T& v8::base::Optional::operator*() & [with T = v8::internal::TNode]' constexpr T& operator*() & { ^~~~~~~~ ../deps/v8/src/builtins/builtins-call-gen.cc: In instantiation of 'void v8::internal::CallOrConstructBuiltinsAssembler::CallReceiver(v8::internal::Builtins::Name, v8::internal::TNode, v8::internal::TNode, v8::base::Optional >) [with Descriptor = v8::internal::CallTrampoline_Baseline_CompactDescriptor]': ../deps/v8/src/builtins/builtins-call-gen.cc:479:3: required from 'void v8::internal::CallOrConstructBuiltinsAssembler::CallReceiver(v8::internal::Builtins::Name, v8::base::Optional >) [with Descriptor = v8::internal::CallTrampoline_Baseline_CompactDescriptor]' ../deps/v8/src/builtins/builtins-call-gen.cc:72:79: required from here ../deps/v8/src/builtins/builtins-call-gen.cc:491:14: error: passing 'const v8::base::Optional >' as 'this' argument discards qualifiers [-fpermissive] return *maybe_receiver; ^~~~~~~~~~~~~~~ In file included from ../deps/v8/src/compiler/code-assembler.h:17, from ../deps/v8/src/codegen/code-stub-assembler.h:15, from ../deps/v8/src/builtins/builtins-call-gen.h:8, from ../deps/v8/src/builtins/builtins-call-gen.cc:5: ../deps/v8/src/base/optional.h:575:16: note: in call to 'constexpr T& v8::base::Optional::operator*() & [with T = v8::internal::TNode]' constexpr T& operator*() & { ^~~~~~~~ In file included from /opt/rh/devtoolset-8/root/usr/include/c++/8/functional:59, from ../deps/v8/src/codegen/code-stub-assembler.h:8, from ../deps/v8/src/builtins/builtins-call-gen.h:8, from ../deps/v8/src/builtins/builtins-call-gen.cc:5: /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/std_function.h:666:7: error: 'std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = v8::internal::CallOrConstructBuiltinsAssembler::CallReceiver(v8::internal::Builtins::Name, v8::internal::TNode, v8::internal::TNode, v8::base::Optional >) [with Descriptor = v8::internal::CallTrampoline_BaselineDescriptor]::; = void; = void; _Res = v8::internal::TNode; _ArgTypes = {}]', declared using local type 'v8::internal::CallOrConstructBuiltinsAssembler::CallReceiver(v8::internal::Builtins::Name, v8::internal::TNode, v8::internal::TNode, v8::base::Optional >) [with Descriptor = v8::internal::CallTrampoline_BaselineDescriptor]::', is used but never defined [-fpermissive] function<_Res(_ArgTypes...)>:: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/std_function.h:666:7: error: 'std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = v8::internal::CallOrConstructBuiltinsAssembler::CallReceiver(v8::internal::Builtins::Name, v8::internal::TNode, v8::internal::TNode, v8::base::Optional >) [with Descriptor = v8::internal::CallTrampoline_Baseline_CompactDescriptor]::; = void; = void; _Res = v8::internal::TNode; _ArgTypes = {}]', declared using local type 'v8::internal::CallOrConstructBuiltinsAssembler::CallReceiver(v8::internal::Builtins::Name, v8::internal::TNode, v8::internal::TNode, v8::base::Optional >) [with Descriptor = v8::internal::CallTrampoline_Baseline_CompactDescriptor]::', is used but never defined [-fpermissive] make[2]: *** [tools/v8_gypfiles/v8_initializers.target.mk:388: /home/node/node-v16.6.0/out/Release/obj.target/v8_initializers/deps/v8/src/builtins/builtins-call-gen.o] Error 1 ```

The baseline compiler requirement for Node.js 16 is gcc/g++ 8.3: https://github.com/nodejs/node/blob/v16.0.0/BUILDING.md#supported-toolchains

This PR updates the compiler used for Node.js 16 and later by enabling devtoolset-9.

The Cloud Linux repo's devtoolset-8 package is gcc/g++ 8.2.1: https://repo.cloudlinux.com/cloudlinux/7/sclo/devtoolset-8/x86_64/ image

FWIW Software Collections does have a devtoolset-8 that provides gcc/g++ 8.3.1 but only for x64: http://mirror.centos.org/centos/7/sclo/x86_64/rh/Packages/d/ image

Pointer compression builds were separately broken in 16.4.0 https://github.com/nodejs/TSC/issues/790#issuecomment-893457655 and may need https://github.com/nodejs/node/pull/39664 (not yet in a release).

richardlau commented 3 years ago

I take it that this is only impacting the images that are centos/rhel based so those are the ones getting the udpate?

Correct.