build: compile Node.js with C++20 support (#43555)
* build: compile with C++20 support * build: update build-image-sha for gcc 10
This commit is contained in:
parent
5580349c3a
commit
90fbf30491
4 changed files with 45 additions and 6 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
@ -53,7 +53,7 @@ jobs:
|
||||||
id: set-output
|
id: set-output
|
||||||
run: |
|
run: |
|
||||||
if [ -z "${{ inputs.build-image-sha }}" ]; then
|
if [ -z "${{ inputs.build-image-sha }}" ]; then
|
||||||
echo "build-image-sha=cf814a4d2501e8e843caea071a6b70a48e78b855" >> "$GITHUB_OUTPUT"
|
echo "build-image-sha=77262e58c37631ab082482f42c33cdf68c6c394b" >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
|
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -52,3 +52,4 @@ src_account_for_openssl_unexpected_version.patch
|
||||||
src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch
|
src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch
|
||||||
src_use_supported_api_to_get_stalled_tla_messages.patch
|
src_use_supported_api_to_get_stalled_tla_messages.patch
|
||||||
build_don_t_redefine_win32_lean_and_mean.patch
|
build_don_t_redefine_win32_lean_and_mean.patch
|
||||||
|
build_compile_with_c_20_support.patch
|
||||||
|
|
42
patches/node/build_compile_with_c_20_support.patch
Normal file
42
patches/node/build_compile_with_c_20_support.patch
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||||
|
Date: Wed, 4 Sep 2024 16:39:23 +0200
|
||||||
|
Subject: build: compile with C++20 support
|
||||||
|
|
||||||
|
Refs https://github.com/nodejs/node/pull/45427
|
||||||
|
|
||||||
|
V8 requires C++20 support as of https://chromium-review.googlesource.com/c/v8/v8/+/5587859.
|
||||||
|
|
||||||
|
This can be removed when Electron upgrades to a version of Node.js containing the required V8 version.
|
||||||
|
|
||||||
|
diff --git a/common.gypi b/common.gypi
|
||||||
|
index 8736ad12eec294070a5160a64248044cd16347c9..216200c279c599f6dee228120ff5f3943fa52ffd 100644
|
||||||
|
--- a/common.gypi
|
||||||
|
+++ b/common.gypi
|
||||||
|
@@ -307,7 +307,7 @@
|
||||||
|
'VCCLCompilerTool': {
|
||||||
|
'AdditionalOptions': [
|
||||||
|
'/Zc:__cplusplus',
|
||||||
|
- '-std:c++17'
|
||||||
|
+ '-std:c++20'
|
||||||
|
],
|
||||||
|
'BufferSecurityCheck': 'true',
|
||||||
|
'DebugInformationFormat': 1, # /Z7 embed info in .obj files
|
||||||
|
@@ -489,7 +489,7 @@
|
||||||
|
}],
|
||||||
|
[ 'OS in "linux freebsd openbsd solaris android aix os400 cloudabi"', {
|
||||||
|
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
|
||||||
|
- 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++17' ],
|
||||||
|
+ 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++20' ],
|
||||||
|
'defines': [ '__STDC_FORMAT_MACROS' ],
|
||||||
|
'ldflags': [ '-rdynamic' ],
|
||||||
|
'target_conditions': [
|
||||||
|
@@ -660,7 +660,7 @@
|
||||||
|
['clang==1', {
|
||||||
|
'xcode_settings': {
|
||||||
|
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
|
||||||
|
- 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++17', # -std=gnu++17
|
||||||
|
+ 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++20', # -std=gnu++20
|
||||||
|
'CLANG_CXX_LIBRARY': 'libc++',
|
||||||
|
},
|
||||||
|
}],
|
|
@ -186,13 +186,9 @@ async function runMainProcessElectronTests () {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function installSpecModules (dir) {
|
async function installSpecModules (dir) {
|
||||||
// v8 headers use c++17 so override the gyp default of -std=c++14,
|
|
||||||
// but don't clobber any other CXXFLAGS that were passed into spec-runner.js
|
|
||||||
const CXXFLAGS = ['-std=c++17', process.env.CXXFLAGS].filter(x => !!x).join(' ');
|
|
||||||
|
|
||||||
const env = {
|
const env = {
|
||||||
...process.env,
|
...process.env,
|
||||||
CXXFLAGS,
|
CXXFLAGS: process.env.CXXFLAGS,
|
||||||
npm_config_msvs_version: '2019',
|
npm_config_msvs_version: '2019',
|
||||||
npm_config_yes: 'true'
|
npm_config_yes: 'true'
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue