diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6e92382..1af54dbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,7 +56,7 @@ jobs: - name: Install Linux build deps run: | sudo apt-get update - sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev librsvg2-dev libgirepository1.0-dev libgtk-3-bin libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-dev patchelf file desktop-file-utils xdg-user-dirs shellcheck libssl-dev libunwind-dev libvulkan-dev libgl1-mesa-dev libasound2-dev libsecret-1-dev + sudo apt-get install -y clang cmake ninja-build pkg-config jq libgtk-3-dev librsvg2-dev libgirepository1.0-dev libgtk-3-bin libgdk-pixbuf2.0-bin libgdk-pixbuf-2.0-dev dpkg-dev patchelf file desktop-file-utils xdg-user-dirs shellcheck libssl-dev libunwind-dev libvulkan-dev libgl1-mesa-dev libasound2-dev libsecret-1-dev - uses: actions/cache@v4 with: path: ~/.cache/meshcore-open/appimage @@ -73,6 +73,7 @@ jobs: mkdir -p build/appimage-runtime docker run --rm --user "$(id -u):$(id -g)" --mount "type=bind,source=$PWD/build/linux/x64/release/meshcore-open-x86_64.AppImage,target=/artifact.AppImage,readonly" --mount "type=bind,source=$PWD/scripts/appimage/test_runtime.sh,target=/test_runtime.sh,readonly" --mount "type=bind,source=$PWD/build/appimage-runtime,target=/results" meshcore-appimage-runtime xvfb-run -a bash /test_runtime.sh /artifact.AppImage /results - uses: actions/upload-artifact@v4 + if: always() with: name: linux-x86_64-appimage path: | @@ -80,7 +81,7 @@ jobs: build/linux/x64/release/appimage-audit.txt build/linux/x64/release/appimage-tools.json build/appimage-runtime/ - if-no-files-found: error + if-no-files-found: warn macos: runs-on: macos-latest diff --git a/CLAUDE.md b/CLAUDE.md index 87d9ceab..1362a3a7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -24,7 +24,7 @@ bash scripts/appimage/test_packaging.sh The versioned web build uses `dart run build_pipe:build` (also `bun run build`). Web deployment pins Flutter 3.41.2; Linux packaging uses the SDK pin in `scripts/appimage-tools.json`; other CI jobs track stable. Read `pubspec.yaml` for current app version and dependencies rather than copying them into this guide. -Linux Release installs also generate `build/linux/x64/release/meshcore-open-x86_64.AppImage` using linuxdeploy/GTK and an explicit appimagetool invocation. Tools and the runtime download automatically with pinned SHA-256 checksums. `MESHCORE_BUILD_APPIMAGE=0` skips packaging at install time, without a CMake cache reset. Debug/Profile are unchanged. Nix-linked bundles trigger an isolated Ubuntu rebuild through an available Podman/Docker engine; see [Linux AppImage](README.md#linux-appimage) for prerequisites, cache/offline behavior and limitations. Preserve binary/data/lib adjacency and nested native assets when changing packaging. +Linux Release installs also generate `build/linux/x64/release/meshcore-open-x86_64.AppImage` using linuxdeploy/GTK and an explicit appimagetool invocation. Tools and the runtime download automatically with pinned SHA-256 checksums. `MESHCORE_BUILD_APPIMAGE=0` skips packaging at install time, without a CMake cache reset. Debug/Profile are unchanged. Nix-linked bundles and hosts with glibc newer than the pinned baseline trigger an isolated Ubuntu rebuild through an available Podman/Docker engine. Rootless Podman uses `--userns=keep-id` for host-owned bind mounts; see [Linux AppImage](README.md#linux-appimage) for prerequisites, cache/offline behavior and limitations. Preserve binary/data/lib adjacency and nested native assets when changing packaging. For Linux, use `nix develop`; see [Linux with Nix](README.md#linux-with-nix) for the pinned SDK, native build checks, cache troubleshooting, and Sysprof host prerequisites. diff --git a/README.md b/README.md index 7470da2b..d69a5524 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ dependencies: ```bash sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev \ librsvg2-dev libgirepository1.0-dev libgtk-3-bin libgdk-pixbuf2.0-bin \ - libgdk-pixbuf2.0-dev patchelf binutils curl jq file desktop-file-utils xdg-user-dirs + libgdk-pixbuf-2.0-dev dpkg-dev patchelf binutils curl jq file desktop-file-utils xdg-user-dirs ``` The build automatically downloads checksum-verified linuxdeploy, its GTK @@ -181,6 +181,14 @@ valid cached tools offline, but Flutter dependencies and native-library downloads must also be available. A packaging failure fails the enabled build, without publishing a stale image as a new artifact. +Hosts with newer glibc than the pinned baseline (2.39 for Ubuntu 24.04), +including Ubuntu 26.04 runners under `ubuntu-latest`, use the same isolated +Ubuntu rebuild as Nix. A usable Podman or Docker engine is required on those +hosts. Rootless Podman preserves your UID/GID with `--userns=keep-id`, so the +container can write the host-owned output and cache directories. The original +native bundle is retained. Custom targets, obfuscation and split-debug-info +require a bundle-only build when container rebuilding is needed. + The image includes Flutter assets, native plugins, ONNX Runtime and redistributable GTK dependencies. It does not include graphics drivers, BlueZ services, USB permissions, downloaded inference models or user data. The GTK diff --git a/documentation/troubleshooting.md b/documentation/troubleshooting.md index 886af097..660878c6 100644 --- a/documentation/troubleshooting.md +++ b/documentation/troubleshooting.md @@ -33,9 +33,10 @@ offline, but dependency downloads and first-time container setup still need network access. Use `MESHCORE_BUILD_APPIMAGE=0 flutter build linux --release` for a bundle-only build, including ARM builds. -For a Nix build, verify that your user can access Podman or Docker without -interactive privilege escalation. The image is rebuilt in Ubuntu, not made -from the Nix-linked executable. The regular Nix bundle remains available if +For a Nix build or a host with glibc newer than the pinned Ubuntu baseline, +verify that your user can access Podman or Docker without interactive +privilege escalation. The image is rebuilt in Ubuntu, not made from the +host-linked executable. The regular native bundle remains available if packaging fails. Custom targets, obfuscation and split-debug-info are not supported by the container rebuild. diff --git a/lib/widgets/network_map_online_layer.dart b/lib/widgets/network_map_online_layer.dart index f9782058..c2581f57 100644 --- a/lib/widgets/network_map_online_layer.dart +++ b/lib/widgets/network_map_online_layer.dart @@ -109,15 +109,12 @@ Color networkMapStatusColor(NetworkMapRepeaterStatus status) { }; } - - /// Above this many in-view repeaters, hexagons and marker shadows are skipped. const int networkMapDenseNodeCount = 30; /// Above this many in-view links, each line is one stroke at half width const int networkMapDenseLinkCount = 70; - /// Full style is a 3.5 px confirmed stroke or a 2.5 px unconfirmed stroke, /// each with a 1 px border. Simple style keeps the pattern and drops the /// border, so the painter records the line once, at half the stroke width. @@ -136,8 +133,6 @@ Polyline _onlineLinkPolyline(NetworkMapLink link, {required bool simple}) { ); } - - /// Map layers for the online network: links, repeater hexagons and a /// tappable center marker so small cells stay visible when zoomed out. /// diff --git a/scripts/appimage-tools.json b/scripts/appimage-tools.json index f8762768..209e5ccc 100644 --- a/scripts/appimage-tools.json +++ b/scripts/appimage-tools.json @@ -1,5 +1,6 @@ { "ubuntu": "ubuntu:24.04@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852", + "glibc": "2.39", "flutter": { "version": "3.47.4", "url": "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.47.4-stable.tar.xz", diff --git a/scripts/appimage/Dockerfile b/scripts/appimage/Dockerfile index 2d9b4106..9a14a2eb 100644 --- a/scripts/appimage/Dockerfile +++ b/scripts/appimage/Dockerfile @@ -5,8 +5,8 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates clang cmake ninja-build pkg-config libgtk-3-dev \ librsvg2-dev libgirepository1.0-dev libgdk-pixbuf-2.0-dev libgtk-3-bin \ - libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-dev binutils patchelf curl jq \ - file desktop-file-utils xdg-user-dirs git rsync unzip xz-utils make g++ \ + libgdk-pixbuf2.0-bin binutils patchelf curl jq \ + file desktop-file-utils xdg-user-dirs git rsync unzip xz-utils make g++ dpkg-dev \ libssl-dev libunwind-dev libvulkan-dev libgl1-mesa-dev libglu1-mesa-dev \ libasound2-dev libsecret-1-dev \ && rm -rf /var/lib/apt/lists/* diff --git a/scripts/appimage/test_packaging.sh b/scripts/appimage/test_packaging.sh index 1e338778..32854598 100644 --- a/scripts/appimage/test_packaging.sh +++ b/scripts/appimage/test_packaging.sh @@ -50,4 +50,60 @@ assert_fails download_verified "file://$temporary/input" \ printf 'corruption\n' >> "$temporary/cache/tool" assert_fails download_verified "file://$temporary/input" "$checksum" "$temporary/cache/tool" +mkdir -p "$temporary/project/scripts/appimage" +touch "$temporary/project/pubspec.lock" +cp "$project/scripts/appimage/Dockerfile" "$temporary/project/scripts/appimage/" + +# shellcheck disable=SC2329 +podman() { + case "$1" in + info) [[ "$mock_engine" == podman ]] ;; + image) return 0 ;; + run) printf '%s\n' "$@" > "$temporary/container-arguments" ;; + *) return 1 ;; + esac +} + +# shellcheck disable=SC2329 +docker() { + case "$1" in + info|image) return 0 ;; + run) printf '%s\n' "$@" > "$temporary/container-arguments" ;; + *) return 1 ;; + esac +} + +mock_engine=podman +package_container "$temporary/project" "$temporary/output" \ + "$project/scripts/appimage-tools.json" "$temporary/container-cache" +grep -Fxq -- '--userns=keep-id' "$temporary/container-arguments" +grep -Fxq -- "$(id -u):$(id -g)" "$temporary/container-arguments" + +mock_engine=docker +package_container "$temporary/project" "$temporary/output" \ + "$project/scripts/appimage-tools.json" "$temporary/container-cache" +assert_fails grep -Fxq -- '--userns=keep-id' "$temporary/container-arguments" +grep -Fxq -- "$(id -u):$(id -g)" "$temporary/container-arguments" +unset -f podman docker + +# shellcheck disable=SC2329 +readelf() { + printf '%s\n' "$mock_interpreter" +} + +# shellcheck disable=SC2329 +getconf() { + printf 'glibc %s\n' "$mock_glibc" +} + +mock_interpreter=/lib64/ld-linux-x86-64.so.2 +mock_glibc=2.39 +assert_fails requires_container_rebuild "$temporary/bundle/meshcore_open" 2.39 +mock_glibc=2.43 +requires_container_rebuild "$temporary/bundle/meshcore_open" 2.39 +mock_interpreter=/nix/store/glibc/lib/ld-linux-x86-64.so.2 +mock_glibc=2.39 +requires_container_rebuild "$temporary/bundle/meshcore_open" 2.39 +unset -f readelf getconf + printf 'AppImage packaging contract tests passed\n' \ No newline at end of file diff --git a/scripts/build_appimage.sh b/scripts/build_appimage.sh index 92063da4..1a4ba562 100644 --- a/scripts/build_appimage.sh +++ b/scripts/build_appimage.sh @@ -240,7 +240,7 @@ package_container() { mkdir -p "$cache" "$cache/pub" pin="$(sha256sum "$manifest" "$project/scripts/appimage/Dockerfile" | sha256sum)" image="meshcore-open-appimage:${pin:0:16}" - printf 'AppImage: rebuilding in Ubuntu with %s (Flutter %s); native Nix bundle is unchanged\n' \ + printf 'AppImage: rebuilding in Ubuntu with %s (Flutter %s); original native bundle is unchanged\n' \ "$engine" "$(jq -r '.flutter.version' "$manifest")" if ! "$engine" image inspect "$image" >/dev/null 2>&1; then "$engine" build --target build --platform linux/amd64 --tag "$image" \ @@ -252,13 +252,33 @@ package_container() { for key in FLUTTER_TARGET DART_DEFINES DART_OBFUSCATION SPLIT_DEBUG_INFO TREE_SHAKE_ICONS; do environment+=(--env "MESHCORE_APPIMAGE_$key") done - "$engine" run --rm --platform linux/amd64 --user "$(id -u):$(id -g)" \ + local user_namespace=() + if [[ "$engine" == podman ]]; then + user_namespace+=(--userns=keep-id) + fi + "$engine" run --rm --platform linux/amd64 "${user_namespace[@]}" --user "$(id -u):$(id -g)" \ "${environment[@]}" --mount "type=bind,source=$(realpath "$project"),target=/source,readonly" \ --mount "type=bind,source=$output,target=/output" \ --mount "type=bind,source=$cache,target=/cache" \ "$image" bash /source/scripts/build_appimage.sh --container-build } +requires_container_rebuild() { + local executable="$1" baseline="$2" host_glibc host_major host_minor baseline_major baseline_minor + if [[ "$(readelf -l "$executable")" == *'/nix/store/'* ]]; then + return 0 + fi + host_glibc="$(getconf GNU_LIBC_VERSION)" || return 0 + host_glibc="${host_glibc#glibc }" + host_major="${host_glibc%%.*}" + host_minor="${host_glibc#*.}" + host_minor="${host_minor%%.*}" + baseline_major="${baseline%%.*}" + baseline_minor="${baseline#*.}" + [[ "$host_major" =~ ^[0-9]+$ && "$host_minor" =~ ^[0-9]+$ ]] || return 0 + (( host_major > baseline_major || (host_major == baseline_major && host_minor > baseline_minor) )) +} + main() { [[ $# == 5 ]] || { fail 'Expected: project bundle output configuration architecture'; return 1; } local project="$1" bundle="$2" output="$3" configuration="$4" architecture="$5" @@ -276,7 +296,7 @@ main() { pin="$(sha256sum "$manifest")" pin="${pin%% *}" cache="${XDG_CACHE_HOME:-$HOME/.cache}/meshcore-open/appimage/$pin/x86_64" - if [[ "$(readelf -l "$bundle/meshcore_open")" == *'/nix/store/'* ]]; then + if requires_container_rebuild "$bundle/meshcore_open" "$(jq -er '.glibc' "$manifest")"; then package_container "$project" "$output" "$manifest" "$cache" else package_direct "$project" "$bundle" "$output" "$manifest" "$cache"