Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Build Linux packages against glibc 2.35

Bitti2c0fd6423947
diff --git a/docs/linux.md b/docs/linux.md
index 673cd53..0ca3263 100644
--- a/docs/linux.md
+++ b/docs/linux.md
@@ -18,16 +18,60 @@ build, through `scripts/package-linux-app.sh`:
The script reuses the frontend that the Windows build has just written to
`dist/` (it is platform independent, and WSL usually has no Linux Node.js), and
runs the Tauri CLI version pinned in `package-lock.json`, installed with cargo
-into `~/.cache/slopus/tauri-cli-<version>` on first use. Cargo builds in
-`~/.cache/slopus/linux-app-target`, on the Linux filesystem.
+into `~/.cache/slopus/glibc235/tauri-cli-<version>` on first use. Cargo builds in
+`~/.cache/slopus/glibc235/linux-app-target`, on the Linux filesystem. These paths
+are separate from caches built against newer distributions.
-One-time WSL setup on Ubuntu (Rust as for the Linux worker):
+## glibc baseline
+
+Linux packages target **glibc 2.35**, the Ubuntu 22.04 baseline. The Windows
+packaging commands select WSL `Ubuntu-22.04`; install it with
+`wsl --install -d Ubuntu-22.04`. `SLOPUS_WSL_DISTRO` can select another WSL
+distribution with glibc <=2.35. Native packaging rejects newer build hosts.
+This follows [Tauri's AppImage guidance](https://tauri.app/distribute/appimage/):
+the app and its GTK/WebKit/GStreamer dependencies must be built on the oldest
+supported base system, since AppImage uses the host's glibc.
+
+Rebuild `lib/slopfab/libslopfab.so` on that baseline too, using slopfab's
+`tools/linux-build.Dockerfile` (CUDA 13) or Ubuntu 22.04 with CUDA 13, and copy
+`dist/linux/libslopfab.so` here before packaging. The old runtime built on
+Ubuntu 26.04 requires glibc 2.43 and is rejected before Cargo starts.
+Changing version strings or replacing only the app executable does not fix
+incompatible bundled libraries.
+
+One-time WSL setup on Ubuntu 22.04 (install Rust as for the Linux worker):
```sh
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev \
- librsvg2-dev libxdo-dev libssl-dev build-essential file patchelf squashfs-tools
+ librsvg2-dev libxdo-dev libssl-dev build-essential file patchelf squashfs-tools \
+ python3 binutils pkg-config gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
+ gstreamer1.0-plugins-bad
+```
+
+An isolated build is also available through Docker in Linux/WSL. Build the
+frontend first with `npm ci && npm run build`, then, after replacing slopfab:
+
+```sh
+docker build -t slopus-linux-glibc235 -f scripts/linux/build.Dockerfile scripts/linux
+docker run --rm -v "$PWD:/src" -v slopus-linux-glibc235:/root/.cache \
+ slopus-linux-glibc235 bash scripts/package-linux-app.sh 0.4.0 artifacts
+docker run --rm -v "$PWD:/src" -v slopus-linux-glibc235:/root/.cache \
+ slopus-linux-glibc235 bash scripts/package-linux-worker.sh 0.4.0 artifacts/Slopus-0.4.0-linux-x64-worker.tar.gz
```
+Use the checkout's version in both commands. For signed builds pass
+`-e TAURI_SIGNING_PRIVATE_KEY -e TAURI_SIGNING_PRIVATE_KEY_PASSWORD`; if the key
+is a file, mount it read-only and set the variable to its path inside the
+container. The toolkit libraries are available for dependency discovery but
+are excluded from the package as before.
+
+Before publishing, `scripts/linux/check_glibc.py` checks the AppImage runtime
+and **every ELF file in the extracted image**, including weak requirements,
+and rejects anything above 2.35. It also checks worker artifacts. Run its
+regressions with `python3 -m unittest discover -s scripts/linux -p test_check_glibc.py`.
+GPU drivers and webview capabilities remain separate requirements; the older
+distribution's WebKitGTK/GStreamer capabilities need functional validation.
+
`release.cmd` passes `TAURI_SIGNING_PRIVATE_KEY` (and its password) into WSL
through `WSLENV`; a Windows key path is translated with `wslpath`. Without a key,
`package.cmd` builds the same packages unsigned.
diff --git a/package.cmd b/package.cmd
index 11f75e5..3ab1558 100644
--- a/package.cmd
+++ b/package.cmd
@@ -175,7 +175,8 @@ where.exe wsl.exe >nul 2>nul || (
echo Linux: skipped - WSL was not found. Releases require it.
exit /b 0
)
-wsl.exe --cd "%ROOT_DIR%" -e bash scripts/package-linux-worker.sh "%APP_VERSION%" "artifacts/%LINUX_WORKER_NAME%" || exit /b 1
+if not defined SLOPUS_WSL_DISTRO set "SLOPUS_WSL_DISTRO=Ubuntu-22.04"
+wsl.exe --distribution "%SLOPUS_WSL_DISTRO%" --cd "%ROOT_DIR%" -e bash scripts/package-linux-worker.sh "%APP_VERSION%" "artifacts/%LINUX_WORKER_NAME%" || exit /b 1
echo Linux: %LINUX_WORKER_NAME%
exit /b 0
@@ -186,7 +187,8 @@ where.exe wsl.exe >nul 2>nul || (
echo Linux app: skipped - WSL was not found. Releases require it.
exit /b 0
)
-wsl.exe --cd "%ROOT_DIR%" -e bash scripts/package-linux-app.sh "%APP_VERSION%" artifacts || exit /b 1
+if not defined SLOPUS_WSL_DISTRO set "SLOPUS_WSL_DISTRO=Ubuntu-22.04"
+wsl.exe --distribution "%SLOPUS_WSL_DISTRO%" --cd "%ROOT_DIR%" -e bash scripts/package-linux-app.sh "%APP_VERSION%" artifacts || exit /b 1
echo Linux app: %LINUX_APP_STEM%.deb, .rpm and .AppImage
exit /b 0
diff --git a/release.cmd b/release.cmd
index 7253e49..415174b 100644
--- a/release.cmd
+++ b/release.cmd
@@ -255,7 +255,8 @@ where.exe wsl.exe >nul 2>nul || (
echo Install WSL with Ubuntu and Rust, then retry.
exit /b 1
)
-wsl.exe --cd "%ROOT_DIR%" -e bash scripts/package-linux-worker.sh "%APP_VERSION%" "artifacts/%LINUX_WORKER_NAME%" || exit /b 1
+if not defined SLOPUS_WSL_DISTRO set "SLOPUS_WSL_DISTRO=Ubuntu-22.04"
+wsl.exe --distribution "%SLOPUS_WSL_DISTRO%" --cd "%ROOT_DIR%" -e bash scripts/package-linux-worker.sh "%APP_VERSION%" "artifacts/%LINUX_WORKER_NAME%" || exit /b 1
echo Linux: %LINUX_WORKER_NAME%
exit /b 0
@@ -273,7 +274,8 @@ if defined WSLENV (
) else (
set "WSLENV=TAURI_SIGNING_PRIVATE_KEY:TAURI_SIGNING_PRIVATE_KEY_PASSWORD"
)
-wsl.exe --cd "%ROOT_DIR%" -e bash scripts/package-linux-app.sh "%APP_VERSION%" artifacts || exit /b 1
+if not defined SLOPUS_WSL_DISTRO set "SLOPUS_WSL_DISTRO=Ubuntu-22.04"
+wsl.exe --distribution "%SLOPUS_WSL_DISTRO%" --cd "%ROOT_DIR%" -e bash scripts/package-linux-app.sh "%APP_VERSION%" artifacts || exit /b 1
echo Linux app: %LINUX_APP_STEM%.deb, .rpm and .AppImage
exit /b 0
diff --git a/scripts/linux/build.Dockerfile b/scripts/linux/build.Dockerfile
new file mode 100644
index 0000000..51232d7
--- /dev/null
+++ b/scripts/linux/build.Dockerfile
@@ -0,0 +1,13 @@
+# Match slopfab's glibc baseline, including the libraries linuxdeploy bundles.
+FROM nvidia/cuda:13.0.2-devel-ubuntu22.04
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ ca-certificates curl git build-essential pkg-config python3 binutils \
+ libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev \
+ librsvg2-dev libxdo-dev libssl-dev file patchelf squashfs-tools \
+ gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
+ && rm -rf /var/lib/apt/lists/*
+RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o /tmp/rustup.sh \
+ && sh /tmp/rustup.sh -y --profile minimal --default-toolchain 1.99.0 \
+ && rm /tmp/rustup.sh
+ENV PATH="/root/.cargo/bin:${PATH}"
+WORKDIR /src
diff --git a/scripts/linux/check_glibc.py b/scripts/linux/check_glibc.py
new file mode 100644
index 0000000..6fefa5c
--- /dev/null
+++ b/scripts/linux/check_glibc.py
@@ -0,0 +1,95 @@
+#!/usr/bin/env python3
+"""Reject Linux release artifacts requiring a glibc newer than Ubuntu 22.04."""
+import argparse
+import os
+from pathlib import Path
+import re
+import subprocess
+import sys
+
+BASELINE = (2, 35)
+
+
+def requirements(output):
+ # Definitions describe exported versions, not requirements. Include weak
+ # version needs too: the loader can warn about these before main() runs.
+ needed = False
+ for line in output.splitlines():
+ if line.startswith("Version "):
+ needed = line.startswith("Version needs section")
+ if needed:
+ yield from re.findall(r"Name: (GLIBC_\S+)", line)
+
+
+def unsupported(version):
+ suffix = version.removeprefix("GLIBC_")
+ if not re.fullmatch(r"\d+(?:\.\d+)+", suffix):
+ # GLIBC_ABI_DT_RELR (2.36) and private/unknown ABIs are not portable.
+ return True
+ parts = tuple(map(int, suffix.split(".")))
+ return parts > BASELINE + (0,) * max(0, len(parts) - len(BASELINE))
+
+
+def check_host():
+ value = os.confstr("CS_GNU_LIBC_VERSION")
+ if not value or unsupported("GLIBC_" + value.split()[-1]):
+ raise ValueError(
+ f"build host uses {value}; release builds require glibc <= 2.35. "
+ "Use Ubuntu 22.04 (WSL Ubuntu-22.04 or the Linux build container) "
+ "and a fresh build directory."
+ )
+ print(f"glibc: build host {value} meets the 2.35 baseline")
+
+
+def check_paths(paths):
+ count = 0
+ failures = []
+ for argument in paths:
+ root = Path(argument)
+ if not root.exists():
+ raise ValueError(f"missing artifact: {root}")
+ candidates = sorted(root.rglob("*")) if root.is_dir() else [root]
+ root_count = 0
+ for path in candidates:
+ if not path.is_file():
+ continue
+ with path.open("rb") as stream:
+ if stream.read(4) != b"\x7fELF":
+ continue
+ result = subprocess.run(
+ ["readelf", "--wide", "--version-info", str(path)],
+ check=True, text=True, capture_output=True,
+ env={**os.environ, "LC_ALL": "C"},
+ )
+ root_count += 1
+ bad = sorted({v for v in requirements(result.stdout) if unsupported(v)})
+ if bad:
+ failures.append(f"{path}: {', '.join(bad)}")
+ if not root_count:
+ raise ValueError(f"no ELF files found in {root}")
+ count += root_count
+ if failures:
+ raise ValueError("requires newer/unsupported glibc (maximum 2.35):\n" + "\n".join(failures))
+ print(f"glibc: checked {count} ELF files; all requirements <= 2.35")
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("--check-host", action="store_true")
+ parser.add_argument("paths", nargs="*")
+ args = parser.parse_args()
+ if not args.check_host and not args.paths:
+ parser.error("provide --check-host or artifact files/directories")
+ try:
+ if args.check_host:
+ check_host()
+ if args.paths:
+ check_paths(args.paths)
+ except (OSError, ValueError, subprocess.CalledProcessError) as error:
+ print(f"glibc: {error}", file=sys.stderr)
+ return 1
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/scripts/linux/linuxdeploy-plugin-gstreamer.sh b/scripts/linux/linuxdeploy-plugin-gstreamer.sh
index 34852b4..f86e21e 100644
--- a/scripts/linux/linuxdeploy-plugin-gstreamer.sh
+++ b/scripts/linux/linuxdeploy-plugin-gstreamer.sh
@@ -25,7 +25,9 @@ ALLOWED_PLUGINS=(
audioconvert audioresample audiorate audioparsers volume interleave audiomixer
wavparse flac opus opusparse vorbis ogg mpg123 id3demux apetag pulseaudio
# Video
- videoconvertscale videorate videofilter videoparsersbad codecalpha
+ # GStreamer 1.20 (Ubuntu 22.04) has separate convert/scale plugins;
+ # newer releases combine them into videoconvertscale.
+ videoconvert videoscale videoconvertscale videorate videofilter videoparsersbad codecalpha
codectimestamper opengl alpha
# Containers
isomp4 matroska
diff --git a/scripts/linux/test_check_glibc.py b/scripts/linux/test_check_glibc.py
new file mode 100644
index 0000000..e12d096
--- /dev/null
+++ b/scripts/linux/test_check_glibc.py
@@ -0,0 +1,52 @@
+import contextlib
+import io
+from pathlib import Path
+import subprocess
+import tempfile
+import unittest
+
+import check_glibc
+
+
+class GlibcTests(unittest.TestCase):
+ def test_version_needs_including_weak(self):
+ output = """Version definition section '.gnu.version_d' contains 1 entry:
+ Name: GLIBC_2.99
+Version needs section '.gnu.version_r' contains 2 entries:
+ Name: GLIBC_2.35 Flags: none
+ Name: GLIBC_2.39 Flags: WEAK
+"""
+ self.assertEqual(list(check_glibc.requirements(output)), ["GLIBC_2.35", "GLIBC_2.39"])
+
+ def test_numeric_versions_and_special_abis(self):
+ for version in ["2.2.5", "2.9", "2.34", "2.35", "2.35.0"]:
+ self.assertFalse(check_glibc.unsupported("GLIBC_" + version))
+ for version in ["2.35.1", "2.38", "2.39", "2.43", "2.100", "PRIVATE", "ABI_DT_RELR"]:
+ self.assertTrue(check_glibc.unsupported("GLIBC_" + version))
+
+ def test_real_elf_tree(self):
+ # A dependency exports a deliberately too-new version. Its consumer
+ # must fail, while the exporting library alone must pass.
+ with tempfile.TemporaryDirectory(prefix="glibc test ") as directory:
+ root = Path(directory)
+ (root / "provider.c").write_text("int future(void) { return 0; }\n")
+ (root / "consumer.c").write_text("extern int future(void); int use(void) { return future(); }\n")
+ (root / "versions").write_text("GLIBC_2.43 { global: future; };\n")
+ subprocess.run(["cc", "-shared", "-fPIC", "provider.c", "-Wl,--version-script=versions", "-o", "libprovider.so"], cwd=root, check=True)
+ subprocess.run(["cc", "-shared", "-fPIC", "consumer.c", "-L.", "-lprovider", "-o", "plugin.so"], cwd=root, check=True)
+ (root / "readme").write_text("GLIBC_2.99 is just text")
+ with contextlib.redirect_stdout(io.StringIO()):
+ check_glibc.check_paths([root / "libprovider.so"])
+ with self.assertRaisesRegex(ValueError, r"plugin.so: GLIBC_2.43"):
+ check_glibc.check_paths([root])
+
+ def test_missing_or_empty_artifacts_fail(self):
+ with tempfile.TemporaryDirectory() as directory:
+ with self.assertRaisesRegex(ValueError, "no ELF"):
+ check_glibc.check_paths([directory])
+ with self.assertRaisesRegex(ValueError, "missing artifact"):
+ check_glibc.check_paths([Path(directory) / "missing.so"])
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/scripts/package-linux-app.sh b/scripts/package-linux-app.sh
index fc5ae8f..18819a2 100644
--- a/scripts/package-linux-app.sh
+++ b/scripts/package-linux-app.sh
@@ -31,6 +31,7 @@ if [[ $(uname -s) != Linux || $(uname -m) != x86_64 ]]; then
printf 'package-linux-app: run on x86_64 Linux (including WSL).\n' >&2
exit 2
fi
+python3 "$root/scripts/linux/check_glibc.py" --check-host
# rustup installs into ~/.cargo; a non-login WSL shell has not sourced it.
if ! command -v cargo >/dev/null && [[ -f $HOME/.cargo/env ]]; then
# shellcheck source=/dev/null
@@ -44,7 +45,7 @@ missing=()
for module in webkit2gtk-4.1 gtk+-3.0 librsvg-2.0 ayatana-appindicator3-0.1; do
pkg-config --exists "$module" 2>/dev/null || missing+=("$module")
done
-for tool in file patchelf unsquashfs; do
+for tool in file patchelf unsquashfs readelf; do
command -v "$tool" >/dev/null || missing+=("$tool")
done
if ((${#missing[@]})); then
@@ -56,6 +57,7 @@ runtime="$root/lib/slopfab/libslopfab.so"
if [[ $(head -c 4 "$runtime" 2>/dev/null | od -An -c | tr -d ' ') != '177ELF' ]]; then
fail "$runtime is missing or a Git LFS pointer. Run git lfs pull."
fi
+python3 "$root/scripts/linux/check_glibc.py" "$runtime"
# A Windows checkout has CRLF line endings; keep the \r out of the comparison.
cargo_version=$(sed -n '/^\[workspace.package\]/,/^\[/s/^version *= *"\(.*\)"/\1/p' "$root/src-tauri/Cargo.toml" | tr -d '\r')
@@ -70,7 +72,7 @@ asset=$(find "$root/dist/assets" -maxdepth 1 -name '*.js' -printf '%f\n' 2>/dev/
# The same CLI version as package-lock.json, installed once per version.
cli_version=$(sed -n '/"node_modules\/@tauri-apps\/cli": {/,/}/s/.*"version": "\(.*\)".*/\1/p' "$root/package-lock.json" | tr -d '\r' | head -n 1)
[[ -n $cli_version ]] || fail 'could not read the @tauri-apps/cli version from package-lock.json.'
-tools="$HOME/.cache/slopus/tauri-cli-$cli_version"
+tools="$HOME/.cache/slopus/glibc235/tauri-cli-$cli_version"
if [[ ! -x $tools/bin/cargo-tauri ]]; then
printf 'package-linux-app: installing tauri-cli %s (once)...\n' "$cli_version"
cargo install tauri-cli --version "=$cli_version" --locked --root "$tools"
@@ -92,7 +94,7 @@ else
signed=0
fi
-target_dir=${SLOPUS_LINUX_TARGET_DIR:-"$HOME/.cache/slopus/linux-app-target"}
+target_dir=${SLOPUS_LINUX_TARGET_DIR:-"$HOME/.cache/slopus/glibc235/linux-app-target"}
bundle="$target_dir/release/bundle"
rm -rf -- "$bundle"
mkdir -p "$target_dir/.tauri"
@@ -121,6 +123,9 @@ trap 'rm -rf -- "$extract"' EXIT
# Preserve the archived modes: --appimage-extract creates directories as 0700,
# which would make permission checks report failures unrelated to the package.
unsquashfs -no-progress -offset "$("$appimage" --appimage-offset)" -d "$extract/squashfs-root" "$appimage" >/dev/null
+# Check the outer runtime as well as every ELF inside, including GTK, WebKit,
+# GStreamer helpers/plugins and libslopfab. Weak version needs count too.
+python3 "$root/scripts/linux/check_glibc.py" "$appimage" "$extract/squashfs-root"
forbidden=$(find "$extract/squashfs-root" -type f \( -name 'libavcodec.so*' -o -name 'libavformat.so*' \
-o -name 'libavutil.so*' -o -name 'libavfilter.so*' -o -name 'libavdevice.so*' -o -name 'libswscale.so*' \
-o -name 'libswresample.so*' -o -name 'libpostproc.so*' -o -name 'libx264*.so*' -o -name 'libx265*.so*' -o -name 'libgstlibav.so' \
diff --git a/scripts/package-linux-worker.sh b/scripts/package-linux-worker.sh
index 63f1478..b60c12b 100644
--- a/scripts/package-linux-worker.sh
+++ b/scripts/package-linux-worker.sh
@@ -21,6 +21,7 @@ if [[ $(uname -s) != Linux || $(uname -m) != x86_64 ]]; then
printf 'package-linux-worker: run on x86_64 Linux (including WSL).\n' >&2
exit 2
fi
+python3 "$root/scripts/linux/check_glibc.py" --check-host
# rustup installs into ~/.cargo; a non-login WSL shell has not sourced it.
if ! command -v cargo >/dev/null && [[ -f $HOME/.cargo/env ]]; then
# shellcheck source=/dev/null
@@ -38,7 +39,8 @@ if [[ $(head -c 4 "$runtime" 2>/dev/null | od -An -c | tr -d ' ') != '177ELF' ]]
exit 1
fi
-target_dir=${SLOPUS_LINUX_TARGET_DIR:-"$HOME/.cache/slopus/linux-worker-target"}
+python3 "$root/scripts/linux/check_glibc.py" "$runtime"
+target_dir=${SLOPUS_LINUX_TARGET_DIR:-"$HOME/.cache/slopus/glibc235/linux-worker-target"}
CARGO_TARGET_DIR=$target_dir cargo build --release --locked \
--manifest-path "$root/src-tauri/Cargo.toml" -p slopus-worker
@@ -56,6 +58,7 @@ package="$stage/$name"
mkdir -p "$package"
install -m 0755 "$target_dir/release/slopus-worker" "$package/slopus-worker"
install -m 0755 "$runtime" "$package/libslopfab.so"
+python3 "$root/scripts/linux/check_glibc.py" "$package"
cat > "$package/README.txt" <<EOF
Slopus worker $version (linux-x64)
@@ -65,7 +68,7 @@ Slopus finds it automatically; choose it in Settings, Workers. Open TCP port 473
Keep libslopfab.so beside slopus-worker.
REQUIREMENTS
- x86_64 Linux with glibc, an NVIDIA GPU, the NVIDIA driver (libcuda.so.1) and
+ x86_64 Linux with glibc 2.35 or newer, an NVIDIA GPU, the NVIDIA driver (libcuda.so.1) and
CUDA 13 cuBLAS (libcublas.so.13). The worker finds cuBLAS in /usr/local/cuda*
if the system linker does not. The Vulkan backend (--backend vulkan) also needs
the NVIDIA driver and cuBLAS, because the runtime links them. FFmpeg 8 shared