The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 13:15 UTC
fix(cli): t3 starts on a fresh Ubuntu server without libatomic (#26912)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Oct 29, 2026 at 04:27 UTC
48247dd4ccb4d531789b845bdf03d3f996fd9174
3 files changed
+100
-9
.github/workflows/release-desktop.yml
+9
-3
@@ -390,6 +390,15 @@ jobs:
390
mkdir -p "$target_dir"
391
cp "native/resource-monitor/target/${{ inputs.rust_target }}/release/${binary_name}" "$target_dir/$binary_name"
392
393
+ - uses: ./.github/actions/setup-apt-mirrors
394
+ if: inputs.platform == 'linux'
395
+
396
+ # The Linux archive ships libatomic.so.1 and points t3's RUNPATH at it.
397
+ - name: Install patchelf
398
+ if: inputs.cli_archive && inputs.platform == 'linux'
399
+ shell: bash
400
+ run: command -v patchelf || { sudo apt-get update && sudo apt-get install -y patchelf; }
401
+
402
- name: Build CLI archive
403
if: inputs.cli_archive
404
shell: bash
@@ -433,9 +442,6 @@ jobs:
442
path: release-cli/*
443
if-no-files-found: error
444
436
- - uses: ./.github/actions/setup-apt-mirrors
437
- if: inputs.platform == 'linux'
438
-
445
- name: Install Linux desktop build libraries
446
if: inputs.platform == 'linux'
447
shell: bash
scripts/build-cli-archive.ts
+69
-5
@@ -251,6 +251,67 @@ const stageWebClient = Effect.fn("stageWebClient")(function* (source: string, ta
251
}
252
});
253
254
+/** Node links libatomic.so.1, which Ubuntu server and container images lack, so t3 carries its own. */
255
+const bundleLinuxLibatomic = Effect.fn("bundleLinuxLibatomic")(function* (input: {
256
+ readonly contentDir: string;
257
+ readonly executablePath: string;
258
+}) {
259
+ const fs = yield* FileSystem.FileSystem;
260
+ const path = yield* Path.Path;
261
+ const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
262
+ const ldd = yield* spawner.string(ChildProcess.make("ldd", [input.executablePath]));
263
+ const source = /libatomic\.so\.1 => (\/\S+)/.exec(ldd)?.[1];
264
+ if (source === undefined) {
265
+ return yield* new CliArchiveInputMissingError({
266
+ inputPath: "libatomic.so.1",
267
+ hint: `ldd did not resolve it for ${input.executablePath}. Install libatomic1 on the build host.`,
268
+ });
269
+ }
270
+ yield* fs.makeDirectory(path.join(input.contentDir, "lib"));
271
+ yield* fs.copyFile(source, path.join(input.contentDir, "lib/libatomic.so.1"));
272
+
273
+ // libatomic is GPL-3.0-or-later WITH GCC-exception-3.1, so its terms and source travel with it.
274
+ const owner = yield* spawner.string(
275
+ ChildProcess.make("dpkg-query", ["-S", yield* fs.realPath(source)]),
276
+ );
277
+ // Keep the arch qualifier so a second installed arch cannot add its own line.
278
+ const [, qualifiedPkg, pkg] = /^(([^:\s]+)(?::[^:\s]+)?): /.exec(owner) ?? [];
279
+ const versions = qualifiedPkg
280
+ ? yield* spawner.string(
281
+ ChildProcess.make("dpkg-query", [
282
+ "-W",
283
+ "-f=${Version} ${source:Package} ${source:Version}",
284
+ qualifiedPkg,
285
+ ]),
286
+ )
287
+ : "";
288
+ const [version, sourcePackage, sourceVersion] = versions.trim().split(" ");
289
+ if (!pkg || !version || !sourcePackage || !sourceVersion) {
290
+ return yield* new CliArchiveInputMissingError({
291
+ inputPath: `dpkg package for ${source}`,
292
+ hint: "The archive copies libatomic's license and source reference from its Ubuntu package.",
293
+ });
294
+ }
295
+ const header = [
296
+ `libatomic.so.1 is copied from the Ubuntu package ${pkg} ${version}.`,
297
+ `Source: https://launchpad.net/ubuntu/+source/${sourcePackage}/${sourceVersion}`,
298
+ "License: GPL-3.0-or-later WITH GCC-exception-3.1. The package copyright file and GPL-3 follow.",
299
+ ].join("\n");
300
+ const copyright = yield* fs.readFileString(`/usr/share/doc/${pkg}/copyright`);
301
+ const gpl3 = yield* fs.readFileString("/usr/share/common-licenses/GPL-3");
302
+ yield* fs.writeFileString(
303
+ path.join(input.contentDir, "lib/libatomic.so.1.LICENSE"),
304
+ `${header}\n\n${copyright}\n${gpl3}`,
305
+ );
306
+
307
+ // RUNPATH resolves through symlinks and is not inherited by child processes, unlike LD_LIBRARY_PATH.
308
+ yield* runCommand(
309
+ ChildProcess.make("patchelf", ["--set-rpath", "$ORIGIN/lib", input.executablePath]),
310
+ "patchelf --set-rpath",
311
+ );
312
+ yield* Effect.log(`[cli-archive] Bundled ${source} as lib/libatomic.so.1.`);
313
+});
314
+
315
const MacSigningConfig = Config.all({
316
identity: Config.String("T3CODE_CLI_MAC_SIGN_IDENTITY").pipe(Config.option),
317
appleApiKey: Config.String("APPLE_API_KEY").pipe(Config.option),
@@ -444,11 +505,6 @@ const buildCliArchive = Effect.fn("buildCliArchive")(function* (input: {
505
builtExecutable,
506
`Run \`node apps/server/scripts/cli.ts build-exe${targetKey === hostKey ? "" : ` --target ${targetKey}`}\` first.`,
507
);
447
- // TEMPORARY one-time Node fix. Remove when fixed: https://github.com/nodejs/node/issues/67048
448
- if (input.platform === "linux" && input.arch === "arm64") {
449
- const bytes = yield* fs.readFile(builtExecutable);
450
- yield* Effect.try(() => assertLinuxArm64PageCompatibility(bytes));
451
- }
508
yield* requireInput(path.join(webClient, "index.html"), "Run `vp run --filter t3 build` first.");
509
yield* requireInput(
510
resourceMonitorDir,
@@ -473,6 +529,14 @@ const buildCliArchive = Effect.fn("buildCliArchive")(function* (input: {
529
});
530
531
const executablePath = path.join(contentDir, executableName);
532
+ if (input.platform === "linux") {
533
+ yield* bundleLinuxLibatomic({ contentDir, executablePath });
534
+ }
535
+ // TEMPORARY one-time Node fix. Remove when fixed: https://github.com/nodejs/node/issues/67048
536
+ if (input.platform === "linux" && input.arch === "arm64") {
537
+ const bytes = yield* fs.readFile(executablePath);
538
+ yield* Effect.try(() => assertLinuxArm64PageCompatibility(bytes));
539
+ }
540
if (input.platform === "mac") {
541
yield* signMacArchiveContents({ repoRoot, contentDir, executablePath });
542
} else if (input.platform === "win") {
scripts/smoke-cli-archive.ts
+22
-1
@@ -97,7 +97,12 @@ const smokeCliArchive = Effect.fn("smokeCliArchive")(function* (input: {
97
}
98
const contentDir = path.join(scratch, root);
99
const executable = path.join(contentDir, platform === "win32" ? "t3.exe" : "t3");
100
- for (const required of [executable, path.join(contentDir, "client/index.html")]) {
100
+ const bundledLibatomic = path.join(contentDir, "lib/libatomic.so.1");
101
+ for (const required of [
102
+ executable,
103
+ path.join(contentDir, "client/index.html"),
104
+ ...(platform === "linux" ? [bundledLibatomic, `${bundledLibatomic}.LICENSE`] : []),
105
+ ]) {
106
if (!(yield* fs.exists(required))) {
107
return yield* new CliArchiveSmokeError({
108
step: "checking the archive layout",
@@ -106,6 +111,22 @@ const smokeCliArchive = Effect.fn("smokeCliArchive")(function* (input: {
111
}
112
}
113
114
+ // The runner has libatomic installed; fresh Ubuntu servers do not.
115
+ if (platform === "linux") {
116
+ const ldd = yield* spawner.string(ChildProcess.make("ldd", [executable]));
117
+ // Older glibc prints the path as given, newer prints it resolved; compare both resolved.
118
+ const loaded = /libatomic\.so\.1 => (\/.*) \(0x[0-9a-f]+\)/.exec(ldd)?.[1];
119
+ if (
120
+ loaded === undefined ||
121
+ (yield* fs.realPath(loaded)) !== (yield* fs.realPath(bundledLibatomic))
122
+ ) {
123
+ return yield* new CliArchiveSmokeError({
124
+ step: "checking that t3 loads the bundled libatomic",
125
+ detail: ldd,
126
+ });
127
+ }
128
+ }
129
+
130
const version = yield* runExecutable(executable, ["--version"], contentDir);
131
if (version.exitCode !== 0 || !version.stdout.includes(input.expectVersion)) {
132
return yield* new CliArchiveSmokeError({