[PR #916] [MERGED] Server build: Linux servers need neither ALSA nor udev (horizon-engine, its own archive) #2911

Closed
opened 2026-11-02 16:00:03 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/916
Author: @ludovic111
Created: 10/18/2026
Status: ✅ Merged
Merged: 10/18/2026
Merged by: @ludovic111

Base: main ← Head: feat/server-headless-build


📝 Commits (1)

  • 519ec12 Server build: the game without sound or controllers, so Linux servers need neither ALSA nor udev

📊 Changes

14 files changed (+669 additions, -453 deletions)

View changed files

📝 .github/workflows/ci.yml (+2 -0)
📝 .github/workflows/release.yml (+27 -1)
📝 crates/horizon-client/Cargo.toml (+11 -4)
📝 crates/horizon-client/src/audio.rs (+19 -2)
📝 crates/horizon-client/src/game/pad.rs (+41 -363)
➕ crates/horizon-client/src/game/pad/hardware.rs (+409 -0)
📝 crates/horizon-client/src/gamepad.rs (+3 -0)
📝 crates/horizon-server/src/engine.rs (+19 -6)
📝 docs/release-flow.md (+1 -0)
📝 docs/server.md (+29 -21)
📝 packaging/server/Dockerfile (+5 -10)
📝 packaging/server/install.sh (+47 -31)
📝 tools/check_imports.py (+10 -3)
📝 xtask/src/main.rs (+46 -12)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

A Linux server build of the game that needs neither libasound.so.2 (ALSA, via cpal) nor libudev.so.1 (udev, via gilrs and the DualSense's hidapi), so horizon-server runs on minimal server images as they are.

  • horizon-client: cpal moves behind an audio feature, and gilrs plus horizon-dualsense behind a controllers feature. Both are on by default, so the game builds exactly as before. Built with --no-default-features, the game has no sound output (Audio never opens a stream; the stream type becomes Infallible) and only horizon-ctl pad's virtual pad.
    • The controller hardware code (gilrs, the DualSense output, haptics, force-feedback rumble, pad status's hardware fields) moved unchanged from game/pad.rs to game/pad/hardware.rs, behind a Devices struct. A 20-line stub in pad.rs replaces it without the feature. Most of the diff is that move: git diff --color-moved shows it.
  • release.yml: after the client archive, the Linux job rebuilds the game with --no-default-features and packages horizon-server-linux-x86_64.tar.gz (xtask package-server): horizon-engine (that build), horizon-server and horizon-prepare, with the same sources as the client folder. tools/check_imports.py --server fails the job if any of them needs ALSA or udev. The release publishes it as a fourth asset. The client archives and the launcher's release don't change.
  • install.sh: on Linux it installs the server archive, falling back to the full game for releases from before it. The ALSA/udev advice now shows only for that fallback. --archive FILE installs an archive already on the machine (offline, or a build of your own).
  • horizon-server: the lookup already preferred horizon-engine beside it or on the PATH. #898's message now appears only when the missing library really is libasound or libudev. It also names the server build as the alternative.
  • CI: verify also lints the server build, so it can't rot between releases. The Dockerfile builds the server build and drops ALSA and udev from the image.
  • docs/server.md (sections 1–3) and docs/release-flow.md describe it.

Why

server-host-9, item 1: minimal Linux server images lack ALSA and udev, and the game linked both even as a dedicated server (#898 could only explain what to install).

How tested

cargo fmt --all -- --check                                                    ok
cargo clippy --workspace --all-targets -- -D warnings                         ok
cargo clippy -p horizon-client --all-targets --no-default-features -D warnings ok
cargo test -p horizon-client                       880 passed (lib), all bins/tests ok
cargo test -p horizon-client --no-default-features 879 passed (the DualSense trigger test is gated), ok
cargo test -p horizon-server -p xtask               ok (new: no ALSA advice for another missing library)
cargo tree -p horizon-client --no-default-features --target x86_64-unknown-linux-gnu -i alsa-sys|libudev-sys|hidapi|cpal|gilrs
                                                    none in the graph
tools/parity.py dedicated_server server_entities lan   with the server build (defaults off): 3 passed

ThinkPad (NixOS), one install from a locally packaged archive (nice 19, ionice, 2 build jobs; servers stopped afterwards). It ran in an environment without ALSA or udev: no LD_LIBRARY_PATH, and nix-ld's NIX_LD_LIBRARY_PATH pointed at a folder holding only libgcc_s.so.1.

the published full game (latest release), same environment:
  horizon-client: libudev.so.1, libasound.so.2, libgcc_s.so.1, libm.so.6, libc.so.6, ld-linux-x86-64.so.2
  horizon-client --help -> exit 127: error while loading shared libraries: libudev.so.1: cannot open shared object file
the server build (xtask package-server, 27.7 MB archive):
  horizon-engine:  libgcc_s.so.1, libm.so.6, libc.so.6, ld-linux-x86-64.so.2
  horizon-server:  libgcc_s.so.1, libm.so.6, libc.so.6, ld-linux-x86-64.so.2
  horizon-prepare: libgcc_s.so.1, libc.so.6
  (check_imports --server also flags the Nix loader and run path of a local NixOS build; release builds on ubuntu-22.04 use the standard loader)
install.sh --archive ... --version sh9-local   -> Installed Horizon sh9-local; releases/sh9-local holds horizon-engine
horizon-server init --yes (HORIZON_EULA=true, whitelist off, offline, port 25611)
  Game: .../releases/sh9-local/horizon-engine
  Game files: .../releases/sh9-local/.local/horizon-client/26.3
horizon-server start  -> The server is running; "Done (14.047s)!"
horizon-bots --bots 1 --behaviour walk --seconds 20 -> joined 1, 434 chunks, resent 0, no error
  log: "Bot0[/127.0.0.1:36550] logged in with entity id 3 ...", "Bot0 joined the game", "Bot0 left the game"
horizon-server status -> TPS 20.0, MSPT 7.9 ms average; RAM 0.60 GB
horizon-server stop   -> Stopped.

Not run: the Dockerfile (no Docker daemon on the Mac mini or the ThinkPad). Its build stage now needs no system packages, since nothing left in the server build's graph uses pkg-config. The release workflow change runs at the next release (or gh workflow run release.yml as a dry run).

Needs Ludovic

Nothing. After the next release, install.sh on Linux picks up the new asset by itself.

Kira: card#29.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/916 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/server-headless-build` --- ### 📝 Commits (1) - [`519ec12`](https://github.com/horizon-rust/horizon/commit/519ec1217cbf1c4c91bc427ccd2d61a6fdcc383e) Server build: the game without sound or controllers, so Linux servers need neither ALSA nor udev ### 📊 Changes **14 files changed** (+669 additions, -453 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+2 -0) 📝 `.github/workflows/release.yml` (+27 -1) 📝 `crates/horizon-client/Cargo.toml` (+11 -4) 📝 `crates/horizon-client/src/audio.rs` (+19 -2) 📝 `crates/horizon-client/src/game/pad.rs` (+41 -363) ➕ `crates/horizon-client/src/game/pad/hardware.rs` (+409 -0) 📝 `crates/horizon-client/src/gamepad.rs` (+3 -0) 📝 `crates/horizon-server/src/engine.rs` (+19 -6) 📝 `docs/release-flow.md` (+1 -0) 📝 `docs/server.md` (+29 -21) 📝 `packaging/server/Dockerfile` (+5 -10) 📝 `packaging/server/install.sh` (+47 -31) 📝 `tools/check_imports.py` (+10 -3) 📝 `xtask/src/main.rs` (+46 -12) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What A Linux server build of the game that needs neither `libasound.so.2` (ALSA, via cpal) nor `libudev.so.1` (udev, via gilrs and the DualSense's hidapi), so `horizon-server` runs on minimal server images as they are. - **horizon-client:** cpal moves behind an `audio` feature, and gilrs plus `horizon-dualsense` behind a `controllers` feature. Both are on by default, so the game builds exactly as before. Built with `--no-default-features`, the game has no sound output (`Audio` never opens a stream; the stream type becomes `Infallible`) and only `horizon-ctl pad`'s virtual pad. - The controller hardware code (gilrs, the DualSense output, haptics, force-feedback rumble, `pad status`'s hardware fields) moved unchanged from `game/pad.rs` to `game/pad/hardware.rs`, behind a `Devices` struct. A 20-line stub in `pad.rs` replaces it without the feature. Most of the diff is that move: `git diff --color-moved` shows it. - **release.yml:** after the client archive, the Linux job rebuilds the game with `--no-default-features` and packages `horizon-server-linux-x86_64.tar.gz` (`xtask package-server`): `horizon-engine` (that build), `horizon-server` and `horizon-prepare`, with the same sources as the client folder. `tools/check_imports.py --server` fails the job if any of them needs ALSA or udev. The release publishes it as a fourth asset. The client archives and the launcher's release don't change. - **install.sh:** on Linux it installs the server archive, falling back to the full game for releases from before it. The ALSA/udev advice now shows only for that fallback. `--archive FILE` installs an archive already on the machine (offline, or a build of your own). - **horizon-server:** the lookup already preferred `horizon-engine` beside it or on the PATH. #898's message now appears only when the missing library really is libasound or libudev. It also names the server build as the alternative. - **CI:** `verify` also lints the server build, so it can't rot between releases. The **Dockerfile** builds the server build and drops ALSA and udev from the image. - docs/server.md (sections 1–3) and docs/release-flow.md describe it. ## Why server-host-9, item 1: minimal Linux server images lack ALSA and udev, and the game linked both even as a dedicated server (#898 could only explain what to install). ## How tested ``` cargo fmt --all -- --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo clippy -p horizon-client --all-targets --no-default-features -D warnings ok cargo test -p horizon-client 880 passed (lib), all bins/tests ok cargo test -p horizon-client --no-default-features 879 passed (the DualSense trigger test is gated), ok cargo test -p horizon-server -p xtask ok (new: no ALSA advice for another missing library) cargo tree -p horizon-client --no-default-features --target x86_64-unknown-linux-gnu -i alsa-sys|libudev-sys|hidapi|cpal|gilrs none in the graph tools/parity.py dedicated_server server_entities lan with the server build (defaults off): 3 passed ``` **ThinkPad (NixOS), one install from a locally packaged archive** (nice 19, ionice, 2 build jobs; servers stopped afterwards). It ran in an environment without ALSA or udev: no `LD_LIBRARY_PATH`, and nix-ld's `NIX_LD_LIBRARY_PATH` pointed at a folder holding only `libgcc_s.so.1`. ``` the published full game (latest release), same environment: horizon-client: libudev.so.1, libasound.so.2, libgcc_s.so.1, libm.so.6, libc.so.6, ld-linux-x86-64.so.2 horizon-client --help -> exit 127: error while loading shared libraries: libudev.so.1: cannot open shared object file the server build (xtask package-server, 27.7 MB archive): horizon-engine: libgcc_s.so.1, libm.so.6, libc.so.6, ld-linux-x86-64.so.2 horizon-server: libgcc_s.so.1, libm.so.6, libc.so.6, ld-linux-x86-64.so.2 horizon-prepare: libgcc_s.so.1, libc.so.6 (check_imports --server also flags the Nix loader and run path of a local NixOS build; release builds on ubuntu-22.04 use the standard loader) install.sh --archive ... --version sh9-local -> Installed Horizon sh9-local; releases/sh9-local holds horizon-engine horizon-server init --yes (HORIZON_EULA=true, whitelist off, offline, port 25611) Game: .../releases/sh9-local/horizon-engine Game files: .../releases/sh9-local/.local/horizon-client/26.3 horizon-server start -> The server is running; "Done (14.047s)!" horizon-bots --bots 1 --behaviour walk --seconds 20 -> joined 1, 434 chunks, resent 0, no error log: "Bot0[/127.0.0.1:36550] logged in with entity id 3 ...", "Bot0 joined the game", "Bot0 left the game" horizon-server status -> TPS 20.0, MSPT 7.9 ms average; RAM 0.60 GB horizon-server stop -> Stopped. ``` Not run: the Dockerfile (no Docker daemon on the Mac mini or the ThinkPad). Its build stage now needs no system packages, since nothing left in the server build's graph uses pkg-config. The release workflow change runs at the next release (or `gh workflow run release.yml` as a dry run). ## Needs Ludovic Nothing. After the next release, `install.sh` on Linux picks up the new asset by itself. Kira: card#29. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 16:00:03 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2911
No description provided.