Compare commits

...

39 Commits

Author SHA1 Message Date
John Kleinschmidt
3e7cbfee95 chore: use wine for v8_context_snapshot_generator 2026-04-07 14:15:13 -04:00
John Kleinschmidt
44b0789530 fixup after rebase 2026-04-07 13:32:52 -04:00
John Kleinschmidt
038f610ef8 Revert "try this"
This reverts commit 5a89776d813be426a8ef1103728aa32702103eef.
2026-04-07 12:34:24 -04:00
John Kleinschmidt
9f58248ac5 try this 2026-04-07 12:34:24 -04:00
John Kleinschmidt
1f6c061d0e use setarch to disable ASLR per-process 2026-04-07 12:34:24 -04:00
John Kleinschmidt
76a4adbe1c Revert "try setting values here"
This reverts commit 62d9a7e0a1a09ce6d1d193f77d251577043c99f3.
2026-04-07 12:34:24 -04:00
John Kleinschmidt
695b375cc9 try setting values here 2026-04-07 12:34:23 -04:00
John Kleinschmidt
cab27faeee try these suggestions 2026-04-07 12:34:23 -04:00
John Kleinschmidt
ed8cdca6c7 fixup for prebuilt mksnapshot 2026-04-07 12:34:23 -04:00
John Kleinschmidt
f87cbacea4 ignore unzip warnings 2026-04-07 12:34:23 -04:00
John Kleinschmidt
0e93e65759 try using prebuilt mksnapshot 2026-04-07 12:34:23 -04:00
John Kleinschmidt
aa74829cea see if this helps 2026-04-07 12:34:23 -04:00
John Kleinschmidt
d4b50302c6 change wine to not prompt for installs 2026-04-07 12:34:23 -04:00
John Kleinschmidt
44c52506b9 maybe this 2026-04-07 12:34:23 -04:00
John Kleinschmidt
4ade686dc0 debug wineboot 2026-04-07 12:34:22 -04:00
John Kleinschmidt
f7fdbbdf36 debug wineboot init 2026-04-07 12:34:22 -04:00
John Kleinschmidt
d2f0ebc159 try using winedebug 2026-04-07 12:34:22 -04:00
John Kleinschmidt
ac4307d32a Revert "try it this way"
This reverts commit f07a421c966f7f1ed8419d5cccace4a32c017686.
2026-04-07 12:34:22 -04:00
John Kleinschmidt
ef368f377f try it this way 2026-04-07 12:34:22 -04:00
John Kleinschmidt
df4a22eae4 Update wineboot command to suppress output and update
Suppress output for wineboot initialization and add update step.
2026-04-07 12:34:22 -04:00
John Kleinschmidt
34fba75af3 Update wineboot initialization in action.yml
Removed error suppression from wineboot initialization.
2026-04-07 12:34:22 -04:00
John Kleinschmidt
613434c18e fix build hang 2026-04-07 12:34:22 -04:00
John Kleinschmidt
4718534f22 try this 2026-04-07 12:34:21 -04:00
John Kleinschmidt
1fb9fd3810 fixup wine 2026-04-07 12:34:21 -04:00
John Kleinschmidt
f9f25e4d48 install newer wine 2026-04-07 12:34:21 -04:00
John Kleinschmidt
3079b0c606 Revert "Update fix_fall_back_to_rtlgenrandom_when_bcryptprimitives_dll_is.patch"
This reverts commit fb2ea1104f688fc17dd72ceb193986f9419cb7af.
2026-04-07 12:34:21 -04:00
John Kleinschmidt
25de3bb0b5 Update fix_fall_back_to_rtlgenrandom_when_bcryptprimitives_dll_is.patch
try this
2026-04-07 12:34:21 -04:00
John Kleinschmidt
400cb880aa try using mksnapshot.exe on cross compile 2026-04-07 12:34:21 -04:00
John Kleinschmidt
71f792cf35 Revert "chore: update mksnapshot to work for windows cross compile"
This reverts commit ea40af62cf7c65ef8120366c43dbdcae71dd237d.
2026-04-07 12:34:21 -04:00
John Kleinschmidt
c947680085 fixup 2026-04-07 12:34:20 -04:00
John Kleinschmidt
f1c425650a update build tools to latest 2026-04-07 12:34:20 -04:00
John Kleinschmidt
f61a5b1889 chore: update mksnapshot to work for windows cross compile 2026-04-07 12:34:20 -04:00
John Kleinschmidt
5491b80c48 Revert "chore: use v8_target_embedded_unwind = "win" to fixup mksnapshot"
This reverts commit 47893ab6f831203c8c8de7291aab04508e115f97.
2026-04-07 12:34:20 -04:00
John Kleinschmidt
165a675b8a chore: use v8_target_embedded_unwind = "win" to fixup mksnapshot 2026-04-07 12:34:20 -04:00
John Kleinschmidt
b7461579db Revert "wild guess"
This reverts commit 00b137df6f2e59b28c20038754465dee0649c843.
2026-04-07 12:34:20 -04:00
John Kleinschmidt
19816f5f3e wild guess 2026-04-07 12:34:20 -04:00
John Kleinschmidt
12f9b97955 chore: set ELECTRON_BUILD_TOOLS_MAIN_STAR
Needed for Windows cross compile
2026-04-07 12:34:20 -04:00
John Kleinschmidt
8d7db38344 add debugging to crash reporter specs.
debug crashpad failures

save source cache

Revert "save source cache"

This reverts commit 88a46191ba.

Revert "debug crashpad failures"

This reverts commit 12427135f1.

chore: temporarily remove crashpad patches to see if they are the issue

put back patch

Revert "chore: temporarily remove crashpad patches to see if they are the issue"

This reverts commit e0ffe69212.
2026-04-07 12:34:19 -04:00
John Kleinschmidt
57892e93c0 build: cross compile windows on linux 2026-04-07 12:34:19 -04:00
11 changed files with 434 additions and 76 deletions

View File

@@ -40,10 +40,113 @@ runs:
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
- name: Set GN_EXTRA_ARGS for Windows
shell: bash
if: ${{inputs.target-arch != 'x64' && inputs.target-platform == 'win' }}
if: ${{ inputs.target-platform == 'win' }}
run: |
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"${{ inputs.target-arch }}\""
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"${{ inputs.target-arch }}\" use_v8_context_snapshot=true v8_win_cross_compile_using_wine=true target_os=\"win\""
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
echo "ELECTRON_BUILD_TOOLS_MAIN_STAR=`pwd`/src/electron/build/siso/main.star" >> $GITHUB_ENV
- name: Install wine for Windows builds on non-Windows hosts
shell: bash
if: ${{ inputs.target-platform == 'win' && runner.os != 'Windows' }}
run: |
sudo mkdir -pm755 /etc/apt/keyrings
wget -O - https://dl.winehq.org/wine-builds/winehq.key | sudo gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key -
sudo dpkg --add-architecture i386
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
sudo apt-get update
sudo apt install -y --install-recommends winehq-stable libgcc-s1:i386 libgcc-s1
# Increase virtual memory limits for Wine's VirtualAlloc (V8 sandbox
# reserves a very large contiguous region that fails under default limits)
sudo sysctl vm.mmap_min_addr
sudo sysctl -w vm.mmap_min_addr=65536
sudo sysctl -w vm.max_map_count=1048576
sudo sysctl -w vm.overcommit_memory=1
sudo sysctl -w kernel.randomize_va_space=0
if [ -x /usr/bin/wine ]; then
WINE_PATH=/usr/bin/wine
elif command -v wine >/dev/null 2>&1; then
WINE_PATH=$(command -v wine)
fi
if [ -z "$WINE_PATH" ] || [ ! -x "$WINE_PATH" ]; then
echo "ERROR: wine binary not found anywhere after install"
exit 1
fi
echo "Found wine at: $WINE_PATH"
export WINEPREFIX="$HOME/.wine"
mkdir -p "$WINEPREFIX"
echo "WINEPREFIX=$WINEPREFIX" >> $GITHUB_ENV
# Start a persistent Xvfb server for wine (xvfb-run per-invocation hangs
# because wineserver keeps the X connection alive)
export DISPLAY=:99.0
echo "DISPLAY=:99.0" >> $GITHUB_ENV
export XDG_RUNTIME_DIR=/tmp/runtime-$(whoami)
echo "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" >> $GITHUB_ENV
mkdir -p "$XDG_RUNTIME_DIR"
echo "Starting Xvfb on :99 with 1024x768x24 resolution"
Xvfb :99 -screen 0 1024x768x24 &
echo "Wait for Xvfb to be ready"
# Wait for Xvfb to be ready (up to 5 seconds)
for i in $(seq 1 10); do
if xdpyinfo -display :99 >/dev/null 2>&1; then
echo "Xvfb is running on :99"
break
fi
echo "xvfb not ready yet, waiting..."
sleep 0.5
done
if ! xdpyinfo -display :99 >/dev/null 2>&1; then
echo "ERROR: Xvfb failed to start"
exit 1
fi
echo "Xvfb is ready; about to run wineboot"
export WINEDEBUG=-all
echo "WINEDEBUG=$WINEDEBUG" >> $GITHUB_ENV
export WINEARCH=win64
echo "WINEARCH=$WINEARCH" >> $GITHUB_ENV
WINEDLLOVERRIDES="mscoree,mshtml=" wineboot --init
echo "Done running wineboot"
# Initialize wine prefix to avoid first-run delays during build
#"$WINE_PATH" wineboot --init 2>/dev/null || true
WINE_WRAPPER="/usr/local/bin/xvfb-wine"
printf '#!/bin/sh\nsetarch x86_64 -R %s "$@"\n' "$WINE_PATH" | sudo tee "$WINE_WRAPPER" > /dev/null
sudo chmod +x "$WINE_WRAPPER"
GN_APPENDED_ARGS="$GN_EXTRA_ARGS v8_wine_path=\"$WINE_WRAPPER\""
# Pass wine path to GN so siso can find it regardless of PATH
GN_APPENDED_ARGS="$GN_EXTRA_ARGS v8_wine_path=\"$WINE_PATH\""
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
echo "GN APPENDED_ARGS set with wine path: $GN_APPENDED_ARGS"
echo "Wine setup complete"
# - name: Download mksnapshot.zip
# shell: bash
# if: ${{ inputs.target-platform == 'win' }}
# run: |
# # Download mksnapshot.zip from https://electronbuildtools.blob.core.windows.net/windows-toolchains/mksnapshot.zip
# curl -L -o mksnapshot.zip https://electronbuildtools.blob.core.windows.net/windows-toolchains/mksnapshot.zip
# if [ $? -ne 0 ]; then
# echo "Failed to download mksnapshot.zip"
# exit 1
# fi
# if [ -f mksnapshot.zip ]; then
# echo "Successfully downloaded mksnapshot.zip"
# else
# echo "mksnapshot.zip not found after download"
# exit 1
# fi
# if [ -f mksnapshot.zip ]; then
# unzip mksnapshot.zip -d mksnapshot || true
# PREBUILT_MKSNAPSHOT="$(pwd)/mksnapshot/mksnapshot.exe"
# if [ -f "$PREBUILT_MKSNAPSHOT" ]; then
# GN_APPENDED_ARGS="$GN_EXTRA_ARGS v8_prebuilt_mksnapshot=\"$PREBUILT_MKSNAPSHOT\""
# echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
# echo "Using pre-built mksnapshot at $PREBUILT_MKSNAPSHOT"
# else
# echo "mksnapshot binary not found in mksnapshot.zip, will build from source"
# fi
# else
# echo "mksnapshot.zip not found, skipping unzip and PATH update"
# fi
- name: Add Clang problem matcher
shell: bash
run: echo "::add-matcher::src/electron/.github/problem-matchers/clang.json"
@@ -58,7 +161,6 @@ runs:
OUTPUT_PATH: src/previous-object-checksums.json
run: node src/electron/.github/actions/build-electron/download-previous-object-checksums.mjs
- name: Build Electron ${{ inputs.step-suffix }}
if: ${{ inputs.target-platform != 'win' }}
shell: bash
run: |
rm -rf "src/out/Default/Electron Framework.framework"
@@ -83,7 +185,11 @@ runs:
node electron/script/check-symlinks.js
# Build stats and object checksums
BUILD_STATS_ARGS="out/Default/siso.INFO --out-dir out/Default --output-object-checksums object-checksums.${{ inputs.artifact-platform }}_${{ inputs.target-arch }}.json"
if [ "$TARGET_PLATFORM" = "win" ]; then
BUILD_STATS_ARGS="out/Default/siso.exe.INFO --out-dir out/Default --output-object-checksums object-checksums.${{ inputs.artifact-platform }}_${{ inputs.target-arch }}.json"
else
BUILD_STATS_ARGS="out/Default/siso.INFO --out-dir out/Default --output-object-checksums object-checksums.${{ inputs.artifact-platform }}_${{ inputs.target-arch }}.json"
fi
if [ -f previous-object-checksums.json ]; then
BUILD_STATS_ARGS="$BUILD_STATS_ARGS --input-object-checksums previous-object-checksums.json"
fi
@@ -93,38 +199,6 @@ runs:
echo "Skipping build-stats.mjs upload because DD_API_KEY is not set"
fi
node electron/script/build-stats.mjs $BUILD_STATS_ARGS || true
- name: Build Electron (Windows) ${{ inputs.step-suffix }}
if: ${{ inputs.target-platform == 'win' }}
shell: powershell
run: |
cd src\electron
git pack-refs
cd ..
$env:NINJA_SUMMARIZE_BUILD = 1
if ("${{ inputs.is-release }}" -eq "true") {
e build --target electron:release_build
} else {
e build --target electron:testing_build
}
Copy-Item out\Default\.ninja_log out\electron_ninja_log
node electron\script\check-symlinks.js
# Build stats and object checksums
$statsArgs = @("out\Default\siso.exe.INFO", "--out-dir", "out\Default", "--output-object-checksums", "object-checksums.${{ inputs.artifact-platform }}_${{ inputs.target-arch }}.json")
if (Test-Path previous-object-checksums.json) {
$statsArgs += @("--input-object-checksums", "previous-object-checksums.json")
}
if ($env:DD_API_KEY) {
$statsArgs += "--upload-stats"
} else {
Write-Host "Skipping build-stats.mjs upload because DD_API_KEY is not set"
}
try {
& node electron\script\build-stats.mjs @statsArgs ; $LASTEXITCODE = 0
} catch {
Write-Host "Build stats failed, continuing..."
}
- name: Verify dist.zip ${{ inputs.step-suffix }}
shell: bash
run: |
@@ -152,15 +226,7 @@ runs:
sed $SEDOPTION '/--warn-about-builtin-profile-data/d' out/Default/mksnapshot_args
sed $SEDOPTION '/--abort-on-bad-builtin-profile-data/d' out/Default/mksnapshot_args
if [ "${{ inputs.target-platform }}" = "win" ]; then
cd out/Default
powershell Compress-Archive -update mksnapshot_args mksnapshot.zip
powershell mkdir mktmp\\gen\\v8
powershell Copy-Item gen\\v8\\embedded.S mktmp\\gen\\v8
powershell Compress-Archive -update -Path mktmp\\gen mksnapshot.zip
else
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
fi
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
- name: Generate Cross-Arch Snapshot (arm/arm64) ${{ inputs.step-suffix }}
shell: bash
if: ${{ (inputs.target-arch == 'arm' || inputs.target-arch == 'arm64') && inputs.target-platform == 'linux' }}
@@ -194,12 +260,6 @@ runs:
fi
electron/script/zip_manifests/check-zip-manifest.py out/Default/chromedriver.zip electron/script/zip_manifests/chromedriver_zip.$target_os.${{ inputs.target-arch }}.manifest
fi
- name: Create installed_software.json ${{ inputs.step-suffix }}
shell: powershell
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
run: |
cd src
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- name: Profile Windows Toolchain ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
@@ -269,7 +329,7 @@ runs:
with:
subject-path: ${{ steps.github-upload.outputs.UPLOADED_PATHS }}
- name: Generate siso report
if: ${{ inputs.target-platform != 'win' && !cancelled() }}
if: ${{ !cancelled() }}
shell: bash
run: |
cd src
@@ -278,17 +338,6 @@ runs:
echo "SISO_REPORT_PATH=$SISO_REPORT_PATH" >> $GITHUB_ENV
cat siso_report.txt
echo "SISO REPORT AT $SISO_REPORT_PATH"
- name: Generate siso report (Windows)
if: ${{ inputs.target-platform == 'win' && !cancelled() }}
shell: powershell
run: |
cd src
e d siso report -C out\Default > siso_report.txt
$SISO_REPORT_PATH = Get-Content "siso_report.txt" | Select-String "report file:\s*(.+)" | ForEach-Object {
$_.Matches.Groups[1].Value.Trim()
}
echo "SISO_REPORT_PATH=$SISO_REPORT_PATH"
echo "SISO_REPORT_PATH=$SISO_REPORT_PATH" >> $env:GITHUB_ENV
- name: Generate Artifact Key
if: always() && !cancelled()
shell: bash

View File

@@ -15,7 +15,7 @@ runs:
git config --global core.preloadindex true
git config --global core.longpaths true
fi
export BUILD_TOOLS_SHA=a0cc95a1884a631559bcca0c948465b725d9295a
export BUILD_TOOLS_SHA=1aa9dce0b3fa9353c38a6c3d4aac0249f0f68973
npm i -g @electron/build-tools
# Update depot_tools to ensure python
e d update_depot_tools

View File

@@ -11,12 +11,12 @@ on:
skip-macos:
type: boolean
description: 'Skip macOS builds'
default: false
default: true
required: false
skip-linux:
type: boolean
description: 'Skip Linux builds'
default: false
default: true
required: false
skip-windows:
type: boolean
@@ -108,7 +108,7 @@ jobs:
# Checkout Jobs
checkout-macos:
needs: setup
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-macos}}
if: ${{ needs.setup.outputs.src == 'true' && inputs.skip-macos == 'false'}}
runs-on: electron-arc-centralus-linux-amd64-32core
permissions:
contents: read
@@ -138,7 +138,7 @@ jobs:
checkout-linux:
needs: setup
if: ${{ !inputs.skip-linux}}
if: ${{ inputs.skip-linux == 'false' }}
runs-on: electron-arc-centralus-linux-amd64-32core
permissions:
contents: read
@@ -387,8 +387,9 @@ jobs:
needs: checkout-windows
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-centralus-windows-amd64-16core
build-runs-on: electron-arc-centralus-linux-amd64-32core
test-runs-on: windows-latest
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
target-platform: win
target-arch: x64
is-release: false
@@ -406,8 +407,9 @@ jobs:
needs: checkout-windows
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-centralus-windows-amd64-16core
build-runs-on: electron-arc-centralus-linux-amd64-32core
test-runs-on: windows-latest
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
target-platform: win
target-arch: x86
is-release: false
@@ -425,8 +427,9 @@ jobs:
needs: checkout-windows
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-centralus-windows-amd64-16core
build-runs-on: electron-arc-centralus-linux-amd64-32core
test-runs-on: windows-11-arm
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
target-platform: win
target-arch: arm64
is-release: false

View File

@@ -134,6 +134,10 @@ jobs:
- name: Install AZCopy
if: ${{ inputs.target-platform == 'macos' }}
run: brew install azcopy
- name: Enable windows toolchain
if: ${{ inputs.target-platform == 'win' }}
run: |
echo "ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN=1" >> $GITHUB_ENV
- name: Set GN_EXTRA_ARGS for Linux
if: ${{ inputs.target-platform == 'linux' }}
run: |
@@ -160,13 +164,15 @@ jobs:
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
- name: Restore src cache via AZCopy
if: ${{ inputs.target-platform != 'linux' }}
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/restore-cache-azcopy
with:
target-platform: ${{ inputs.target-platform }}
- name: Restore src cache via AKS
if: ${{ inputs.target-platform == 'linux' }}
if: ${{ inputs.target-platform != 'macos' }}
uses: ./src/electron/.github/actions/restore-cache-aks
with:
target-platform: ${{ inputs.target-platform }}
- name: Checkout Electron
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
@@ -174,7 +180,7 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Fix Sync
if: ${{ inputs.target-platform != 'linux' }}
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/fix-sync
with:
target-platform: ${{ inputs.target-platform }}
@@ -183,9 +189,21 @@ jobs:
- name: Init Build Tools
run: |
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} --remote-build siso
e sanitize-config
- name: Run Electron Only Hooks
run: |
e d gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
if [ "${{ inputs.target-platform }}" = "win" ]; then
rm -rf src/third_party/depot_tools/win_toolchain/vs_files*
fi
echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient
if [ "${{ inputs.target-platform }}" = "win" ]; then
echo "target_os=['win']" >> tmpgclient
fi
gclient runhooks --gclientfile=tmpgclient
# Fix VS Toolchain
if [ "${{ inputs.target-platform }}" = "win" ]; then
e d python3 src/build/vs_toolchain.py update --force
fi
- name: Regenerate DEPS Hash
run: |
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js
@@ -224,3 +242,11 @@ jobs:
generate-symbols: '${{ inputs.generate-symbols }}'
upload-to-storage: '${{ inputs.upload-to-storage }}'
step-suffix: '(mas)'
- name: Wait for active SSH sessions
shell: bash
if: always() && !cancelled()
run: |
while [ -f /var/.ssh-lock ]
do
sleep 60
done

103
build/siso/main.star Normal file
View File

@@ -0,0 +1,103 @@
load("@builtin//encoding.star", "json")
load("@builtin//lib/gn.star", "gn")
load("@builtin//path.star", "path")
load("@builtin//runtime.star", "runtime")
load("@builtin//struct.star", "module")
load("@config//main.star", upstream_init = "init")
load("@config//win_sdk.star", "win_sdk")
load("@config//gn_logs.star", "gn_logs")
def init(ctx):
mod = upstream_init(ctx)
step_config = json.decode(mod.step_config)
# Buildbarn doesn't support input_root_absolute_path so disable that
for rule in step_config["rules"]:
input_root_absolute_path = rule.get("input_root_absolute_path", False)
if input_root_absolute_path:
rule.pop("input_root_absolute_path", None)
# Only wrap clang rules with a remote wrapper if not on Linux. These are currently only
# needed for X-Compile builds, which run on Windows and Mac.
if runtime.os != "linux":
for rule in step_config["rules"]:
if rule["name"].startswith("clang/") or rule["name"].startswith("clang-cl/"):
rule["remote_wrapper"] = "../../buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper"
if "inputs" not in rule:
rule["inputs"] = []
rule["inputs"].append("buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper")
rule["inputs"].append("third_party/llvm-build/Release+Asserts_linux/bin/clang")
if "executables" not in step_config:
step_config["executables"] = []
step_config["executables"].append("buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper")
step_config["executables"].append("third_party/llvm-build/Release+Asserts_linux/bin/clang")
if runtime.os == "darwin":
# Update platforms to match our default siso config instead of reclient configs.
step_config["platforms"].update({
"clang": step_config["platforms"]["default"],
"clang_large": step_config["platforms"]["default"],
})
# Add additional Windows SDK headers needed by Electron
win_toolchain_dir = win_sdk.toolchain_dir(ctx)
if win_toolchain_dir:
sdk_version = gn_logs.read(ctx).get("windows_sdk_version")
step_config["input_deps"][win_toolchain_dir + ":headers"].extend([
# third_party/electron_node/deps/uv/include/uv/win.h includes mswsock.h
path.join(win_toolchain_dir, "Windows Kits", "10/Include", sdk_version, "um/mswsock.h"),
# third_party/electron_node/src/debug_utils.cc includes lm.h
path.join(win_toolchain_dir, "Windows Kits", "10/Include", sdk_version, "um/Lm.h"),
])
if runtime.os == "windows":
# Update platforms to match our default siso config instead of reclient configs.
step_config["platforms"].update({
"clang-cl": step_config["platforms"]["default"],
"clang-cl_large": step_config["platforms"]["default"],
"lld-link": step_config["platforms"]["default"],
})
# When cross-compiling for Windows using wine, mksnapshot.exe is run via
# wine64 on the local machine. The remote execution service cannot handle
# this, so force mksnapshot to run locally. The wine64 prefix also changes
# the command so the upstream v8/mksnapshot rule's command_prefix won't
# match — add an explicit rule for the wine-prefixed command.
if "args.gn" in ctx.metadata:
gn_args = gn.args(ctx)
if gn_args.get("v8_win_cross_compile_using_wine", "").strip('"') == "true":
# Force the existing v8/mksnapshot rule to run locally
for rule in step_config["rules"]:
if rule.get("name") == "v8/mksnapshot":
rule["remote"] = False
# Add a rule that matches the wine64-prefixed mksnapshot command.
# With wine, GN emits: python3 ../../v8/tools/run.py <wine_path> ./mksnapshot.exe
# The upstream command_prefix ("python3 ...run.py ./mksnapshot") won't
# match because wine_path appears before ./mksnapshot.exe.
wine_path = gn_args.get("v8_wine_path", "").strip('"')
if wine_path:
step_config["rules"].insert(0, {
"name": "v8/mksnapshot_wine",
"command_prefix": "python3 ../../v8/tools/run.py " + wine_path,
"remote": False,
"timeout": "2m",
"output_local": True,
})
# Same treatment for v8_context_snapshot_generator which uses
# gn_run_binary.py instead of v8/tools/run.py.
step_config["rules"].insert(0, {
"name": "v8/context_snapshot_wine",
"command_prefix": "python3 ../../build/gn_run_binary.py " + wine_path,
"remote": False,
"timeout": "2m",
"output_local": True,
})
return module(
"config",
step_config = json.encode(step_config),
filegroups = mod.filegroups,
handlers = mod.handlers,
)

View File

@@ -150,3 +150,4 @@ fix_use_fresh_lazynow_for_onendworkitemimpl_after_didruntask.patch
fix_pulseaudio_stream_and_icon_names.patch
fix_fire_menu_popup_start_for_dynamically_created_aria_menus.patch
feat_allow_enabling_extensions_on_custom_protocols.patch
chore_run_v8_context_snapshot_generator_through_wine_when.patch

View File

@@ -0,0 +1,49 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <kleinschmidtorama@gmail.com>
Date: Tue, 7 Apr 2026 14:05:09 -0400
Subject: chore: run v8_context_snapshot_generator through Wine when
cross-compiling
When cross-compiling for Windows on Linux with Wine, the
v8_context_snapshot_generator binary is a Windows PE executable (.exe)
that cannot be run directly. Prepend the wine path to args and append
.exe to the binary name, matching the approach used for mksnapshot.
diff --git a/tools/v8_context_snapshot/BUILD.gn b/tools/v8_context_snapshot/BUILD.gn
index ec2357139826613e8b295cb01be341acb03b4737..6c4171dbaf7a76cfc89d71871b73058747675811 100644
--- a/tools/v8_context_snapshot/BUILD.gn
+++ b/tools/v8_context_snapshot/BUILD.gn
@@ -50,12 +50,27 @@ if (use_v8_context_snapshot) {
output_file = "$root_build_dir/$v8_context_snapshot_filename"
output_path = rebase_path(output_file, root_build_dir)
- args = [
- "./" + rebase_path(
- get_label_info(
- ":v8_context_snapshot_generator($v8_snapshot_toolchain)",
- "root_out_dir") + "/v8_context_snapshot_generator",
- root_build_dir),
+ _generator_dir = get_label_info(
+ ":v8_context_snapshot_generator($v8_snapshot_toolchain)",
+ "root_out_dir")
+ if (v8_win_cross_compile_using_wine) {
+ _generator_bin = "./" + rebase_path(
+ _generator_dir + "/v8_context_snapshot_generator.exe",
+ root_build_dir)
+ } else {
+ _generator_bin = "./" + rebase_path(
+ _generator_dir + "/v8_context_snapshot_generator",
+ root_build_dir)
+ }
+
+ args = []
+ if (v8_win_cross_compile_using_wine) {
+ assert(v8_wine_path != "",
+ "v8_wine_path must be set when v8_win_cross_compile_using_wine is true")
+ args += [ v8_wine_path ]
+ }
+ args += [
+ _generator_bin,
"--snapshot_blob=$snapshot_blob_path",
"--output_file=$output_path",
]

View File

@@ -1,2 +1,3 @@
chore_allow_customizing_microtask_policy_per_context.patch
build_warn_instead_of_abort_on_builtin_pgo_profile_mismatch.patch
feat_support_running_mksnapshot_exe_via_wine_for_windows.patch

View File

@@ -0,0 +1,113 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <kleinschmidtorama@gmail.com>
Date: Tue, 24 Mar 2026 16:29:55 -0400
Subject: feat: support running mksnapshot.exe via Wine for Windows
cross-compile
When v8_win_cross_compile_using_wine=true is set, mksnapshot is built as a
Windows .exe using the target toolchain and executed via Wine on the Linux
host. This avoids needing source-level cross-compile patches for the
unwinding info code paths.
diff --git a/BUILD.gn b/BUILD.gn
index 751265ba83c04f0c545248a71b35e46034bfc90a..9ca41b06b569c729496abde7cba085518a9f0d71 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -2699,7 +2699,11 @@ template("run_mksnapshot") {
suffix = "_$name"
}
action("run_mksnapshot_" + name) {
- deps = [ ":mksnapshot($v8_snapshot_toolchain)" ]
+ if (v8_prebuilt_mksnapshot != "") {
+ deps = []
+ } else {
+ deps = [ ":mksnapshot($v8_snapshot_toolchain)" ]
+ }
if (v8_verify_deterministic_mksnapshot) {
# We archive the snapshot executable when verifying snapshot
# determinism to ease debugging.
@@ -2753,10 +2757,26 @@ template("run_mksnapshot") {
data += [ "$root_out_dir/mksnapshot_output${suffix}.log" ]
}
+ if (v8_prebuilt_mksnapshot != "") {
+ _mksnapshot_bin = v8_prebuilt_mksnapshot
+ } else {
+ _mksnapshot_dir =
+ get_label_info(":mksnapshot($v8_snapshot_toolchain)", "root_out_dir")
+ if (v8_win_cross_compile_using_wine) {
+ _mksnapshot_bin = _mksnapshot_dir + "/mksnapshot.exe"
+ } else {
+ _mksnapshot_bin = _mksnapshot_dir + "/mksnapshot"
+ }
+ }
+
+ if (v8_win_cross_compile_using_wine) {
+ assert(
+ v8_wine_path != "",
+ "v8_wine_path must be set when v8_win_cross_compile_using_wine is true")
+ args += [ v8_wine_path ]
+ }
args += [
- "./" + rebase_path(get_label_info(":mksnapshot($v8_snapshot_toolchain)",
- "root_out_dir") + "/mksnapshot",
- root_build_dir),
+ "./" + rebase_path(_mksnapshot_bin, root_build_dir),
"--turbo_instruction_scheduling",
"--turbo-always-optimize-spills",
diff --git a/gni/snapshot_toolchain.gni b/gni/snapshot_toolchain.gni
index 37ed262640d048a6fa5923279ae0388c1c0ae766..d9830914f0abd919143f0cf8b3069c5a3f70516e 100644
--- a/gni/snapshot_toolchain.gni
+++ b/gni/snapshot_toolchain.gni
@@ -32,6 +32,21 @@ declare_args() {
# toolchain that matches the bit-width of the target CPU, but runs on
# the host.
v8_snapshot_toolchain = ""
+
+ # When cross-compiling for Windows on a non-Windows host, build mksnapshot
+ # as a Windows .exe and run it via Wine instead of building a host-native
+ # mksnapshot with cross-compile patches.
+ v8_win_cross_compile_using_wine = false
+
+ # Absolute path to the wine64 binary. Required when
+ # v8_win_cross_compile_using_wine is true.
+ v8_wine_path = ""
+
+ # Path to a pre-built mksnapshot binary to use instead of building one from
+ # source. When set, run_mksnapshot will use this binary directly and skip
+ # building the mksnapshot target. The path should be absolute or relative
+ # to the source root.
+ v8_prebuilt_mksnapshot = ""
}
# Try to infer the appropriate snapshot toolchain for the v8_current_cpu
@@ -69,7 +84,12 @@ if (v8_snapshot_toolchain == "") {
# Cross-build from same ISA on one OS to another. For example:
# * targeting win/x64 on a linux/x64 host
# * targeting win/arm64 on a mac/arm64 host
- v8_snapshot_toolchain = host_toolchain
+ if (v8_win_cross_compile_using_wine && is_win && host_os != "win") {
+ # Build mksnapshot as a Windows .exe and run it via Wine.
+ v8_snapshot_toolchain = current_toolchain
+ } else {
+ v8_snapshot_toolchain = host_toolchain
+ }
} else if (host_cpu == "arm64" && current_cpu == "x64") {
# Cross-build from arm64 to intel (likely on an Apple Silicon mac).
v8_snapshot_toolchain =
@@ -119,7 +139,13 @@ assert(v8_snapshot_toolchain != "",
# We reuse the snapshot toolchain for building torque and other generators to
# avoid building v8_libbase on the host more than once. On mips with big endian,
# the snapshot toolchain is the target toolchain and, hence, can't be used.
-v8_generator_toolchain = v8_snapshot_toolchain
+# When using Wine for cross-compilation, mksnapshot is built as a Windows .exe
+# but other generators (torque, etc.) must still be host-native binaries.
+if (v8_win_cross_compile_using_wine && is_win && host_os != "win") {
+ v8_generator_toolchain = host_toolchain
+} else {
+ v8_generator_toolchain = v8_snapshot_toolchain
+}
if (host_cpu == "x64" && v8_current_cpu == "mips64") {
v8_generator_toolchain = "//build/toolchain/linux:clang_x64"
}

View File

@@ -9,7 +9,11 @@ elif [ "`uname`" == "Darwin" ]; then
BUILD_TYPE="mas"
fi
elif [ "`uname`" == "Linux" ]; then
BUILD_TYPE="linux"
if [ "$ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN" == "1" ]; then
BUILD_TYPE="win"
else
BUILD_TYPE="linux"
fi
else
echo "Unsupported platform"
exit 1

View File

@@ -59,6 +59,7 @@ const startServer = async () => {
function waitForCrash (): Promise<CrashInfo> {
return new Promise(resolve => {
emitter.once('crash', (crash) => {
console.log('crash fired', crash);
resolve(crash);
});
});
@@ -69,6 +70,7 @@ const startServer = async () => {
const fields = {} as Record<string, any>;
const files = {} as Record<string, Buffer>;
busboy.on('file', (fieldname, file) => {
console.log('Receiving file for :', fieldname);
const chunks = [] as Array<Buffer>;
file.on('data', (chunk) => {
chunks.push(chunk);
@@ -81,10 +83,12 @@ const startServer = async () => {
fields[fieldname] = val;
});
busboy.on('finish', () => {
console.log('On finish');
// breakpad id must be 16 hex digits.
const reportId = Math.random().toString(16).split('.')[1].padStart(16, '0');
res.end(reportId, async () => {
req.socket.destroy();
console.log('Emmitting crash:', fields);
emitter.emit('crash', { ...fields, ...files });
});
});
@@ -138,10 +142,15 @@ function waitForNewFileInDir (dir: string): Promise<string[]> {
ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_TESTS)('crashReporter module', function () {
describe('should send minidump', () => {
it('when renderer crashes', async () => {
console.log('starting server for renderer crash test');
const { port, waitForCrash } = await startServer();
console.log('Done starting server for renderer crash test');
runCrashApp('renderer', port);
console.log('Waiting for renderer crash');
const crash = await waitForCrash();
console.log('Renderer crash received');
checkCrash('renderer', crash);
console.log('Renderer crash checked');
expect(crash.mainProcessSpecific).to.be.undefined();
});