desktop build: stage Linux native optional deps for the WSL backend
Windows artifacts also ship the WSL (Linux x64) backend, which loads
Linux-native optional dependencies at runtime -- e.g. ffi-rs's
@yuuang/ffi-rs-linux-x64-gnu. The staged production install set pnpm's
supportedArchitectures to the host platform only (win32/x64), so just the
Windows bindings were fetched. The WSL backend then crash-looped on
require ("Cannot find module '@yuuang/ffi-rs-linux-x64-gnu'") and never
bound its port, surfacing in the app as "Couldn't connect WSL".
For Windows builds, extend supportedArchitectures to also include
linux/x64/glibc so the staged install pulls the Linux optional deps
alongside the Windows ones. Confirmed pnpm then fetches
@yuuang/ffi-rs-linux-x64-gnu into the staged tree.
This commit is contained in:
1 parent
42e863ab74
commit
59ee5c177f
2 files changed
+31
-4
No files matched your search
@@ -157,10 +157,20 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
|
||||
cpu: ["x64"],
|
||||
},
|
||||
});
|
||||
// Windows artifacts also bundle the WSL (Linux x64, glibc) backend, so the
|
||||
// staged install must fetch its native optional deps (e.g. ffi-rs) too.
|
||||
assert.deepStrictEqual(createStageWorkspaceConfig("win", "x64"), {
|
||||
supportedArchitectures: {
|
||||
os: ["win32", "linux"],
|
||||
cpu: ["x64"],
|
||||
libc: ["glibc"],
|
||||
},
|
||||
});
|
||||
assert.deepStrictEqual(createStageWorkspaceConfig("win", "arm64"), {
|
||||
supportedArchitectures: {
|
||||
os: ["win32"],
|
||||
cpu: ["arm64"],
|
||||
os: ["win32", "linux"],
|
||||
cpu: ["arm64", "x64"],
|
||||
libc: ["glibc"],
|
||||
},
|
||||
});
|
||||
assert.deepStrictEqual(createStageWorkspaceConfig("mac", "universal"), {
|
||||
|
||||
@@ -42,6 +42,7 @@ const StageWorkspaceConfig = Schema.Struct({
|
||||
supportedArchitectures: Schema.Struct({
|
||||
os: Schema.Array(Schema.String),
|
||||
cpu: Schema.Array(Schema.String),
|
||||
libc: Schema.optional(Schema.Array(Schema.String)),
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -328,10 +329,26 @@ export function createStageWorkspaceConfig(
|
||||
platform: typeof BuildPlatform.Type,
|
||||
arch: typeof BuildArch.Type,
|
||||
): typeof StageWorkspaceConfig.Type {
|
||||
const hostOs = platform === "mac" ? "darwin" : platform === "win" ? "win32" : "linux";
|
||||
const hostCpu = arch === "universal" ? ["arm64", "x64"] : [arch];
|
||||
// Windows artifacts also bundle the WSL (Linux x64) backend, which loads
|
||||
// Linux-native optional deps at runtime (e.g. @yuuang/ffi-rs-linux-x64-gnu).
|
||||
// Pull the linux-x64 (glibc) variants in addition to the host platform's so
|
||||
// they ship in the asar; without them the WSL backend crash-loops on require
|
||||
// ("Cannot find module '@yuuang/ffi-rs-linux-x64-gnu'").
|
||||
if (platform === "win") {
|
||||
return {
|
||||
supportedArchitectures: {
|
||||
os: Array.from(new Set([hostOs, "linux"])),
|
||||
cpu: Array.from(new Set([...hostCpu, "x64"])),
|
||||
libc: ["glibc"],
|
||||
},
|
||||
};
|
||||
}
|
||||
return {
|
||||
supportedArchitectures: {
|
||||
os: [platform === "mac" ? "darwin" : platform === "win" ? "win32" : "linux"],
|
||||
cpu: arch === "universal" ? ["arm64", "x64"] : [arch],
|
||||
os: [hostOs],
|
||||
cpu: hostCpu,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user