Skip to content

Commit 025fa19

Browse files
committed
fix(release): ship claude sidecar as resource, not externalBin
Bun-compiled binaries (~100MB) have an unusual ELF layout: the dynamic section sits at offset 96MB, after Bun's appended JS payload. patchelf, which linuxdeploy invokes during AppImage bundling to set rpath on every ELF in usr/bin/, corrupts the binary when it tries to relocate that dynamic section. The corruption only manifests on the gtk plugin's recursive linuxdeploy pass: ldd then fails on the corrupted binary, linuxdeploy throws std::runtime_error, and the AppImage build aborts: [gtk/stderr] terminate called after throwing an instance of 'std::runtime_error' [gtk/stderr] what(): Failed to run ldd: exited with code 1 agent-browser (8MB, normal layout) survives the same patchelf step with only a warning, which is why it's been shipping fine. Move the sidecar from externalBin (usr/bin/) to resources (usr/share/), which linuxdeploy does not scan. Update setup() to resolve the bundled path via AppHandle::path().resource_dir() and pin it via CODEMUX_CLAUDE_SIDECAR_PATH so the adapter (which has no AppHandle access) can find it.
1 parent c34095b commit 025fa19

2 files changed

Lines changed: 36 additions & 2 deletions

File tree

src-tauri/src/lib.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,38 @@ pub fn run() {
518518

519519
control::spawn_control_server(app.handle().clone());
520520

521+
// Resolve the bundled claude-agent sidecar from Tauri's resource
522+
// dir and pin the path via env var so the adapter (which has no
523+
// AppHandle access at construction time) can find it. Only one
524+
// file matches the `codemux-claude-sidecar-*` glob in resources/
525+
// — the per-target binary staged by scripts/build-claude-sidecar.sh
526+
// for whichever triple this build was compiled against.
527+
//
528+
// The bun --compile binary is huge (~100 MB) with the dynamic
529+
// section at offset 96 MB, which patchelf corrupts when run by
530+
// linuxdeploy during AppImage bundling. Shipping it as a resource
531+
// (usr/share/...) instead of an externalBin (usr/bin/) keeps it
532+
// out of linuxdeploy's scan path. See `tauri.conf.json` for the
533+
// mirror change.
534+
if let Ok(resource_dir) = app.handle().path().resource_dir() {
535+
let triple = agent_provider::claude::sidecar_path::target_triple();
536+
let ext = if cfg!(windows) { ".exe" } else { "" };
537+
let sidecar = resource_dir
538+
.join("binaries")
539+
.join(format!("codemux-claude-sidecar-{triple}{ext}"));
540+
if sidecar.exists()
541+
&& std::env::var(
542+
agent_provider::claude::sidecar_path::SIDECAR_PATH_ENV,
543+
)
544+
.is_err()
545+
{
546+
std::env::set_var(
547+
agent_provider::claude::sidecar_path::SIDECAR_PATH_ENV,
548+
sidecar,
549+
);
550+
}
551+
}
552+
521553
// Agent-chat provider registry initialisation.
522554
//
523555
// When `enable_agent_chat` is on, spawn concrete Claude /

src-tauri/tauri.conf.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
"createUpdaterArtifacts": true,
3131
"targets": "all",
3232
"externalBin": [
33-
"binaries/agent-browser",
34-
"binaries/codemux-claude-sidecar"
33+
"binaries/agent-browser"
34+
],
35+
"resources": [
36+
"binaries/codemux-claude-sidecar-*"
3537
],
3638
"linux": {
3739
"deb": {

0 commit comments

Comments
 (0)