Compare commits

...

4 Commits

Author SHA1 Message Date
deepak1556
594c65bbfa chore: avoid unsetting compiler 2025-05-07 23:41:19 +09:00
deepak1556
180a471c71 ci: update job name 2025-05-07 21:23:09 +09:00
deepak1556
fdfa833fa3 ci: add nan spec runner with system stdlib 2025-05-07 20:53:20 +09:00
deepak1556
08fcc58644 chore: restore _LIBCPP_ABI_VERSION 2025-05-07 02:24:04 +09:00
8 changed files with 138 additions and 97 deletions

View File

@@ -90,6 +90,60 @@ jobs:
do
sleep 60
done
nan-tests-with-libcxx:
name: Run Nan Tests (libc++)
runs-on: electron-arc-linux-amd64-4core
timeout-minutes: 30
env:
TARGET_ARCH: ${{ inputs.target-arch }}
BUILD_TYPE: linux
container: ${{ fromJSON(inputs.test-container) }}
steps:
- name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set Chromium Git Cookie
uses: ./src/electron/.github/actions/set-chromium-cookie
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools
run: |
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }}
- name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies
- name: Download Generated Artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
- name: Download Src Artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
name: src_artifacts_linux_${{ env.TARGET_ARCH }}
path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
- name: Restore Generated Artifacts
run: ./src/electron/script/actions/restore-artifacts.sh
- name: Unzip Dist
run: |
cd src/out/Default
unzip -:o dist.zip
- name: Setup Linux for Headless Testing
run: sh -e /etc/init.d/xvfb start
- name: Run Nan Tests
run: |
cd src
node electron/script/nan-spec-runner.js --with-libc++
- name: Wait for active SSH sessions
shell: bash
if: always() && !cancelled()
run: |
while [ -f /var/.ssh-lock ]
do
sleep 60
done
nan-tests:
name: Run Nan Tests
runs-on: electron-arc-linux-amd64-4core

View File

@@ -75,7 +75,6 @@ fix_adapt_exclusive_access_for_electron_needs.patch
fix_aspect_ratio_with_max_size.patch
port_autofill_colors_to_the_color_pipeline.patch
fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch
build_make_libcxx_abi_unstable_false_for_electron.patch
introduce_ozoneplatform_electron_can_call_x11_property.patch
make_gtk_getlibgtk_public.patch
custom_protocols_plzserviceworker.patch
@@ -142,7 +141,6 @@ ignore_parse_errors_for_resolveshortcutproperties.patch
feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch
feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch
fix_win32_synchronous_spellcheck.patch
fix_enable_wrap_iter_in_string_view_and_array.patch
fix_linter_error.patch
chore_grandfather_in_electron_views_and_delegates.patch
refactor_patch_electron_permissiontypes_into_blink.patch

View File

@@ -1,20 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Charles Kerr <charles@charleskerr.com>
Date: Tue, 22 Mar 2022 16:24:44 -0500
Subject: build: make libcxx_abi_unstable false for electron
https://nornagon.medium.com/a-libc-odyssey-973e51649063
diff --git a/buildtools/third_party/libc++/__config_site b/buildtools/third_party/libc++/__config_site
index 67075bd8b4d42e6e6d651cb0988d64eccb64cc23..e240ff6fff94a6cebf8662996712fe7eb22e5fff 100644
--- a/buildtools/third_party/libc++/__config_site
+++ b/buildtools/third_party/libc++/__config_site
@@ -18,7 +18,7 @@
// _LIBCPP_ABI_NAMESPACE to a shorter value.
#define _LIBCPP_ABI_NAMESPACE __Cr
-#define _LIBCPP_ABI_VERSION 2
+#define _LIBCPP_ABI_VERSION 1
#define _LIBCPP_ABI_FORCE_ITANIUM 0
#define _LIBCPP_ABI_FORCE_MICROSOFT 0

View File

@@ -1,22 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Sat, 1 Mar 2025 05:11:41 +0900
Subject: fix: enable __wrap_iter in string_view and array
Refs https://github.com/electron/electron/issues/45810#issuecomment-2691417213
Patch can be removed when build_make_libcxx_abi_unstable_false_for_electron.patch is removed.
diff --git a/buildtools/third_party/libc++/__config_site b/buildtools/third_party/libc++/__config_site
index e240ff6fff94a6cebf8662996712fe7eb22e5fff..ddf1693002aa171b3d91aa4ef08f5b360e4adddc 100644
--- a/buildtools/third_party/libc++/__config_site
+++ b/buildtools/third_party/libc++/__config_site
@@ -19,6 +19,8 @@
#define _LIBCPP_ABI_NAMESPACE __Cr
#define _LIBCPP_ABI_VERSION 1
+#define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY
+#define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW
#define _LIBCPP_ABI_FORCE_ITANIUM 0
#define _LIBCPP_ABI_FORCE_MICROSOFT 0

View File

@@ -12,5 +12,6 @@
{ "patch_dir": "src/electron/patches/ReactiveObjC", "repo": "src/third_party/squirrel.mac/vendor/ReactiveObjC" },
{ "patch_dir": "src/electron/patches/webrtc", "repo": "src/third_party/webrtc" },
{ "patch_dir": "src/electron/patches/reclient-configs", "repo": "src/third_party/engflow-reclient-configs" },
{ "patch_dir": "src/electron/patches/sqlite", "repo": "src/third_party/sqlite/src" }
{ "patch_dir": "src/electron/patches/sqlite", "repo": "src/third_party/sqlite/src" },
{ "patch_dir": "src/electron/patches/libc++", "repo": "src/third_party/libc++/src" }
]

1
patches/libc++/.patches Normal file
View File

@@ -0,0 +1 @@
fix_disable_trivial_abi_unique_ptr_and_shared_ptr.patch

View File

@@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Wed, 7 May 2025 01:49:22 +0900
Subject: fix: disable trivial_abi unique_ptr and shared_ptr
Refs https://nornagon.medium.com/a-libc-odyssey-973e51649063
diff --git a/include/__configuration/abi.h b/include/__configuration/abi.h
index 01a4a4c023983594839bc2af8481313e9806a56d..a17d1884ba987317f95e9196923a70a79e695191 100644
--- a/include/__configuration/abi.h
+++ b/include/__configuration/abi.h
@@ -65,9 +65,9 @@
// performance and fast-path inlining.
# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
// Enable clang::trivial_abi on std::unique_ptr.
-# define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI
+// # define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI
// Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr
-# define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI
+// # define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI
// std::random_device holds some state when it uses an implementation that gets
// entropy from a file (see _LIBCPP_USING_DEV_RANDOM). When switching from this
// implementation to another one on a platform that has already shipped

View File

@@ -30,6 +30,7 @@ const getNodeGypVersion = () => {
async function main () {
const outDir = utils.getOutDir({ shouldLog: true });
const nodeDir = path.resolve(BASE, 'out', outDir, 'gen', 'node_headers');
const useLibcxx = process.argv.includes('--with-libc++');
const env = {
npm_config_msvs_version: '2022',
...process.env,
@@ -38,66 +39,71 @@ async function main () {
npm_config_yes: 'true'
};
const clangDir = path.resolve(BASE, 'third_party', 'llvm-build', 'Release+Asserts', 'bin');
const cc = path.resolve(clangDir, 'clang');
const cxx = path.resolve(clangDir, 'clang++');
const ld = path.resolve(clangDir, 'lld');
const platformFlags = [];
if (process.platform === 'darwin') {
const sdkPath = path.resolve(BASE, 'out', outDir, 'sdk', 'xcode_links');
const sdks = (await fs.promises.readdir(sdkPath)).filter(fileName => fileName.endsWith('.sdk'));
const sdkToUse = sdks[0];
if (!sdkToUse) {
console.error('Could not find an SDK to use for the NAN tests');
process.exit(1);
}
if (sdks.length) {
console.warn(`Multiple SDKs found in the xcode_links directory - using ${sdkToUse}`);
}
platformFlags.push(
`-isysroot ${path.resolve(sdkPath, sdkToUse)}`
);
}
// TODO(ckerr) this is cribbed from read obj/electron/electron_app.ninja.
// Maybe it would be better to have this script literally open up that
// file and pull cflags_cc from it instead of using bespoke code here?
// I think it's unlikely to work; but if it does, it would be more futureproof
const cxxflags = [
'-std=c++20',
'-Wno-trigraphs',
'-fno-exceptions',
'-fno-rtti',
'-nostdinc++',
`-isystem "${path.resolve(BASE, 'buildtools', 'third_party', 'libc++')}"`,
`-isystem "${path.resolve(BASE, 'third_party', 'libc++', 'src', 'include')}"`,
`-isystem "${path.resolve(BASE, 'third_party', 'libc++abi', 'src', 'include')}"`,
' -fvisibility-inlines-hidden',
'-fPIC',
'-D_LIBCPP_ABI_NAMESPACE=Cr',
'-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE',
...platformFlags
].join(' ');
'-fvisibility-inlines-hidden',
'-fPIC'
];
const ldflags = [];
const ldflags = [
'-stdlib=libc++',
'-fuse-ld=lld',
`-L"${path.resolve(BASE, 'out', outDir, 'obj', 'buildtools', 'third_party', 'libc++abi')}"`,
`-L"${path.resolve(BASE, 'out', outDir, 'obj', 'buildtools', 'third_party', 'libc++')}"`,
'-lc++abi',
...platformFlags
].join(' ');
if (useLibcxx) {
const clangDir = path.resolve(BASE, 'third_party', 'llvm-build', 'Release+Asserts', 'bin');
if (process.platform !== 'win32') {
env.CC = path.resolve(clangDir, 'clang');
env.CXX = path.resolve(clangDir, 'clang++');
env.LD = path.resolve(clangDir, 'lld');
}
const platformFlags = [];
if (process.platform === 'darwin') {
const sdkPath = path.resolve(BASE, 'out', outDir, 'sdk', 'xcode_links');
const sdks = (await fs.promises.readdir(sdkPath)).filter(fileName => fileName.endsWith('.sdk'));
const sdkToUse = sdks[0];
if (!sdkToUse) {
console.error('Could not find an SDK to use for the NAN tests');
process.exit(1);
}
if (sdks.length) {
console.warn(`Multiple SDKs found in the xcode_links directory - using ${sdkToUse}`);
}
platformFlags.push(
`-isysroot ${path.resolve(sdkPath, sdkToUse)}`
);
}
// TODO(ckerr) this is cribbed from read obj/electron/electron_app.ninja.
// Maybe it would be better to have this script literally open up that
// file and pull cflags_cc from it instead of using bespoke code here?
// I think it's unlikely to work; but if it does, it would be more futureproof
cxxflags.push(
'-nostdinc++',
`-isystem "${path.resolve(BASE, 'buildtools', 'third_party', 'libc++')}"`,
`-isystem "${path.resolve(BASE, 'third_party', 'libc++', 'src', 'include')}"`,
`-isystem "${path.resolve(BASE, 'third_party', 'libc++abi', 'src', 'include')}"`,
'-D_LIBCPP_ABI_NAMESPACE=Cr',
'-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE',
...platformFlags
);
ldflags.push(
'-stdlib=libc++',
'-fuse-ld=lld',
`-L"${path.resolve(BASE, 'out', outDir, 'obj', 'buildtools', 'third_party', 'libc++abi')}"`,
`-L"${path.resolve(BASE, 'out', outDir, 'obj', 'buildtools', 'third_party', 'libc++')}"`,
'-lc++abi',
...platformFlags
);
}
if (process.platform !== 'win32') {
env.CC = cc;
env.CFLAGS = cxxflags;
env.CXX = cxx;
env.LD = ld;
env.CXXFLAGS = cxxflags;
env.LDFLAGS = ldflags;
env.CFLAGS = cxxflags.join(' ');
env.CXXFLAGS = cxxflags.join(' ');
env.LDFLAGS = ldflags.join(' ');
}
const nodeGypVersion = getNodeGypVersion();