Skip to content

fix(geisterhand): link the geisterhand-built stdlib, not the auto-optimized one (#1383)#2315

Merged
proggeramlug merged 1 commit into
mainfrom
worktree-fix-1383-geisterhand-stdlib-link
May 28, 2026
Merged

fix(geisterhand): link the geisterhand-built stdlib, not the auto-optimized one (#1383)#2315
proggeramlug merged 1 commit into
mainfrom
worktree-fix-1383-geisterhand-stdlib-link

Conversation

@proggeramlug
Copy link
Copy Markdown
Contributor

Summary

Fixes the remaining link-side half of #1383. PR #1385 already fixed the build side (-p perry-stdlib is in the geisterhand cargo invocation), but the stdlib that actually got linked under --enable-geisterhand was still the auto-optimized one.

The auto-optimized stdlib is built --no-default-features with a feature set derived from the app's TS imports. A geisterhand UI app pulls its async surface from a native binding (@perryts/storekit / google-auth / play-billing, all using perry_ffi::async_runtime::JsPromise), not TS — so auto-optimize never enables async-runtime, the linked stdlib lacks perry_ffi_promise_*, and the link dies with:

Undefined symbols for architecture arm64:
  "_perry_ffi_promise_new", referenced from: … libperry_storekit.a …

Fix

  • find_geisterhand_stdlib(target) — new finder mirroring find_geisterhand_runtime; searches only the target/geisterhand/… dirs, so it returns the geisterhand-built stdlib (full default features incl. async-runtime, sharing a hash-consistent perry-runtime) and never the auto-optimized one.
  • compile.rs — when ctx.needs_geisterhand, select that stdlib for the link (falling back to the auto-optimized stdlib if absent). Keeps the bundled perry-runtime hash-consistent with gh_runtime.
  • gh_missing cold-build check (both the compile.rs runtime-selection site and the link/mod.rs link site) now includes the geisterhand stdlib, so a stale target/geisterhand dir built before the stdlib was added rebuilds instead of silently falling back.

Verification

  • cargo build --release -p perry — compiles clean (no new warnings/errors).
  • cargo fmt --all -- --check — clean.
  • Not verified end-to-end: the native-FFI iOS link needs the iOS toolchain + the @perryts/* native-binding crates, which aren't available in this environment. The change is gated on ctx.needs_geisterhand and falls back to prior behavior when no geisterhand stdlib is present, so non-async geisterhand links are unaffected.

Closes #1383.

…imized one (#1383)

PR #1385 fixed the BUILD half of #1383 by adding `-p perry-stdlib` to the
single geisterhand cargo invocation, so a geisterhand-featured, async-enabled
`libperry_stdlib.a` lands in target/geisterhand with a hash-consistent
perry-runtime. But the LINK half was still broken: the stdlib actually linked
under `--enable-geisterhand` was the auto-optimized one, built with
`--no-default-features` and a feature set derived from the app's *TS* imports.

For a geisterhand UI app whose async surface comes from a native binding
(@perryts/storekit / google-auth / play-billing — all using
`perry_ffi::async_runtime::JsPromise`) rather than TS, auto-optimize never
enables `async-runtime`, so the linked stdlib lacks `perry_ffi_promise_*` and
the link fails with `Undefined symbols: _perry_ffi_promise_new`.

Fix:
- Add `find_geisterhand_stdlib(target)` (mirrors `find_geisterhand_runtime`):
  searches only the target/geisterhand build dirs, so it returns the
  geisterhand-built stdlib (full default features incl. async-runtime) and
  never the auto-optimized one.
- In compile.rs, when `ctx.needs_geisterhand`, select that stdlib for the link
  (falling back to the auto-optimized stdlib if absent). This also keeps the
  bundled perry-runtime hash-consistent with `gh_runtime`.
- Include the geisterhand stdlib in the `gh_missing` cold-build check (both the
  compile.rs runtime-selection site and the link/mod.rs link site) so a stale
  target/geisterhand dir built before the stdlib was added triggers a rebuild
  instead of silently falling back.
@proggeramlug proggeramlug merged commit 7772bfd into main May 28, 2026
11 checks passed
@proggeramlug proggeramlug deleted the worktree-fix-1383-geisterhand-stdlib-link branch May 28, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--enable-geisterhand doesn't build perry-stdlib with app async features — native-FFI apps fail to link (perry_ffi_promise_*)

1 participant