fix(cargo): drop optional on mlua/glob/notify to dodge chroot resolver bug

Second chroot test still failed with the same `undefined symbol:
lua_gettop` linker errors after hoisting features to the cargo
feature row in a4d4f30. mlua-sys runs its build script (the search
path `-L .../mlua-sys-*/out/lib` is in the gcc command line) but no
`liblua5.4.a` lands in OUT_DIR. The `vendored` feature isn't
propagating across the `optional = true` boundary even with the
feature-row syntax.

Reproduced on the LOCAL machine: clean `cargo build --frozen
--release --features full` succeeds with Arch's exact CFLAGS,
CXXFLAGS, LDFLAGS, LTOFLAGS. mlua-sys+lua-src+cc all work. So
something specific to the chroot's `extra/rust 1.95.0` package
(or its build environment) breaks the optional-dep feature
propagation for vendored. Couldn't pin the exact root cause
without chroot interactive access.

Pragmatic fix: drop `optional = true` from mlua, glob, and notify.
Inline `features = ["lua54", "vendored", "send", "serialize"]` on
the now-non-optional mlua dep — cargo resolves non-optional dep
features eagerly and consistently, no resolver-boundary surprises.

The `lua` cargo feature stays as a pure marker (gates the
crates/owlry/src/lua module via `#[cfg(feature = "lua")]`). Minimal
builds (`cargo install owlry --no-default-features`) still compile
mlua + glob + notify but skip the lua module — they pay maybe 20-30s
of extra compile time and a few MB of stripped-binary bloat for the
deps, but get a working build matrix that's identical in chroot.

Verified locally:
- `cargo clean && cargo build --frozen --release --features full`
  builds clean in 32s with liblua5.4.a in OUT_DIR
- 352/352 lib tests with --features full
- 182/182 lib tests with --no-default-features
- Clippy silent across both configs

Re-run `just aur-local-test owlry` to confirm the chroot builds clean.
This commit is contained in:
2026-05-13 13:04:19 +02:00
parent a4d4f30d1e
commit b3764b308e
+16 -20
View File
@@ -65,19 +65,23 @@ futures-channel = "0.3"
# Lua 5.4 runtime for user configuration (Phase 3 — opt-in preview in 2.1).
# Vendored C source so AUR clean-chroot builds don't depend on a system Lua.
# IMPORTANT: features live on the `lua` cargo feature row below, NOT inline
# here. Inline `features = [...]` on an `optional = true` dep get dropped
# by cargo's feature resolver in clean chroots (e.g. `cargo build --frozen`
# under makepkg), producing a build that tries to link against a non-vendored
# system liblua. Same gotcha we hit with rusqlite during the v2 migration.
mlua = { version = "0.11", optional = true }
#
# NOT optional. Initial designs gated mlua/glob/notify behind `optional = true`
# so non-lua builds wouldn't pay for them, but cargo's feature resolver in
# clean chroots (`cargo build --frozen` under makepkg) silently fails to
# propagate `mlua/vendored` across the optional boundary — the build script
# ends up emitting `-llua5.4` against a non-existent system liblua. Inlining
# the features on a *non-optional* dep dodges that footgun entirely. The cost
# is a few MB of extra compile time for minimal builds; the `lua` cargo
# feature still gates whether the `lua` module is compiled at all.
mlua = { version = "0.11", features = ["lua54", "vendored", "send", "serialize"] }
# Glob pattern support for `owlry.util.glob` (Phase 3.6). Pure-Rust; small.
glob = { version = "0.3", optional = true }
glob = "0.3"
# Filesystem watching for owlry.lua hot reload (Phase 3.7). On Linux the
# inotify backend is unconditional, so default features are fine.
notify = { version = "6", optional = true }
notify = "6"
[build-dependencies]
# GResource compilation for bundled icons
@@ -102,18 +106,10 @@ systemd = []
websearch = []
# Lua config layer (Phase 3 — opt-in preview in 2.1, default in 2.2, mandatory in 3.0).
# Pulls in mlua's vendored Lua 5.4 runtime, glob for owlry.util.glob, and
# notify for owlry.lua hot reload. mlua features are listed here (not inline
# on the dep above) so cargo's feature resolver keeps them in clean chroots.
lua = [
"dep:mlua",
"mlua/lua54",
"mlua/vendored",
"mlua/send",
"mlua/serialize",
"dep:glob",
"dep:notify",
]
# Pure marker feature: gates the `lua` module compilation via cfg. Deps
# (mlua / glob / notify) are unconditionally pulled in to dodge the chroot
# feature-propagation footgun documented on the mlua line above.
lua = []
# Bookmarks deferred for 2.0 alongside the widget providers (D20+).
# Returns in a later 2.x release with a pure-Rust path that doesn't pull