Skip to content

Commit 7fee2a8

Browse files
Tajudeenclaude
andcommitted
fix(linux-build): install patch utility and try GCC 11 for Electron header compat
Two fixes for the 'fatal error: source_location: No such file or directory' failure in native-keymap compilation on focal-* containers: 1. deps.sh: install the `patch` utility. preinstall.ts calls `patch` to apply v8-source-location.patch to downloaded Electron headers, but the focal Docker images don't ship `patch` by default — causing execFileSync to throw ENOENT and silently skip the patch. 2. package_bin.sh: try apt-get install g++-11 before falling back to g++-10. GCC 11 ships with <source_location> natively (C++20), avoiding the need for the header patch entirely on containers where GCC 11 is available. Also set VSCODE_FORCE_INSTALL=1 to ensure preinstall.ts always runs installHeaders() even if a stale state hash is somehow present. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8a008d3 commit 7fee2a8

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

‎build/linux/deps.sh‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ set -ex
44

55
sudo apt-get update -y
66

7-
sudo apt-get install -y libkrb5-dev
7+
# patch is required by preinstall.ts to apply v8-source-location.patch to Electron headers
8+
sudo apt-get install -y libkrb5-dev patch
89

910
if [[ "${VSCODE_ARCH}" == "arm64" ]]; then
1011
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu crossbuild-essential-arm64

‎build/linux/package_bin.sh‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,20 +174,20 @@ if [[ -z "${VSCODE_SKIP_SETUPENV}" ]]; then
174174
fi
175175
fi
176176

177-
# Node.js 22 C++ headers require GCC 10+ (<source_location> C++20 header).
178-
# focal containers ship with GCC 9 by default; upgrade if possible.
179-
if ! command -v g++-10 &>/dev/null && ! command -v g++-11 &>/dev/null; then
180-
echo "GCC 10+ not found — attempting apt-get install g++-10..."
181-
apt-get install -yq g++-10 gcc-10 2>/dev/null || echo "Warning: apt-get install g++-10 failed"
177+
# Electron 39+ headers require <source_location> (C++20, GCC 11+).
178+
# focal containers ship with GCC 9/10 by default; try GCC 11 first, then 10.
179+
if ! command -v g++-11 &>/dev/null; then
180+
echo "GCC 11 not found — attempting apt-get install g++-11..."
181+
apt-get install -yq g++-11 gcc-11 2>/dev/null || echo "Warning: apt-get install g++-11 failed"
182182
fi
183-
if command -v g++-10 &>/dev/null; then
184-
export CXX=g++-10 CC=gcc-10
185-
echo "Using GCC 10 for native module compilation"
186-
elif command -v g++-11 &>/dev/null; then
183+
if command -v g++-11 &>/dev/null; then
187184
export CXX=g++-11 CC=gcc-11
188185
echo "Using GCC 11 for native module compilation"
186+
elif command -v g++-10 &>/dev/null; then
187+
export CXX=g++-10 CC=gcc-10
188+
echo "Using GCC 10 for native module compilation"
189189
else
190-
echo "Warning: GCC 10+ not available; native-keymap may fail to compile with Node.js 22 headers"
190+
echo "Warning: GCC 11/10 not available; native module compilation may fail"
191191
fi
192192

193193
# For alternative architectures, skip postinstall scripts to avoid unsupported platform errors
@@ -197,6 +197,12 @@ if [[ "${VSCODE_ARCH}" == "riscv64" ]] || [[ "${VSCODE_ARCH}" == "ppc64le" ]] ||
197197
echo "Skipping postinstall scripts for ${VSCODE_ARCH} (unsupported by some packages)"
198198
fi
199199

200+
# Force preinstall.ts to run fully (bypass isUpToDate state-hash check).
201+
# The compile-step artifact doesn't include node_modules/.postinstall-state,
202+
# so preinstall normally re-runs anyway — but VSCODE_FORCE_INSTALL=1 makes
203+
# this explicit and ensures installHeaders() is called on every packaging run.
204+
export VSCODE_FORCE_INSTALL=1
205+
200206
for i in {1..5}; do # try 5 times
201207
npm ci ${NPM_CI_OPTS} && break
202208
if [[ $i -eq 5 ]]; then

0 commit comments

Comments
 (0)