From 006db65f0838efa2585e084bd79b55ae7f28bab3 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Tue, 10 Mar 2026 22:44:32 +0700 Subject: [PATCH] Remove CUDA/TensorRT providers from onnxruntime-node in managed runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit linuxdeploy scans all ELF files in the AppDir and fails when it finds libonnxruntime_providers_cuda.so which links to libcublasLt.so.12 — a CUDA library not available on CI runners. onnxruntime falls back to the CPU provider when CUDA is absent, so removing these has no functional impact. Co-Authored-By: Claude Opus 4.6 --- packages/desktop/scripts/build-managed-runtime.mjs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/desktop/scripts/build-managed-runtime.mjs b/packages/desktop/scripts/build-managed-runtime.mjs index 0a75e0e4d..6f3ba096a 100644 --- a/packages/desktop/scripts/build-managed-runtime.mjs +++ b/packages/desktop/scripts/build-managed-runtime.mjs @@ -360,6 +360,15 @@ async function pruneOnnxRuntime(runtimeRoot) { await removeIfExists(path.join(onnxRoot, "darwin")); await removeIfExists(path.join(onnxRoot, "win32")); await pruneChildrenExcept(path.join(onnxRoot, "linux"), new Set([process.arch])); + const archDir = path.join(onnxRoot, "linux", process.arch); + if (await pathExists(archDir)) { + const entries = await fs.readdir(archDir); + await Promise.all( + entries + .filter((name) => name.includes("cuda") || name.includes("tensorrt")) + .map((name) => fs.rm(path.join(archDir, name), { force: true })) + ); + } return; } if (process.platform === "win32") {